Skip to content

Commit

Permalink
Looks like newer browser DOMParser implemmentations parse differently
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbrand committed Nov 15, 2023
1 parent b2211eb commit af1b77e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,11 @@ test('XML serializing', function (assert) {
const element9 = parser.parseFromString('<foo><![CDATA[<foo>]]></foo>', 'text/xml').documentElement;
assert.equal(Strophe.serialize(element9), '<foo><![CDATA[<foo>]]></foo>', 'should be serialized');
const element10 = parser.parseFromString('<foo><![CDATA[]]]]><![CDATA[>]]></foo>', 'text/xml').documentElement;
assert.equal(Strophe.serialize(element10), '<foo><![CDATA[]]]]><![CDATA[>]]></foo>', 'should be serialized');
if (globalThis.DOMParser) {
assert.equal(Strophe.serialize(element10), '<foo><![CDATA[]]>]]></foo>', 'should be serialized');
} else {
assert.equal(Strophe.serialize(element10), '<foo><![CDATA[]]]]><![CDATA[>]]></foo>', 'should be serialized');
}
const element11 = parser.parseFromString('<foo>&lt;foo&gt;<![CDATA[<foo>]]></foo>', 'text/xml').documentElement;
assert.equal(Strophe.serialize(element11), '<foo>&lt;foo&gt;<![CDATA[<foo>]]></foo>', 'should be serialized');
});
Expand Down

0 comments on commit af1b77e

Please sign in to comment.