mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 13:46:31 +00:00
LibWeb: SVG use element shadow roots should be closed, not open
This goes against the spec but matches all other browser engines.
This commit is contained in:
parent
1402c143a9
commit
42802b0785
Notes:
github-actions[bot]
2025-08-07 20:17:24 +00:00
Author: https://github.com/awesomekling
Commit: 42802b0785
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5767
3 changed files with 16 additions and 2 deletions
|
@ -36,8 +36,10 @@ void SVGUseElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGUseElement);
|
||||
Base::initialize(realm);
|
||||
|
||||
// The shadow tree is open (inspectable by script), but read-only.
|
||||
auto shadow_root = realm.create<DOM::ShadowRoot>(document(), *this, Bindings::ShadowRootMode::Open);
|
||||
// NOTE: The spec says "The shadow tree is open (inspectable by script), but read-only."
|
||||
// This doesn't actually match other browsers, and there's a spec issue to change it.
|
||||
// Spec bug: https://github.com/w3c/svgwg/issues/875
|
||||
auto shadow_root = realm.create<DOM::ShadowRoot>(document(), *this, Bindings::ShadowRootMode::Closed);
|
||||
|
||||
// The user agent must create a use-element shadow tree whose host is the ‘use’ element itself
|
||||
set_shadow_root(shadow_root);
|
||||
|
|
2
Tests/LibWeb/Text/expected/SVG/use-shadowRoot-closed.txt
Normal file
2
Tests/LibWeb/Text/expected/SVG/use-shadowRoot-closed.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
null
|
||||
[object ShadowRoot]
|
10
Tests/LibWeb/Text/input/SVG/use-shadowRoot-closed.html
Normal file
10
Tests/LibWeb/Text/input/SVG/use-shadowRoot-closed.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<script src="../include.js"></script>
|
||||
<svg id="foo"></svg>
|
||||
<svg><use id="use" href="#foo" /></svg>
|
||||
<script>
|
||||
test(() => {
|
||||
println(use.shadowRoot);
|
||||
println(internals.getShadowRoot(use));
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue