Closed nyanrus closed 2 months ago
@WebReflection If I understand this correctly, the escape
function in toString
doesn't escape quotes, so the replace should be called for XML documents as well.
Should change to:
toString() {
const {name, [VALUE]: value} = this;
if (emptyAttributes.has(name) && !value) {
return ignoreCase(this) ? name : `${name}=""`;
}
- const escapedValue = ignoreCase(this) ? value.replace(QUOTE, '"') : escape(value);
+ const escapedValue = (ignoreCase(this) ? value : escape(value)).replace(QUOTE, '"');
return `${name}="${escapedValue}"`;
}
I don't know ... that change is recent and it was to avoid escaping other chars such as &
but not single quote or others ... the double quote escape is actually due common double quotes used around attributes but I feel like there's no right answer here ... or better, I would like to read an exhaustive example and and a test with expectations and never change this again, thanks!
it is double quote issue.
Can close
Thank you for good project! (2)
the
"
changed to"
, and it occurs error in xml.node v20.11.1 linkedom v0.16.10