Bug Tracker

Opened 5 years ago

Closed 5 years ago

#15104 closed bug (migrated)

.clone copies non-scalar properties, including the Sizzle cache

Reported by: Jogi Owned by: gibson042
Priority: blocker Milestone: 1.12
Component: manipulation Version: 1.11.1
Keywords: Cc:
Blocked by: Blocking:

Description

Issue with space in selector with jquery 1.11.1 and Internet explorer.

exemple:

$(".testCls [name='blabla']")

cannot find anything when with older version, it work.

jsfiddle: http://jsfiddle.net/kwfHZ/1/

Change History (13)

comment:1 Changed 5 years ago by Jogi

wrong jsfiddle http://jsfiddle.net/kwfHZ/3/

i'm trying to reproduce my case correctly ...

comment:2 Changed 5 years ago by gibson042

Owner: set to Jogi
Status: newpending

Your examples seem to be working correctly. Can you describe what you're trying to do, what behavior you're expecting, and what behavior you're seeing?

comment:3 Changed 5 years ago by gibson042

#15103 is a duplicate of this ticket.

comment:4 Changed 5 years ago by Jogi

Status: pendingnew

0k So there is my case:

http://jsfiddle.net/xorkk/JTtu3/

I don't understand why on IE8:

$("#tblMF .numasaCmp_1 [name='NUMASA_CMP']") => undefined

but $("#tblMF .numasaCmp_1").find("[name='NUMASA_CMP']") => works

On Firefox, both works.

comment:5 Changed 5 years ago by gibson042

Status: newpending

We'll need something more reduced than 1.4 KB of HTML plus a script unrelated to this issue.

comment:6 Changed 5 years ago by Jogi

Status: pendingnew

Ok i've reduced the exemple:

http://jsfiddle.net/xorkk/JTtu3/

Last edited 5 years ago by Jogi (previous) (diff)

comment:7 Changed 5 years ago by Jogi

i See one more thing, if i remove the line with .prop("disabled", false) , my selector works correclty.

comment:8 Changed 5 years ago by Jogi

other observation:

$("#tblMF .numasaCmp_1 [name='NUMASA_CMP']") => undefined

but $("#tblAA .numasaCmp_1 [name='NUMASA_CMP']") => work

comment:9 Changed 5 years ago by gibson042

Owner: changed from Jogi to gibson042
Status: newassigned

I removed superfluous markup and script from your fiddle and changed .val() to .length for better insight: http://jsfiddle.net/JTtu3/57/

There is something to this that seems to be related to Sizzle combinator caching in oldIE.

comment:10 Changed 5 years ago by Jogi

Same problem with ":input" instead of [name...]

$(".nonStructAssetTemplate :input").length == 0
$(".nonStructAssetTemplate").find(":input").length != 0

Last edited 5 years ago by Jogi (previous) (diff)

comment:11 Changed 5 years ago by gibson042

This is actually a problem with .clone: http://jsfiddle.net/JTtu3/59/

In IE8 (and other versions as well, I'm sure), the clone still has a reference to the Sizzle cache object of its referent, which wreaks all kinds of havoc with any operation using it. Maybe we can update fixCloneNodeIssues to look for and remove attributes associated with reference-equal clone/source properties.

comment:12 Changed 5 years ago by gibson042

Component: selectormanipulation
Milestone: None1.12
Summary: Space in selector problem.clone copies non-scalar properties, including the Sizzle cache

comment:13 Changed 5 years ago by m_gol

Resolution: migrated
Status: assignedclosed
Note: See TracTickets for help on using tickets.