@rule for class attribute (Was: Another approch to style hyperlinks)

On Fri, 3 Aug 2001, fantasai wrote:
>
> What you /do/ need is an @rule to identify the class attribute.

In practice, that's not a workable solution. The class attribute can be
handled specially at parse time in order to increase the performance of
matching on it. Therefore the attribute must be known to be the class
attribute before the stylesheet is read.

I once came up with the following XSchema data type definition which would
allow people to mark their attributes as being the class attribute without
resorting to changing the UA implementations, which may be used in a
future version of the Selectors module:


<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:css="http://www.w3.org/2001/Selectors"
            targetNamespace="http://www.w3.org/2001/Selectors">
 <xsd:simpleType name="class">
  <xsd:list itemType="xsd:string"/>
  <xsd:annotation>
   <xsd:documentation source="http://www.w3.org/TR/Selectors"
                      xml:lang="en">
    <![CDATA[
    The dot notation of Selectors SHOULD match attributes declared to
    be of this type. For example, the following element:

       <foo type="bright green" class="red"/>

    ...would match the following three selectors:

       .bright, .green, .bright.green

    ...assuming that the relevant schema defined the <foo> element as:

       <xsd:element xmlns:css="http://www.w3.org/2001/Selectors"
                    name="foo">
        <xsd:complexType>
         <xsd:attribute name="type"  type="css:class"/>
         <xsd:attribute name="class" type="xsd:string"/>
        </xsd:complexType>
       </xsd:element>

    However the same element MUST not match this selector:

       .red

    ...because there is nothing magical about the "class" attribute
    itself on the foo element.
    ]]>
   </xsd:documentation>
  </xsd:annotation>
 </xsd:simpleType>
</xsd:schema>


-- 
Ian Hickson                                            )\     _. - ._.)   fL
Invited Expert, CSS Working Group                     /. `- '  (  `--'
The views expressed in this message are strictly      `- , ) -  > ) \
personal and not those of Netscape or Mozilla. ________ (.' \) (.' -' ______

Received on Friday, 3 August 2001 00:58:53 UTC