Closed milahu closed 1 year ago
similar problem:
newlines in attribute values are escaped as \n
but should be
failing test
diff --git a/test/tests/html.js b/test/tests/html.js
index 3bcf636..8d85725 100644
--- a/test/tests/html.js
+++ b/test/tests/html.js
@@ -391,6 +391,13 @@ describe('HTML Parser', function () {
p.getAttribute('c').should.eql('undefined');
p.toString().should.eql('<p a="12" b="null" c="undefined"></p>');
});
+ it('should escape newlines to html entities', function () {
+ const root = parseHTML('<p></p>');
+ const p = root.firstChild;
+ p.setAttribute('a', '1\n2');
+ p.getAttribute('a').should.eql('1\n2');
+ p.toString().should.eql('<p a="1 2"></p>');
+ });
it('should throw type Error', function () {
const root = parseHTML('<p a=12 b=13 c=14></p>');
const p = root.firstChild;
this happens when using setAttributes
also
result
title="\"world\""
is invalid htmlshould be either
title='"world"'
(pretty, minimal diff) ortitle=""world""
(ugly, invasive)