Closed Bug 1281135 Opened 8 years ago Closed 5 years ago

"disabled=true" not working in link for stylesheet at initial load


(Core :: DOM: CSS Object Model, defect, P3)

47 Branch



Tracking Status
firefox68 --- fixed


(Reporter: amnon.david, Assigned: emilio)



(Keywords: dev-doc-complete, Whiteboard: [webcompat][wptsync upstream])


(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36

Steps to reproduce:

<link id='rtl' rel="stylesheet" href="./mypath/mystyle.css" disabled="true">

Actual results:

mystyle.css affects the rendered page.

Expected results:

mystyle.css should have not have any effect on the rendered page. Changing the disabled property via DOM after the page loads fixes this, but it is a workaround and not the correct behaviour

Also explained here:
OS: Unspecified → Mac OS X
Hardware: Unspecified → x86_64
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Cameron, what do you think?
Flags: needinfo?(cam)
I guess it's a bug; Safari, Chrome and Edge all disable the style sheet when disabled="" is set in content.  The HTML spec seems to have lost the disabled attribute on <link> and <style> (filed, but I imagine it should work as the test case expects.
Ever confirmed: true
Flags: needinfo?(cam)
Though points out that Firefox doesn't support the disabled="" content attribute at all (just the IDL attribute).
Priority: -- → P3
Flags: webcompat?
Whiteboard: [webcompat]
Summary: "disabled=true" not working in link for stylesheet → "disabled=true" not working in link for stylesheet at initial load
Component: DOM: Core & HTML → DOM: CSS Object Model

WebKit / Blink behavior for <link rel="stylesheet" disabled> is a bit fishy, but I'll take a look.

Flags: needinfo?(emilio)

I proposed something in that HTML spec issue.

Assignee: nobody → emilio
Flags: needinfo?(emilio)

...instead of forwarding to the sheet like HTMLStyleElement does.

I've proposed this behavior in:

I think this is one of the sane behaviors we can have, what Blink / WebKit do
makes no sense to me.

Alternative potentially-sane behavior is making the initial value of the
stylesheet's disabled bit the same as the content attribute, and both reflect
and forward the attribute from the setter.

That means that setAttribute does something different than setting disabled,
which means that you can get into all sorts of funny states when reloading the
sheet... So I rather not do that.

Pushed by
Make <link disabled> work and HTMLLinkElement.disabled reflect that attribute. r=bzbarsky
Flags: needinfo?(emilio)
Pushed by
Make <link disabled> work and HTMLLinkElement.disabled reflect that attribute. r=bzbarsky
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Pushed by
followup: Address a review comment on a test.
Created web-platform-tests PR for changes under testing/web-platform/tests
Whiteboard: [webcompat] → [webcompat][wptsync upstream]

Documentation has been updated:

Changes include moving the disabled attribute from the obsolete properties section up into the main list, and updating the text to describe the behavior implemented by this spec change.

BCD data update has been submitted and is pending review:

Reviews appreciated; feel free to correct any errors yourself or point them out to me.

Thanks Eric, I did some edits (please review if you find some time as English is not my first language), and left a few comments in BCD regarding a misunderstanding between what the old and new behavior is :)

:emilio -- I am working on an update to the BCD patch which I will submit shortly. I have read your changes to the article and think I see what you're saying there. I did rewrite the text to be more specific on a couple of things (I think) and would appreciate it if you would read it again to be sure I didn't screw up my rewrite. Otherwise, I'll restore your original text and just make minor grammatical tweaks.

Thanks for jumping on the reviewing right away! I very much appreciate it!

Flags: needinfo?(emilio)

Commented there, thank you :)

Flags: needinfo?(emilio)
Regressions: 1567182
Regressions: 1678987
You need to log in before you can comment on or make changes to this bug.