dir-shadow-42.html (1510B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"/> 5 <title>[dir] and shadow slots: dir=ltr on a div in the shadow tree, dir=rtl on the shadow host, no slotted text in the light or dark trees</title> 6 <link rel="author" title="Eric Meyer" href="mailto:emeyer@igalia.com"> 7 <link rel="author" title="L. David Baron" href="mailto:dbaron@chromium.org"> 8 <link rel="help" href="https://html.spec.whatwg.org/multipage/C#the-dir-attribute"> 9 <link rel="help" href="https://github.com/whatwg/html/issues/3699"> 10 <link rel="help" href="https://github.com/whatwg/html/pull/9796"> 11 <link rel="match" href="dir-shadow-42-ref.html"> 12 <style type="text/css"> 13 body {width: 600px;} 14 #host {border: 1px solid gray; margin: 1em; padding: 0.25em;} 15 span {border: 1px solid silver;} 16 17 </style> 18 <script src="dir-shadow-utils.js"></script> 19 </head> 20 <body> 21 22 <p>`dir=ltr` on a div in the shadow tree, `dir=rtl` on the shadow host, no slotted text in the light or dark trees</p> 23 <div id="host" dir="rtl"><span slot="x1"></span></div> 24 <p id="result">The HTML direction / computed CSS `direction` value is: </p> 25 26 <script type="text/javascript"> 27 let root = host.attachShadow({mode:"open"}); 28 root.innerHTML = `<div dir="ltr"><slot dir="auto" name="x1"></slot></div>`; 29 result.innerHTML += html_direction(root.querySelector("div[dir=ltr]").firstChild) + " / " + getComputedStyle(root.querySelector("div[dir=ltr]").firstChild).direction + " (on the " + root.querySelector("div[dir=ltr]").firstChild.localName + ').'; 30 </script> 31 32 </body> 33 </html>