Skip to content

Correct description of insertion cloning behavior#438

Closed
jugglinmike wants to merge 1 commit into
jquery:masterfrom
jugglinmike:fix-clone
Closed

Correct description of insertion cloning behavior#438
jugglinmike wants to merge 1 commit into
jquery:masterfrom
jugglinmike:fix-clone

Conversation

@jugglinmike
Copy link
Copy Markdown
Contributor

When an element is to be inserted in multiple locations in the DOM, all
four of these manipulation methods behave in the same way: they insert a
clone for all but the last matched location.

From jQuery's implementation of the internal domManip method [1]:

Use the original fragment for the last item instead of the first
because it can end up being emptied incorrectly in certain situations
(#8070).

[1]
https://github.com/jquery/jquery/blob/988d99ad278c2c9dc16c68f86bddc4df99dcd928/src/manipulation.js#L506-L522

When an element is to be inserted in multiple locations in the DOM, all
four of these manipulation methods behave in the same way: they insert a
clone for all but the *last* matched location.

From jQuery's implementation of the internal `domManip` method [1]:

> Use the original fragment for the last item instead of the first
> because it can end up being emptied incorrectly in certain situations
> (#8070).

[1]
https://github.com/jquery/jquery/blob/988d99ad278c2c9dc16c68f86bddc4df99dcd928/src/manipulation.js#L506-L522
@kswedberg kswedberg closed this in 2152cf5 Feb 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant