mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<title>DOMParser basic test of HTML parsing</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// |expected| should be an object indicating the expected type of node.
|
||||
function assert_node(actual, expected) {
|
||||
assert_true(actual instanceof expected.type,
|
||||
'Node type mismatch: actual = ' + actual.nodeType + ', expected = ' + expected.nodeType);
|
||||
if (typeof(expected.id) !== 'undefined')
|
||||
assert_equals(actual.id, expected.id, expected.idMessage);
|
||||
if (typeof(expected.nodeValue) !== 'undefined')
|
||||
assert_equals(actual.nodeValue, expected.nodeValue, expected.nodeValueMessage);
|
||||
}
|
||||
|
||||
var doc;
|
||||
setup(function() {
|
||||
var parser = new DOMParser();
|
||||
var input = '<html id="root"><head></head><body></body></html>';
|
||||
doc = parser.parseFromString(input, 'text/html');
|
||||
});
|
||||
|
||||
test(function() {
|
||||
var root = doc.documentElement;
|
||||
assert_node(root, { type: HTMLHtmlElement, id: 'root',
|
||||
idMessage: 'documentElement id attribute should be root.' });
|
||||
}, 'Parsing of id attribute');
|
||||
|
||||
test(function() {
|
||||
assert_equals(document.documentURI, doc.documentURI,
|
||||
'The document must have a URL value equal to the URL of the active document.');
|
||||
}, 'URL value');
|
||||
|
||||
test(function() {
|
||||
assert_equals(doc.location, null,
|
||||
'The document must have a location value of null.');
|
||||
}, 'Location value');
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue