WebReflection / linkedom

A triple-linked lists based DOM implementation.
https://webreflection.medium.com/linkedom-a-jsdom-alternative-53dd8f699311
ISC License
1.66k stars 80 forks source link

[BUG] `innerHTML` on elements parsed from XMLDocument doesn't escape characters as XML entities inside attribute values #260

Closed omril1 closed 6 months ago

omril1 commented 7 months ago

Repro:

var linkedom = require('linkedom')
var parser = new linkedom.DOMParser()
var doc = parser.parseFromString(`<hierarchy><android.view.View content-desc="text3&amp;more"/></hierarchy>`, 'text/xml')
console.log(doc.documentElement.innerHTML) // '<android.view.View content-desc="text3&more" />'

Using the same code on a DOMParser from a browser or JSDOM gives <android.view.View content-desc="text3&amp;more"/>

WebReflection commented 6 months ago

It's in: https://github.com/WebReflection/linkedom/pull/261