Bug Tracker

Opened 14 years ago

Closed 14 years ago

#4254 closed bug (invalid)

Traversing not finding siblings within paragraphs

Reported by: ncrossland Owned by:
Priority: minor Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

When traversing elements which are contained within a paragraph, the P's child elements are not being treated as children.

In the following test case, nextAll should find the same siblings each time. But, whenever the link's parent is a P, it fails.

<script type="text/javascript"> $( function() {

$('.feed').each(function(i) {

console.log('Iteration: '+i); console.log( $(this).nextAll('div.feedTemplate') );

});

}); </script>

<p> <a href="#" class="feed">Link</a> <div class="feedTemplate">Paragraph</div> </p>

<p><div> <a href="#" class="feed">Link</a> <div class="feedTemplate">Paragraph and DIV</div> </div></p>

<div><p> <a href="#" class="feed">Link</a> <div class="feedTemplate">DIV and Paragraph</div> </p></div>

<div> <a href="#" class="feed">Link</a> <div class="feedTemplate">DIV</div> </div>

<span> <a href="#" class="feed">Link</a> <div class="feedTemplate">SPAN</div> </span>

Change History (2)

comment:1 Changed 14 years ago by ncrossland

This may be because putting a DIV inside a P is invalid under XHTML 1 strict??

comment:2 Changed 14 years ago by dmethvin

Resolution: invalid
Status: newclosed

It's also invalid in HTML4. If you look at the document tree, the parser probably closed the P tag before starting the DIV.

http://www.w3.org/TR/html401/struct/text.html#h-9.3.1

Note: See TracTickets for help on using tickets.