-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Manipulation: Break reference copies in cloned properties #1652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/manipulation.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dest[ p ] !== support.cloneProps[ p ] is not strictly necessary, but without it we'd be executing lines like dest.removeAttribute("appendChild"). I ultimately decided to avoid those by having the support property be element-valued, with all associated consequences.
|
Yes, cloning expandos is by the design for oldIE, see #1034 and Line 187 in a953389
In order to fix this minor bug we need to iterate over like 154 (in IE8) properties for every node. Which There is easy and obvious way to fix this, right? Is to expose Sizzle expando like we expose jQuery expando – I think we should land support module opmization and provide different PR for #15104. |
|
I was hoping the Does anyone else (@dmethvin, @rwaldron, …) want to weigh in on the palatable options?
I'm inclined towards 1, but weakly. |
|
It turns out that And as a bonus, it comes with a small size reduction: |
|
I'm sorry, i should have been pay more attention to this issue. We were over this again and again, maybe not you, but i have been and i should have been remember this. For oldIE, this – div.test = 1;
// and
div.setAttribute( "test", 1 );is the same thing, for everyones else it is not. Every other browser will copy content attributes but not element properties. So essentially, this $( "<div/>" ).attr( "test", 1 ).clone().attr( "test" );Will have different effect comparing to oldIE with everyone else. In short: just expose Sizzle expando. |
Yes.
Huh? Did you mean to use
I don't see how that follows. This is an oldIE problem broader than Sizzle, and the fix here is specific to oldIE. |
alert( $( "<div/>" ).attr( "test", 1 ).clone().attr( "test" ) );Execute this code with your changes in Chrome (for example) and oldIE. And do the same with current 1.x-master |
|
I think it would be better than explaining the same thing with words |
|
Ah, the scales have fallen from my eyes. Updates forthcoming, including test suite additions. |
|
Don't understand why you clinging to this solution so badly:
div = document.createElement( "div" );
div.setAttribute( "test", 1 );
alert( $( div ).clone().attr( "test" ) ); |
|
That's intentional; And we don't make a habit of supporting non-jQuery DOM abuse. |
If everything in browser would work according to the spec, that would be great.
Not sure if that could be considered as "abuse", my point is you trying to solve very minor issue, while providing new behavior that could bite us in the future. Why not do the same thing as we did before? I.E. remove Sizzle expando just like we did with jQuery expando? It work perfectly, no one had issues with that and now we introducing some unpredictable code-path with no real reason at all, which would affect people code, even if we considered that as an "abuse" or not, which would give us additional complexity, performance decrease and size increase. |
|
We have |
It wasn't for as long as jQuery existed, only case that is come up was related to our internal logic, i propose to use simple way first, when (if) someone would face that in real life - only than i would adopt something more. |
|
Whereas those issues -
Was a real issues from the start |
|
I'll also note that the PR in its current state fixes pollution from multiple instances of Sizzle and/or jQuery¹, which is not otherwise possible. At any rate, @markelog and I appear to be at an impasse. Would anyone else like to offer an opinion? ¹ Excepting HTML5 elements, upon which the jQuery expando is a string (which is why the |
|
I suppose "adjudicator" from the team would suffice |
|
None of the choices look that good to me. Just clearing the Sizzle expando for the copy of Sizzle used by this jQuery won't fix any Given the tradeoffs I guess I'd go with clearing the Sizzle expando; let's see if any of the other potential latent issues are ever reported. |
|
"There is no unsolvable problems only unpleasant solutions" |
|
So we didn't wrap up consensus this week for what we would do here. I'd just propose we clear the Sizzle expando for the current jQuery instance, assuming that will fix most of the cases where this is likely to occur. Thoughts? |
|
Looks like we on agreement and because it one of the last |
Fixes #15104