Skip to main content

Bug Tracker

Side navigation

#6068 closed bug (fixed)

Opened February 10, 2010 06:20PM UTC

Closed February 13, 2010 07:49AM UTC

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>

Attachments (0)
Change History (1)

Changed February 13, 2010 07:49AM UTC by john comment:1

resolution: → fixed
status: newclosed