Skip to content

Commit

Permalink
Fix update a style block to match reality and CSSWG resolution.
Browse files Browse the repository at this point in the history
No browser passed the test-case that was linked from the comment.

The algorithm was also inconsistent, as it looked at whether
the element was in a shadow tree or in the document tree, but it was
only specified to be re-run if the element becomes connected or
disconnected.

The CSSWG discussed this in
w3c/csswg-drafts#3096 (comment)
and there are WPTs for this.

This also matches the definition of <link rel="stylesheet"> which does
use connectedness: https://html.spec.whatwg.org/#link-type-stylesheet
  • Loading branch information
emilio committed Jan 15, 2021
1 parent a6bc594 commit 0bdf258
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -15096,11 +15096,8 @@ interface <dfn>HTMLStyleElement</dfn> : <span>HTMLElement</span> {
<li><p>If <var>element</var> has an <span>associated CSS style sheet</span>, <span
data-x="remove a CSS style sheet">remove the CSS style sheet</span> in question.</p></li>

<li><p>If <var>element</var>'s <span>root</span> is neither a <span>shadow root</span> nor a
<span>document</span>, then return.</p></li>
<!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2740
Also, per https://github.com/w3c/webcomponents/issues/56 stylesheets should work in
disconnected shadow trees. -->
<li><p>If <var>element</var> is not <span>connected</span>, then return.</p></li>
<!-- See also https://github.com/w3c/csswg-drafts/issues/3096 -->

<li>
<p>If <var>element</var>'s <code data-x="attr-style-type">type</code> attribute is present and
Expand Down

0 comments on commit 0bdf258

Please sign in to comment.