Open akarelas opened 8 months ago
Isn't there an existing Mojo::DOM test that covers the case already?
I don't know, but in the JS lib, the bug only appears with entities matching &#x
(the x
is necessary).
Whereas Mojo::DOM's tests don't contain &#x anywhere.
The same issue (i.e. '
being escaped in JS) also appears with the replaceContent (vs Mojo::DOM's content method, which doesn't escape it):
import DOM from '@mojojs/dom';
let dom = new DOM('<div><p>Alex</p></div>');
dom.at('div').replaceContent(''hi');
console.log(dom.toString()); // prints: <div>&#x27;hi</div>
First
replace
invocation doesn't escape < or >, whereas second snippet escapes &. This behavior is inconsistent with Mojo::DOM, as can be shown by the following piece of code: