W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2006

[whatwg] getElementsByClassName()

From: Ric Hardacre <whatwg@cycloid.f9.co.uk>
Date: Fri, 03 Feb 2006 14:26:37 +0000
Message-ID: <43E3681D.60806@cycloid.f9.co.uk>


Lachlan Hunt wrote:
 > Ric Hardacre wrote:
 >> Gervase Markham wrote:
 >>> If you have:
 >>>
 >>> <p class="foo bar">Fred</p>
 >>> <p class="bar foo">Barney</p>
 >>> <p class="foo baz bar">Wilma</p>
 >>>
 >>> which should be picked up by getElementsByClassName("foo bar")?
 >>
 >> this also raises the possibility of some confusion as the order of 
inheritance is important:
 >>
 >> foo
 >> {
 >>    color: red;
 >> }
 >>
 >> bar
 >> {
 >>    color: blue;
 >> }
 >>
 >> in the quoted example Fred and Wilma would be blue and barney red.
 >
 > According to which rules specified in CSS will that be the case? 
Given that CSS (assuming you meant to use class selectors instead), all 
three markup samples will be blue.  The order of the class names in the 
markup is irrelevant.  The order of the rules specified in the CSS is 
relevant and the latter rule of equal specificity takes precedence.
 >

just checked it, i was wrong, oops!

ric
Received on Friday, 3 February 2006 06:26:37 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:26 UTC