[bug] Document Fragment #clone
does not behave like #dup
with respect to the owning document
#2908
Milestone
#clone
does not behave like #dup
with respect to the owning document
#2908
Please describe the bug
While working on upgrading Action Text to HTML5, some tests were failing that I traced back to this repro:
fails with
Specifically:
HTML4::DocumentFragment#clone
re-uses the original'sDocument
HTML5::DocumentFragment#clone
does not set adocument
at all!Expected behavior
The desired behavior matches
#dup
for node and node-like things: to make a copy of the parent document to avoid accumulating nodes that cannot be freed until the parent document is freed (see #1063 and #1834).Please also note, while we're in here, that there are expected differences between
#dup
and#clone
that we're also not honoring, see #316 for a description of those problems (essentially, the singleton class). If we tackle this issue, we should tackle that one as well.The text was updated successfully, but these errors were encountered: