diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html')
-rw-r--r-- | testing/web-platform/tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html b/testing/web-platform/tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html new file mode 100644 index 0000000000..ccb43341bc --- /dev/null +++ b/testing/web-platform/tests/html/syntax/parsing/template/additions-to-the-in-head-insertion-mode/template-end-tag-without-start-one.html @@ -0,0 +1,101 @@ +<!DOCTYPE html> +<html> +<head> +<title>HTML Templates: Template end tag without start one. Element should be ignored</title> +<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> +<meta name="author" title="Aleksei Yu. Semenov" href="a.semenov@unipro.ru"> +<meta name="assert" content="If parser in 'in head' insertion mode meets template end tag and if the stack of open elements has no template element in html scope, then this is a parse error; ignore the token"> +<link rel="help" href="http://www.w3.org/TR/2013/WD-html-templates-20130214/#in-head-addition"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/resources/common.js"></script> +</head> +<body> +<div id="log"></div> +<script type="text/javascript"> + + +test(function () { + var doc = newHTMLDocument(); + + doc.head.innerHTML = '</template>'; + + assert_equals(doc.head.childNodes.length, 0, 'Element must be ignored'); + +}, '</template> tag in HTML head without start one should be ignored'); + + + +test(function () { + var doc = newHTMLDocument(); + + doc.head.innerHTML = '<template id="tmpl"></template></template>'; + + assert_equals(doc.head.childNodes.length, 1, 'Element must be ignored'); + assert_not_equals(doc.querySelector('#tmpl'), null, + 'Element should present it document head'); + +}, '</template> tag in HTML head without start one should be ignored. ' + + 'Test valid <template> element and </template> tag after it'); + + + +test(function () { + var doc = newHTMLDocument(); + + doc.head.innerHTML = '</template><template id="tmpl"></template>'; + + assert_equals(doc.head.childNodes.length, 1, 'Element must be ignored'); + assert_not_equals(doc.querySelector('#tmpl'), null, + 'Element should present it document head'); + +}, '</template> tag in HTML head without start one should be ignored. ' + + 'Test valid <template> element and </template> tag before it'); + + + +test(function () { + var doc = newHTMLDocument(); + + doc.head.innerHTML = '</template><template id="tmpl"></template><title></title>'; + + assert_equals(doc.head.childNodes.length, 2, 'Element must be ignored'); + assert_not_equals(doc.querySelector('#tmpl'), null, + 'Valid element should present it document head'); + assert_not_equals(doc.querySelector('title'), null, + 'Valid title element should present it document head'); + +}, '</template> tag in HTML head without start one should be ignored. ' + + 'Test valid <template> element, <title> element and </template> tag before them'); + + + +test(function () { + var doc = newHTMLDocument(); + + doc.head.innerHTML = '<template id="tmpl"></template><title></title></template>'; + + assert_equals(doc.head.childNodes.length, 2, 'Element must be ignored'); + assert_not_equals(doc.querySelector('#tmpl'), null, + 'Valid element should present it document head'); + assert_not_equals(doc.querySelector('title'), null, + 'Valid title element should present it document head'); + +}, '</template> tag in HTML head without start one should be ignored. ' + + 'Test valid <template> element, <title> element and </template> tag after them'); + + +testInIFrame('/html/semantics/scripting-1/the-template-element/resources/end-template-tag-in-head.html', function(context) { + var doc = context.iframes[0].contentDocument; + + assert_equals(doc.head.querySelector('template'), null, '</template> must be ignored'); + assert_not_equals(doc.head.querySelector('title'), null, + 'Valid element should present it document head'); + +}, '</template> tag in HTML head without start one should be ignored. ' + + 'Test HTML document loaded from file'); + + +</script> +</body> +</html> |