makes jQuery work without public buildFragment and overwritable domManip #2177

Merged
merged 29 commits into from Jan 21, 2016

Conversation

Projects
None yet
4 participants
@justinbmeyer
Contributor

justinbmeyer commented Jan 9, 2016

Closes #2176

This makes jQuery 1.12 and 2.2 work.

@justinbmeyer justinbmeyer added this to the 2.3.9 milestone Jan 9, 2016

@daffl daffl modified the milestones: 2.3.10, 2.3.9 Jan 11, 2016

@mjstahl

This comment has been minimized.

Show comment
Hide comment
@mjstahl

mjstahl Jan 13, 2016

Member

fixed merge conflicts.

Member

mjstahl commented Jan 13, 2016

fixed merge conflicts.

@rjgotten

This comment has been minimized.

Show comment
Hide comment
@rjgotten

rjgotten Jan 13, 2016

@justinbmeyer

Why not keep your old buildFragment logic and feature-detect the existence of the jQuery.parseHTML( data [, context ] [, keepScripts ] ) method, which is part of the stable public API?

The parseHTML method does everything $.buildFragment did, but it flushes the contents of the document fragment that it internally uses with $.buildFragment into a plain array of DOM nodes and returns that to the caller. (Note: DOM nodes; not elements, so it still contains text nodes, comment nodes, etc. as well.)

Since you were cloning the cached fragment into a fresh fragment anyway, all you need to do with that array of nodes handed to you by $.parseHTML, is to pour it into a new empty document fragment of your own creation.

@justinbmeyer

Why not keep your old buildFragment logic and feature-detect the existence of the jQuery.parseHTML( data [, context ] [, keepScripts ] ) method, which is part of the stable public API?

The parseHTML method does everything $.buildFragment did, but it flushes the contents of the document fragment that it internally uses with $.buildFragment into a plain array of DOM nodes and returns that to the caller. (Note: DOM nodes; not elements, so it still contains text nodes, comment nodes, etc. as well.)

Since you were cloning the cached fragment into a fresh fragment anyway, all you need to do with that array of nodes handed to you by $.parseHTML, is to pour it into a new empty document fragment of your own creation.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Jan 13, 2016

Contributor

@rjgotten I thought about that, but knew I had the buildFragment that worked everywhere else. Also, I wanted to avoid another "convert to a fragment" step. Meaning, that yes, we were creating a fresh fragment (via DOM clone method), but my thought that .clone() would be much faster than having parseHTML break the DOM into an array, and then us re-assemble it into another fragment. clone() presumably doesn't have to keep updating .nextSibling references.

We can maybe check if the performance is about the same.

Contributor

justinbmeyer commented Jan 13, 2016

@rjgotten I thought about that, but knew I had the buildFragment that worked everywhere else. Also, I wanted to avoid another "convert to a fragment" step. Meaning, that yes, we were creating a fresh fragment (via DOM clone method), but my thought that .clone() would be much faster than having parseHTML break the DOM into an array, and then us re-assemble it into another fragment. clone() presumably doesn't have to keep updating .nextSibling references.

We can maybe check if the performance is about the same.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Jan 14, 2016

Contributor

@mjstahl what did you change when you fixed the merge conflicts? It seems things are breaking now. Is there a merge commit?

Also, I noticed the view/stache/test/system/test.html file looks different than the standard test.html file. Where did you get that structure from? steal-qunit should be imported, not loaded via script tags.

Contributor

justinbmeyer commented Jan 14, 2016

@mjstahl what did you change when you fixed the merge conflicts? It seems things are breaking now. Is there a merge commit?

Also, I noticed the view/stache/test/system/test.html file looks different than the standard test.html file. Where did you get that structure from? steal-qunit should be imported, not loaded via script tags.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Jan 14, 2016

Contributor

@mjstahl this is what I see when I open that page.

localhost_8080_canjs_view_stache_test_system_test_html

Contributor

justinbmeyer commented Jan 14, 2016

@mjstahl this is what I see when I open that page.

localhost_8080_canjs_view_stache_test_system_test_html

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Jan 14, 2016

Contributor

Ah, it seems that wasn't intended to be opened as a standalone test page. I'm going to rename it.

Contributor

justinbmeyer commented Jan 14, 2016

Ah, it seems that wasn't intended to be opened as a standalone test page. I'm going to rename it.

@mjstahl

This comment has been minimized.

Show comment
Hide comment
@mjstahl

mjstahl Jan 14, 2016

Member

@justinbmeyer AllI did was resolve the merge conflicts with package.json and bower.json

Member

mjstahl commented Jan 14, 2016

@justinbmeyer AllI did was resolve the merge conflicts with package.json and bower.json

@daffl daffl added this to the 2.3.11 milestone Jan 15, 2016

@daffl daffl removed this from the 2.3.10 milestone Jan 15, 2016

daffl added a commit that referenced this pull request Jan 21, 2016

Merge pull request #2177 from canjs/2176-jquery-22
makes jQuery work without public buildFragment and overwritable domManip

@daffl daffl merged commit c41c229 into master Jan 21, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@daffl daffl deleted the 2176-jquery-22 branch Jan 21, 2016

@mihalycz mihalycz referenced this pull request in stealjs/steal Jan 25, 2016

Closed

steal .stache dependency load #552

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment