const { parse } = require('@test/test-target'); describe('issue 218', function () { it('attribute value contains quote should be parsed correct', function () { const html = `
nochange
expected
actual
`; const root = parse(html); root.toString().should.eql(`
nochange
expected
actual
`); root.querySelector('#e').setAttribute('onClick', "alert('hello')"); root.toString().should.eql(`
nochange
expected
actual
`); // root.querySelector('#a').setAttribute('title', '"replaced"'); root.querySelector('#a').removeAttribute('color'); // FIXME root.toString().should.eql(`
nochange
expected
actual
`); root.querySelector('#a').setAttribute('title', '"replaced"'); root.toString().should.eql(`
nochange
expected
actual
`); }); it('should escape newlines to html entities', function () { const root = parse('

'); const p = root.firstChild; p.setAttribute('a', '1\n2'); p.getAttribute('a').should.eql('1\n2'); p.toString().should.eql('

'); }); });