Loading ...
Sorry, an error occurred while loading the content.
 

Re: CSS 3 selectors.

Expand Messages
  • pauanyu
    ... Right now? [key*= value ] [key^= value ] [key~= value ] ... P.S. JSLint also complains about: Is there any good reason for that?
    Message 1 of 9 , Jul 25, 2009
      --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
      >
      > What specifically do you need?
      >

      Right now?

      [key*='value']
      [key^='value']
      [key~='value']
      :nth-child(n)
      :not(foo)

      P.S. JSLint also complains about:

      <div class=":foo"></div>

      Is there any good reason for that?
    • Douglas Crockford
      ... You ve got it. ... Is there any good reason to put a colon in a class name?
      Message 2 of 9 , Jul 25, 2009
        --- In jslint_com@yahoogroups.com, "pauanyu" <pcxunlimited@...> wrote:
        >
        > --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@> wrote:
        > >
        > > What specifically do you need?
        > >
        >
        > Right now?
        >
        > [key*='value']
        > [key^='value']
        > [key~='value']
        > :nth-child(n)
        > :not(foo)

        You've got it.

        > P.S. JSLint also complains about:
        >
        > <div class=":foo"></div>
        >
        > Is there any good reason for that?

        Is there any good reason to put a colon in a class name?
      • pauanyu
        ... I m using it with a syntax highlighter to avoid class collisions and offer CSS styling. For instance, a pre tag that contains JavaScript text would be:
        Message 3 of 9 , Jul 25, 2009
          --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
          >
          > Is there any good reason to put a colon in a class name?
          >

          I'm using it with a syntax highlighter to avoid class collisions and offer CSS styling. For instance, a pre tag that contains JavaScript text would be:

          <pre class=":js">
          // JavaScript goes here!
          </pre>

          HTML would be ":html", etc. This also means I can do stuff like:

          *[class^=':']

          Which would find all the special tags, etc.

          It's not a huge deal, I'm just curious why there would be such a restriction. I mean, aren't CSS classes allowed to contain basically any (reasonable) character?

          P.S. Thanks, some of the CSS3 selectors are very useful.
        • mnewton32@yahoo.ca
          They are allowed to contain almost any character, but can only start with letters, numbers, or the underscore I believe. It s there in the (very readable) HTML
          Message 4 of 9 , Jul 26, 2009
            They are allowed to contain almost any character, but can only start with letters, numbers, or the underscore I believe. It's there in the (very readable) HTML 4.01 spec. http://w3.org/TR/html4 if I recall correctly.

            Sent from my BlackBerry device on the Rogers Wireless Network

            -----Original Message-----
            From: "pauanyu" <pcxunlimited@...>

            Date: Sun, 26 Jul 2009 06:11:50
            To: <jslint_com@yahoogroups.com>
            Subject: [jslint] Re: CSS 3 selectors.


            --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
            >
            > Is there any good reason to put a colon in a class name?
            >

            I'm using it with a syntax highlighter to avoid class collisions and offer CSS styling. For instance, a pre tag that contains JavaScript text would be:

            <pre class=":js">
            // JavaScript goes here!
            </pre>

            HTML would be ":html", etc. This also means I can do stuff like:

            *[class^=':']

            Which would find all the special tags, etc.

            It's not a huge deal, I'm just curious why there would be such a restriction. I mean, aren't CSS classes allowed to contain basically any (reasonable) character?

            P.S. Thanks, some of the CSS3 selectors are very useful.




            [Non-text portions of this message have been removed]
          • pauanyu
            ... Thanks for the link. I took some quick glances at it and didn t notice any mention that CLASS must begin with letters, numbers, or the underscore. I did
            Message 5 of 9 , Jul 26, 2009
              --- In jslint_com@yahoogroups.com, mnewton32@... wrote:
              >
              > They are allowed to contain almost any character, but can only start with letters, numbers, or the underscore I believe. It's there in the (very readable) HTML 4.01 spec. http://w3.org/TR/html4 if I recall correctly.
              >
              > Sent from my BlackBerry device on the Rogers Wireless Network
              >

              Thanks for the link. I took some quick glances at it and didn't notice any mention that CLASS must begin with letters, numbers, or the underscore. I did find this:

              ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

              Note that is for ID and NAME, not CLASS. In addition, because CLASS is a cdata-list, it can also contain unescaped HTML entities as well.

              If I'm reading this properly, that means CLASS can contain *any* characters, separated by whitespace.

              Here's the relevant link about CDATA:
              http://www.w3.org/TR/html4/types.html#type-cdata
            Your message has been successfully submitted and would be delivered to recipients shortly.