-
Notifications
You must be signed in to change notification settings - Fork 20.5k
2.0: Refactor jQuery.clean #1117
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
|
In migrate plugin, jQuery.clean = function( elems, context, fragment, scripts, selection ) {
var newFragment = jQuery.buildFragment( elems, context || document, scripts, selection );
if ( fragment ) {
fragment.appendChild( newFragment );
} else {
fragment = newFragment;
}
return jQuery.merge( [], fragment.childNodes );
};But i did not test this code thoroughly |
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.
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.
done, it saves 15 bytes or so and it definitely looks more elegant.
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.
Could you use also core_push here? Or maybe push instead of core_push in L446?
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.
good catch!
(cherry picked from commit 8e6c1ba)
(cherry picked from commit 8e6c1ba)
Now, when manipulation module was reduced, maybe it's time to refactor some stuff?
You removed
jQuery.buildFragment, but it seemsjQuery.cleanis one that should be removed. If this changes is acceptable i could ported it to 1.9 too.