Skip to content

fix(jruby): XML::DocumentFragment.dup to another document#3372

Merged
flavorjones merged 1 commit intomainfrom
flavorjones-jruby-fragment-dup
Dec 12, 2024
Merged

fix(jruby): XML::DocumentFragment.dup to another document#3372
flavorjones merged 1 commit intomainfrom
flavorjones-jruby-fragment-dup

Conversation

@flavorjones
Copy link
Copy Markdown
Member

What problem is this PR intended to solve?

Back in b92660e (#1834 fixing #1063) I omitted support in JRuby for the "new_parent_document" argument to Node#dup because there was no performance reason to implement it. So the test was skipped.

However, in 1e7d38a and other commits in #3117 (fixing #316), I introduced a call to initialize_copy_with_args that passes the new parent document as an argument on both CRuby and JRuby implementations. Because the test was skipped, I didn't catch that this broke on JRuby.

In particular this was a problem for Loofah which relies on decorators, and even more particularly this broke the Loofah::TextBehavior formatting concern for Loofah::*::DocumentFragment objects.

Have you included adequate test coverage?

The skipped test is no longer skipped!

Maybe we should be running downstream tests with JRuby, too? But that feels like a big investment right now so I'll avoid scarring on the first cut, and wait to see if it happens again.

Does this change affect the behavior of either the C or the Java implementations?

Brings the Java impl into agreement with the C impl.

Back in b92660e (#1834 fixing #1063) I omitted support in JRuby for
the "new_parent_document" argument to `Node#dup` because there was no
performance reason to implement it. So the test was skipped.

However, in 1e7d38a and other commits in #3117 (fixing #316), I
introduced a call to `initialize_copy_with_args` that passes the new
parent document as an argument on both CRuby and JRuby
implementations. Because the test was skipped, I didn't catch that
this broke on JRuby.

In particular this was a problem for Loofah which relies on
decorators, and even more particularly this broke the
`Loofah::TextBehavior` formatting concern for
`Loofah::*::DocumentFragment` objects.

Maybe we should be running downstream tests with JRuby, too? But that
feels like a big investment right now so I'll avoid scarring on the
first cut, and wait to see if it happens again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant