forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloading-import.html
45 lines (41 loc) · 1.57 KB
/
loading-import.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>.
<html>
<head>
<title>HTML Imports</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Hajime Morrita" href="mailto:morrita@google.com">
<link rel="help" href="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/imports/index.html#loading-imports">
<link id="linkImport1" rel="import" href="resources/hello.html">
<link id="linkImport2" rel="import" href="resources/hello.html">
<link id="linkToTypicalHtml" rel="import" href="resources/typical.html">
<link id="linkIncludingSubImport" rel="import" href="resources/sub-parent.html">
</head>
<body>
<div id="log">Running test...</div>
<script>
test(function() {
var linkImport1 = document.getElementById("linkImport1");
var linkImport2 = document.getElementById("linkImport2");
assert_equals(linkImport1.import, linkImport2.import);
assert_true(linkImport1.import != null);
},
"Check on sharing imports. Imports in same location should be represented as same object."
);
test(function() {
var link = document.getElementById("linkToTypicalHtml");
assert_equals(link.import.querySelector("p2").parentNode,
link.import.querySelector("parent"));
},
"Check on HTML Parsing. An HTML parser should be used to parse the import."
);
test(function() {
var parent = document.getElementById("linkIncludingSubImport");
var child = parent.import.querySelector("link").imports;
assert_equals(child.title, "Hello");
},
"Check on sub-imports. Sub-improts should be loaded as usual imports."
);
</script>
</body>
</html>