blob: e65c0d728febd3589a468947d648d83b3722e2dd (
plain)
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
|
<!DOCTYPE html>
<html>
<head parseparts>
<title>{{#}}{{/}}DOM Parts: parseparts on head</title>
<meta name="author" href="mailto:masonf@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./resources/domparts-utils.js"></script>
<!-- no explicit body element-->
<div>{{#}}Parts{{/}}</div>
<script>
test(() => {
const target = document.currentScript.previousElementSibling;
assert_true(document.head.hasAttribute('parseparts'));
assert_false(document.body.hasAttribute('parseparts'));
assert_equals(target.previousSibling,null,'The div is the first thing in body, everything else in head');
const root = document.getPartRoot();
assert_equals(root.getParts().length,0,'No parts should be recognized');
assert_equals(target.innerHTML,'{{#}}Parts{{/}}');
const titleElement = document.head.querySelector('title');
assert_true(titleElement instanceof HTMLTitleElement);
assert_equals(titleElement.innerHTML,'{{#}}{{/}}DOM Parts: parseparts on head');
target.remove();
}, 'It is not possible to put parseparts on the head element');
</script>
|