dom-parts-parseparts-on-head.tentative.html (1169B)
1 <!DOCTYPE html> 2 <html> 3 <head parseparts> 4 <title>{{#}}{{/}}DOM Parts: parseparts on head</title> 5 6 <link rel=author href="mailto:masonf@chromium.org"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="./resources/domparts-utils.js"></script> 10 11 <!-- no explicit body element--> 12 <div>{{#}}Parts{{/}}</div> 13 14 <script> 15 test(() => { 16 const target = document.currentScript.previousElementSibling; 17 assert_true(document.head.hasAttribute('parseparts')); 18 assert_false(document.body.hasAttribute('parseparts')); 19 assert_equals(target.previousSibling,null,'The div is the first thing in body, everything else in head'); 20 const root = document.getPartRoot(); 21 assert_equals(root.getParts().length,0,'No parts should be recognized'); 22 assert_equals(target.innerHTML,'{{#}}Parts{{/}}'); 23 const titleElement = document.head.querySelector('title'); 24 assert_true(titleElement instanceof HTMLTitleElement); 25 assert_equals(titleElement.innerHTML,'{{#}}{{/}}DOM Parts: parseparts on head'); 26 target.remove(); 27 }, 'It is not possible to put parseparts on the head element'); 28 </script>