1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xslt/tests/mochitest/test_bug566629.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,70 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=566629 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 566629</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=566629">Mozilla Bug 566629</a> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"> 1.18 + 1.19 +</div> 1.20 +<pre id="test"> 1.21 +<script class="testbody" type="text/javascript"> 1.22 + 1.23 +/** Test for Bug 566629 **/ 1.24 + 1.25 +var xsltdoc = new DOMParser().parseFromString( 1.26 + '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\ 1.27 + xmlns:xhtml="http://www.w3.org/1999/xhtml">\ 1.28 + <xsl:template match="/">\ 1.29 + <xsl:value-of select="count(//body)"/>\ 1.30 + <xsl:text>,</xsl:text>\ 1.31 + <xsl:value-of select="count(//xhtml:body)"/>\ 1.32 + <xsl:text>,</xsl:text>\ 1.33 + <xsl:value-of select="count(//xsl:body)"/>\ 1.34 + <xsl:text>,</xsl:text>\ 1.35 + <xsl:value-of select="name(//body)"/>\ 1.36 + <xsl:text>,</xsl:text>\ 1.37 + <xsl:value-of select="local-name(//body)"/>\ 1.38 + </xsl:template>\ 1.39 + </xsl:stylesheet>', 1.40 + "text/xml"); 1.41 + 1.42 +var processor = new XSLTProcessor; 1.43 +processor.importStylesheet(xsltdoc); 1.44 +var result = processor.transformToFragment(document, document); 1.45 +ok(result instanceof DocumentFragment, "returned a docfragment"); 1.46 +is(result.firstChild.nodeValue, "1,1,0,BODY,body", 1.47 + "correct treatment of HTML elements in XSLT"); 1.48 + 1.49 +is(document.evaluate("count(//body)", document, null, XPathResult.ANY_TYPE, null).numberValue, 1.50 + 1, "namespace-less node-test"); 1.51 +is(document.evaluate("count(//a:body)", document, 1.52 + function() { return "http://www.w3.org/1999/xhtml" }, 1.53 + XPathResult.ANY_TYPE, null).numberValue, 1.54 + 1, "with-namespace node-test"); 1.55 +is(document.evaluate("count(//a:body)", document, 1.56 + function() { return "foo" }, 1.57 + XPathResult.ANY_TYPE, null).numberValue, 1.58 + 0, "wrong-namespace node-test"); 1.59 +is(document.evaluate("//bODy", document, null, XPathResult.ANY_TYPE, null).iterateNext(), 1.60 + document.body, "case insensitive matching"); 1.61 +is(document.evaluate("count(//a:bODy)", document, 1.62 + function() { return "http://www.w3.org/1999/xhtml" }, 1.63 + XPathResult.ANY_TYPE, null).numberValue, 1.64 + 0, "with-namespace but wrong casing node-test"); 1.65 +is(document.evaluate("name(//body)", document, null, XPathResult.ANY_TYPE, null).stringValue, 1.66 + "BODY", "uppercase name() function"); 1.67 +is(document.evaluate("local-name(//body)", document, null, XPathResult.ANY_TYPE, null).stringValue, 1.68 + "body", "lowercase local-name() function"); 1.69 + 1.70 +</script> 1.71 +</pre> 1.72 +</body> 1.73 +</html>