Bug Tracker

Opened 10 years ago

Closed 10 years ago

#6068 closed bug (fixed)

Elements removed from a jQuery object with .filter() are still inserted with .prependTo() and .appendTo()

Reported by: elijahr Owned by:
Priority: Milestone: 1.4.2
Component: manipulation Version: 1.4.1
Keywords: filter, prependTo, appendTo Cc:
Blocked by: Blocking:

Description

If I filter a jQuery object and use .prependTo() or .appendTo() to insert the elements into the document, the removed elements are still inserted into the document. See below for an example:

<script> var

html = '<style type="text/css">body {color:red;}</style>' +

'<script>alert("foo")</script>' + '<div id="foo">bar</div>',

$elems = $(html).filter('div'); $elems contains only the <div> element

$elems.prependTo(document.body); the <style>, <script>, and <div> elements are all inserted into the document's body.

only the <div> should be inserted. </script>

Change History (1)

comment:1 Changed 10 years ago by john

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.