Selector bug?
Selector bug?
<div><span class="gmail_quote">On 8/3/07, <b class="gmail_sendername">John Resig</b> <<a href="mailto:jeresig@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
jeresig@gmail.com</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
$("div > :last") to find the last child element in a div.
--John
</blockquote></div>
Should this return two elements if it is executed on a document containing two div's, with two last child elements? As of
<a href="http://1.1.3.1/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">1.1.3.1</a>, on FireFox 2 on WinXP
<div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">
$("ul > li:last")
</span><span style="font-family: courier new,monospace;"></span>
</div><span style="font-family: courier new,monospace;">
</span>Only returns the last element of the last ul, which is not what I expected. I was expecting it to act similarly to CSS2's <a href="http://www.w3.org/TR/REC-CSS2/selector.html#first-child" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
:first-child</a> and CSS3's <a href="http://www.w3.org/TR/css3-selectors/#last-child-pseudo" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">:last-child</a> pseudo-classes...
Is this a bug?
Cheers,
<span class="sg"><span>Andrey</span></span>