Skip to content

Conversation

@sideshowbarker
Copy link
Member

@sideshowbarker sideshowbarker commented Sep 26, 2023

See also whatwg/html#9798

@sideshowbarker sideshowbarker force-pushed the sideshowbarker/disable-a-css-stylesheet branch from 2a417f0 to 8f279af Compare September 26, 2023 15:56
@zcorpan
Copy link
Contributor

zcorpan commented Sep 28, 2023

How is it different from removing (and then creating a new sheet when enabling again)?

In WebKit it seems the re-enabled sheet is the same object, but in Chrome and Firefox it's a new object. Demo for http://software.hixie.ch/utilities/js/live-dom-viewer/ :

<!DOCTYPE html>
<link rel=stylesheet href="data:text/css,html{background:yellow} " id=x> 
<script>
onload = () => {
var sheet = x.sheet;
w(document.styleSheets.length)
x.disabled = true;
w(sheet.ownerNode)
w(document.styleSheets.length)
x.disabled = false;
w(sheet === x.sheet);
}
</script>

Copy link
Collaborator

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this doesn't match how browsers behave with <link rel=stylesheet disabled> right? In particular that doesn't mess with the disabled flag at all.

Maybe call this "remove a CSS style sheet" or so?

@zcorpan
Copy link
Contributor

zcorpan commented Oct 9, 2023

Maybe call this "remove a CSS style sheet" or so?

Yes but, again, it's already in the spec :) https://drafts.csswg.org/cssom/#remove-a-css-style-sheet

@sideshowbarker
Copy link
Member Author

Yeah, I’m going ahead and closing

How is it different from removing (and then creating a new sheet when enabling again)?

I can see now that it’s not different from removing, so I’m going ahead and closing this PR.

@sideshowbarker sideshowbarker deleted the sideshowbarker/disable-a-css-stylesheet branch October 20, 2023 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants