:last-child with text elements
I'm trying to find the trailing
<br/>s from a
<p> using the '
br:last-child' selector and I find surprising that in a context like:
- <p>some text<br/>and some more text</p>
$('p br:last-child') returns the <br/> although there is a text node after it. I suspect there may be an issue because if you get the returned <br/>:
- var br = $('p br:last-child')[0];
and get its parent's last child walking the DOM properties:
- br.parentNode.lastChild
you get the text node containing "and some more text".
So, should the <br/> in this context match or not?