mirror of
https://github.com/servo/servo
synced 2026-05-03 12:52:25 +02:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user