|
Lines 1-29
a/LayoutTests/fast/dom/HTMLTemplateElement/inertContents.html_sec1
|
|
|
1 |
<!DOCTYPE html> |
| 1 |
<body> |
2 |
<body> |
| 2 |
<p>The test asserts that elements within template contents are "inert", e.g. resources do not fetch, script does not run.</p> |
3 |
<script src="../../js/resources/js-test-pre.js"></script> |
| 3 |
<template id="template"><script>window.testVal = "script did run";</script><img src="http://foo.com/shouldNotLoad.jpg"></template> |
|
|
| 4 |
<div id="output"> |
| 5 |
</div> |
| 6 |
|
| 7 |
<script> |
4 |
<script> |
| 8 |
var testVal = "script did not run"; |
5 |
var testVal = 'script has not run'; |
| 9 |
|
|
|
| 10 |
window.onload = function() { |
| 11 |
if (window.testRunner) { |
| 12 |
testRunner.dumpAsText(); |
| 13 |
testRunner.dumpResourceLoadCallbacks(); |
| 14 |
} |
| 15 |
|
| 16 |
var output = document.getElementById('output'); |
| 17 |
output.innerHTML = 'Before template content insertion: ' + testVal; |
| 18 |
|
| 19 |
var templateContent = document.getElementById('template').content; |
| 20 |
var img = templateContent.childNodes[1]; |
| 21 |
img.src = "http://foo.com/shouldLoad.jpg"; |
| 22 |
document.body.appendChild(templateContent); |
| 23 |
|
| 24 |
output.innerHTML += ', after template content insertion: ' + testVal + '.'; |
| 25 |
} |
| 26 |
</script> |
6 |
</script> |
| 27 |
</head> |
7 |
<!-- FIXME: Add non-flaky test for <img> tags --> |
| 28 |
<body> |
8 |
<template><script>window.testVal = 'script has run';</script></template> |
|
|
9 |
<script> |
| 10 |
description('The test asserts that elements within template contents are "inert", e.g. script does not run.'); |
| 11 |
shouldBeEqualToString('testVal', 'script has not run'); |
| 12 |
var templateContent = document.querySelector('template').content; |
| 13 |
document.body.appendChild(templateContent); |
| 14 |
shouldBeEqualToString('testVal', 'script has run'); |
| 15 |
</script> |
| 16 |
<script src="../../js/resources/js-test-post.js"></script> |
| 29 |
</body> |
17 |
</body> |