1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <p>This test checks whether XSLTProcessor.transformToFragment() does not crash
5 when the target document does not have a root node.
</p>
7 <div id=
"console"></div>
10 testRunner
.dumpAsText();
12 var xml
= (new DOMParser()).parseFromString('<doc/>', 'application/xml');
13 var xsl
= (new DOMParser()).parseFromString(
14 '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">' +
15 '<xsl:output method="xml" omit-xml-declaration="yes"/>' +
16 ' <xsl:template match="doc">SUCCESS</xsl:template>' +
20 var p
= new XSLTProcessor
;
21 p
.importStylesheet(xsl
);
22 var ownerDocument
= document
.implementation
.createDocument("", "", null);
23 var f
= p
.transformToFragment(xml
, ownerDocument
);
25 // Firefox throws an exception here, while WebKit doesn't:
26 // "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces."
27 ownerDocument
= document
.implementation
.createDocument("", null, null);
28 f
= p
.transformToFragment(xml
, ownerDocument
);
30 <p>PASS: You didn't crash.
</p>