Skip to content

Commit d77d6fc

Browse files
giacomo-petriWilcoFiersJym77
authored
HTML page has non-empty title [2779a5]: Shadow root example - Included as failed example 6 (#2180)
* Shadow root example included as failed example 6 * Update _rules/html-page-non-empty-title-2779a5.md Co-authored-by: Wilco Fiers <[email protected]> --------- Co-authored-by: Wilco Fiers <[email protected]> Co-authored-by: Jean-Yves Moyen <[email protected]>
1 parent 70e6e12 commit d77d6fc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

_rules/html-page-non-empty-title-2779a5.md

+21
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,27 @@ This page has a `title` element that only contains a separator character.
202202
</html>
203203
```
204204

205+
#### Failed Example 6
206+
207+
This page does not have a title because the shadow root is not a [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) of the [document element](https://dom.spec.whatwg.org/#document-element).
208+
209+
```html
210+
<html>
211+
<body>
212+
<template id="shadow-element">
213+
<title>This is the page title</title>
214+
</template>
215+
<script>
216+
const host = document.querySelector("body");
217+
const shadow = host.attachShadow({ mode: "open" });
218+
const template = document.getElementById("shadow-element");
219+
220+
shadow.appendChild(template.content);
221+
</script>
222+
</body>
223+
</html>
224+
```
225+
205226
### Inapplicable
206227

207228
#### Inapplicable Example 1

0 commit comments

Comments
 (0)