Bug Tracker

Modify

Ticket #11599 (closed bug: invalid)

Opened 13 months ago

Last modified 13 months ago

before()/insertBefore() breaks node ordering when using a comment node

Reported by: lucas@… Owned by: lucas@…
Priority: low Milestone: None
Component: manipulation Version: 1.6.4
Keywords: Cc:
Blocking: Blocked by:

Description

When inserting more than one node before a comment node the comment node does not stay at the end of the inserted elements in the DOM, it ends up directly after the first inserted node.

$(aCommentNode).before($elsToInsert);//order breaks
$elsToInsert.insertBefore(aCommentNode);//order breaks
//retains correct order
var $comment = $(aCommentNode);
$elsToInsert.each(function() {
  $comment.before(this);
});

Perhaps this affects other non-element nodeTypes as well.

Experienced in Firefox 11 on Win 7.

Change History

comment:1 Changed 13 months ago by addyosmani

  • Owner set to lucas@…
  • Priority changed from undecided to low
  • Status changed from new to pending
  • Component changed from unfiled to manipulation

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate:  http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

comment:2 Changed 13 months ago by dmethvin

Also note that in general, text and comment nodes are not supported in a jQuery collection. There are a few methods like .contents() that obtain them but many jQuery methods will either ignore or remove them.

comment:3 Changed 13 months ago by ucavus

Issue no longer present  http://jsfiddle.net/aBW3n/1/

comment:4 Changed 13 months ago by ucavus

Make that never present. It's a bug in Firebug. Sorry.

comment:5 Changed 13 months ago by rwaldron

  • Status changed from pending to closed
  • Resolution set to invalid

Closing per op

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.