Ticket #4074 (closed bug: fixed)
.clone() doesn't respect ownerDocument
|Reported by:||friedcell||Owned by:||john|
If you clone an element from a foreign document (not the one you're executing code in), the cloned node will not have the same ownerDocument as the original element. It will instead be owned by the document where the execution happens.
elem.ownerDocument === document > false var clone = $(elem).clone(); clone.ownerDocument === elem.ownerDocument > false (should be true) clone.ownerDocument === document > true (should be false)
There is a simple fix to this - the code in clone() shouldn't use document.createElement but this.ownerDocument and the call to clear should use this for context (currently uses nothing).
- Status changed from closed to reopened
- Resolution fixed deleted
- Owner changed from flesler to john
- Status changed from reopened to new