Skip to main content

Bug Tracker

Side navigation

#5316 closed bug (fixed)

Opened October 01, 2009 04:16PM UTC

Closed November 19, 2010 10:57PM UTC

replaceAll only the first element from the matched set replaces the selector set

Reported by: TUSHKA Owned by:
Priority: high Milestone: 1.4.3
Component: manipulation Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:
Description

var jq = $("<selector1>") // selects more than one element

jq.replaceAll("<selector2>")

only the first matched element from jq will show up as the replacement for "<selector2>"

Possible Fix: See Attachment

Attachments (2)
  • jquery-replaceall-testcase.html (1.6 KB) - added by Perceptes December 03, 2009 11:53PM UTC.

    A test case to show the issue, run it in a browser to see what's happening.

  • jquery.txt (0.8 KB) - added by TUSHKA October 01, 2009 04:19PM UTC.

    Possible Fix

Change History (3)

Changed October 01, 2009 04:26PM UTC by TUSHKA comment:1

Possible fix, invoke replaceWith using call rather than apply. This will affect appendTo/append, prependTo/prepend, insertBefore/before, insertAfter/after as well, but it seems like those will work regardless of whether they are invoked via call or apply

Changed December 02, 2009 11:09AM UTC by Troanis comment:2

Hello,

My workaround until fixed

jq.wrap('<div/>').parent().replaceAll("<selector2>").replaceWith(jq)

Changed November 19, 2010 10:57PM UTC by jitter comment:3

component: coremanipulation
milestone: 1.41.4.3
priority: minorhigh
resolution: → fixed
status: newclosed
version: 1.3.21.4.2

test case fixed for 1.4.3