Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 6734bf5

Browse files
committed
native imports testing
1 parent 188c616 commit 6734bf5

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

sorvell/importz/import1.html

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
<link rel="import" href="more/import1_1.html">
44
<script src="script.js" info="bottom"></script>
55
<x-spy info="end">I'm in import1!</x-spy>
6+
7+
<template>
8+
<link rel="stylesheet" href="css.css">
9+
</template>

sorvell/importz/index.html

+22-16
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,37 @@
99
console.log(this.localName, doc, this.getAttribute('info'));
1010
}
1111
document.register('x-spy', {prototype: proto});
12+
13+
14+
document.addEventListener('DOMContentLoaded', function() {
15+
var i = document.querySelector('[rel=import]').import;
16+
var i1 = i.querySelector('[rel=import]').import;
17+
console.log(i, i1);
18+
// img path is correct in import but
19+
// incorrect if cloned and inserted into main document.
20+
var img = i1.querySelector('img').cloneNode(true);;
21+
img.src = img.src;
22+
//var src = img.src;
23+
document.body.appendChild(img);
24+
//console.log(img.src);
25+
26+
// if template is cloned and content is inserted into main
27+
// document, paths are wrong.
28+
var template = i1.querySelector('template');
29+
document.body.appendChild(template.content.cloneNode(true));
30+
});
1231
</script>
1332
<link rel="import" href="import1.html">
1433
<link rel="import" href="import2.html">
1534
</head>
1635
<body>
36+
<template>
37+
<link rel="stylesheet" href="css.css">
38+
</template>
1739
<x-spy info="main-top"></x-spy>
1840
<script>
1941
console.log('script in main');
2042
</script>
2143
<x-spy info="main-bottom"></x-spy>
22-
<script>
23-
var i = document.querySelector('[rel=import]').import;
24-
var i1 = i.querySelector('[rel=import]').import;
25-
// img path is correct in import but
26-
// incorrect if cloned and inserted into main document.
27-
var img = i1.querySelector('img').cloneNode(true);;
28-
img.src = img.src;
29-
//var src = img.src;
30-
document.body.appendChild(img);
31-
//console.log(img.src);
32-
33-
// if template is cloned and content is inserted into main
34-
// document, paths are wrong.
35-
var template = i1.querySelector('template');
36-
document.body.appendChild(template.content.cloneNode(true));
37-
</script>
3844
</body>
3945
</html>

0 commit comments

Comments
 (0)