Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(jqLite): clone wrapNode in jqlite/wrap #4194

Closed
wants to merge 1 commit into from

Conversation

cqr
Copy link
Contributor

@cqr cqr commented Sep 29, 2013

Change jqLite's implementation of wrap() to clone the wrapNode before
wrapping the target element in it.

Match jQuery's wrap() behavior and prevent accidentally attaching
target element to the DOM as a side effect.

Closes #3860

@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@cqr
Copy link
Contributor Author

cqr commented Sep 29, 2013

I just signed, my real name is Chris Rhoden

@cqr
Copy link
Contributor Author

cqr commented Sep 30, 2013

I wrote tests and ran them, and they passed locally. It looks like the travis failure here is the result of a problem with an external service. Is there a way for me to re-run this?

@btford
Copy link
Contributor

btford commented Sep 30, 2013

Travis is unreliable right now, so don't worry too much about it.

@rodyhaddad
Copy link
Contributor

+1

@mgol
Copy link
Member

mgol commented Aug 1, 2014

@chrisrhoden Can you rebase it against master? I'll get to it within a few days.

@mgol mgol modified the milestones: Backlog, 1.3.0-beta.18 Aug 1, 2014
@mgol
Copy link
Member

mgol commented Aug 1, 2014

(changed the milestone to the next 1.3.0 beta)

@mgol mgol self-assigned this Aug 1, 2014
Change jqLite's implementation of wrap() to clone the wrapNode before
wrapping the target element in it.
Match jQuery's wrap() behavior and prevent accidentally attaching
target element to the DOM as a side effect.

Closes angular#3860
@caitp
Copy link
Contributor

caitp commented Aug 8, 2014

@mzgol do we need this for jQuery 2.x support?

Please answer quickly otherwise this will be pushed back to the next milestone

@caitp caitp modified the milestones: 1.3.0-beta.18, 1.3.0-beta.19 Aug 8, 2014
@cqr
Copy link
Contributor Author

cqr commented Aug 8, 2014

@caitp No, this behavior hasn't changed between jQuery 1.x and 2.x, so to the extent that jqLite is currently broken as a replacement for 1.x, it will be no more broken as a replacement for 2.x (at least as it applies to this patch).

it('should clone elements to be wrapped around target', function () {
var root = jqLite('<div class="sigil"></div>');
var span = jqLite('<span>A</span>');
jqLite(document.body).append(root);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Couldn't you use any other wrapper for root that is not actually in the DOM?

@IgorMinar IgorMinar closed this in 77d3e75 Aug 19, 2014
@IgorMinar
Copy link
Contributor

thanks for the PR!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

element.wrap not working when jQuery is present
7 participants