mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
parent
f7bfea5879
commit
4c5bebeb10
3 changed files with 97 additions and 4 deletions
48
tests/content/test_node_lookupPrefix.html
Normal file
48
tests/content/test_node_lookupPrefix.html
Normal file
|
@ -0,0 +1,48 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<x xarg="xval">
|
||||
<!--comment-->
|
||||
<?test test?>
|
||||
TEST
|
||||
<x/>
|
||||
</x>
|
||||
<script>
|
||||
document.documentElement.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:x", "test");
|
||||
document.body.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:s", "test");
|
||||
var x = document.getElementsByTagName("x")[0];
|
||||
x.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:t", "test");
|
||||
var yprefix = document.createElementNS("ynamespace", "yprefix:ylocalname");
|
||||
var ynoprefix = document.createElementNS("ynamespace", "ylocalname");
|
||||
ynoprefix.setAttribute("ynoprefixattr", "yval");
|
||||
ynoprefix.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:yattr", "yval");
|
||||
|
||||
// Step 1
|
||||
is(document.lookupPrefix(""), null);
|
||||
is(document.lookupPrefix(null), null);
|
||||
|
||||
// Element step 1
|
||||
is(yprefix.lookupPrefix("ynamespace"), "yprefix");
|
||||
is(ynoprefix.lookupPrefix("ynamespace"), null);
|
||||
|
||||
// Element step 2
|
||||
is(x.lookupPrefix("test"), "t");
|
||||
is(ynoprefix.lookupPrefix("yval"), "yattr");
|
||||
|
||||
// analogous to wpt - https://github.com/w3c/web-platform-tests/blob/master/dom/nodes/Node-lookupPrefix.xhtml
|
||||
is(document.lookupPrefix("test"), "x");
|
||||
is(x.lookupPrefix("test"), "t");
|
||||
is(x.lookupPrefix("http://www.w3.org/1999/xhtml"), null);
|
||||
is(x.lookupPrefix("something"), null);
|
||||
is(x.lookupPrefix(null), null);
|
||||
is(x.parentNode.lookupPrefix("test"), "s");
|
||||
is(x.firstChild.lookupPrefix("test"), "t");
|
||||
is(x.childNodes[1].lookupPrefix("test"), "t");
|
||||
is(x.childNodes[2].lookupPrefix("test"), "t");
|
||||
is(x.lastChild.lookupPrefix("test"), "t");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue