Skip to main content

Bug Tracker

Side navigation

#4254 closed bug (invalid)

Opened February 26, 2009 10:37AM UTC

Closed February 27, 2009 12:52AM UTC

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>

Attachments (0)
Change History (2)

Changed February 26, 2009 05:02PM UTC by ncrossland comment:1

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

Changed February 27, 2009 12:52AM UTC by dmethvin comment:2

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