Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / imported / web-platform-tests / html-imports / html-link-element / import-attribute.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>The import attribute</title>
5 <link rel="help" href="http://w3c.github.io/webcomponents/spec/imports/#interface-import">
6 <script src="../../../../resources/testharness.js"></script>
7 <script src="../../../../resources/testharnessreport.js"></script>
8 <link rel="stylesheet" href="../../../../resources/testharness.css">
9
10 <link id="nonImportLink" rel="stylesheet" href="resources/hello.css">
11 <link id="goOutFromDocument" rel="import" href="resources/body-only-0.html">
12 <link id="importLink"        rel="import" href="resources/body-only-1.html">
13 <link id="anotherImportLink" rel="import" href="resources/body-only-2.html">
14
15 </head>
16 <body>
17 <div id="log"></div>
18 <script>
19 test(function() {
20    assert_equals(nonImportLink.import, null);
21 }, 'The import attribute must return null if the link does not represent an import.');
22
23 test(function() {
24    var link = goOutFromDocument;
25    assert_true(link.import != null);
26    document.head.removeChild(link);
27    assert_equals(link.import, null);
28 }, 'The import attribute must return null if the link element is not in a Document.');
29
30 test(function() {
31    assert_equals(importLink.import.body.id, 'body-only-1');
32 }, 'The attribute must return the imported document for the import.');
33
34 test(function() {
35    var importA = importLink.import;
36    var importB = document.querySelector('#importLink').import;
37    var anotherImport = document.querySelector('#anotherImportLink').import;
38    assert_true(importA === importB);
39    assert_true(importA !== anotherImport);
40 }, 'The same object must be returned each time.');
41 </script>
42 </body>
43 </html>
44