Re: [css3-images] CSS element reference identifier

On 02/06/2012 12:46 AM, Tab Atkins Jr. wrote:
> On Sun, Feb 5, 2012 at 10:26 AM, L. David Baron<dbaron@dbaron.org>  wrote:
>> http://dev.w3.org/csswg/css3-images/#element-reference
>> (Overview.html revision 1.269) says the following:
>>
>>   # (CSS does not define how an element acquires a CSS element
>>   # reference identifier; that is determined by the host language.)
>>
>> I think this should have more useful text.  For example, it could
>> say:
>>
>>   For example, for [HTML5], see the definition of CSSElementMap at
>>   <a>...</a>.
>>
>> Even better, it could perhaps even define the behavior for HTML, but
>> allow other languages to define different behavior.
>>
>> I think specifying features in CSS that require the host language to
>> define something, without giving any hint as to what happens for the
>> common use case, is a bad idea.  It makes it hard for readers of the
>> specification to figure out how to use the language, and it has the
>> potential to create a gap between specifications that's never filled
>> in.
>
> Elika and I were recently discussing this, and realized that having
> the element reference identifier use the current grammar (as a bare
> IDENT) is future-hostile, as we plan to eventually extend it to accept
> arbitrary selectors, and IDENTs collide with tagname selectors.
>
> So, I'm changing it to just accept id selectors, and will instead
> define that the CSSElementMap is consulted for ids if one isn't found
> in the document.  Should it check the map before or after the
> document?  I think -moz-element() currently consults its map first.
>
> Question - if no element is matched, or if there's a cycle, the spec
> currently defines that it represents a transparent image.  Should I
> instead define that it's a generic failed image, so that one can use
> image() to do fallback based on that?

The spec has been updated to:

   - only accept the ID selector form of argument to element() (and
     specify that if multiple match, the first one is taken)

   - informatively refer to the HTML spec for CSSElementMap, which
     would need to define how its mapping is added to the ID mapping
     table

   - defined element() to be an invalid image in cases where it cannot
     be resolved, and allowed it to be used as an argument to image()
     so that fallbacks can be given

The updated prose is available in the editor's draft:
   http://dev.w3.org/csswg/css3-images/#element-reference

Please let us know if these changes are acceptable.

~fantasai

Received on Wednesday, 29 February 2012 09:21:18 UTC