Closed Bug 1712623 Opened 3 years ago Closed 2 years ago

Add disabled property to SVGStyleElement


(Core :: SVG, enhancement)




104 Branch
Tracking Status
firefox104 --- fixed


(Reporter: longsonr, Assigned: longsonr)


(Keywords: dev-doc-complete)


(1 file)

Chrome supports this: The comment there is old i.e. prior to emilio's disabled rewrite in bug 1281135 I think.

It's consistent with the specification's desire to align SVG and HTML style elements per

And users want it per

consistent with Chrome, the desires of the specification

Assignee: nobody → longsonr

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:longsonr, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(longsonr)
Flags: needinfo?(emilio)
Flags: needinfo?(emilio)
Flags: needinfo?(longsonr)
Pushed by
add disabled property to SVGStyleElement r=emilio
Created web-platform-tests PR for changes under testing/web-platform/tests
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
Upstream PR merged by moz-wptsync-bot

FYI FF104 docs work for this can be tracked in

Hi Robert,

Some questions around SVGStyleElement, including to do with disabled (docs for the page in poor form currently so I want to make sure we cover everything).

  1. Based on your answer here, I have attached some test code for SVGStyleElement here that logs the media, type, disabled, sheet properties. What this appears to show is that FF does not support media or type properties in the same way. Can you explain why?

  2. The subset of your code in which disables might be set is shown below. This makes sense - you first create an element of the svg namespace, which is what tells the user agent you're after an SVGStyleElement, then you create some style information and add it to that element. The disabled only works once you have added the stylesheet information to the node.

     const svg = document.getElementsByTagName("svg")[0];
     const style = document.createElementNS('', 'style');
     const node = document.createTextNode('circle { fill: red; }');
     style.disabled=true;  //Won't work!
     // style.disabled=true;  //Will work if not commented

    It is inline with the spec that there must be a stylesheet or setting disabled = true has no effect. However how then should you add a stylesheet "initially disabled"? (I'd kind of assumed the first case would work - and "empty stylesheet" not being the same as "no stylesheet".

  3. HTMLStyleElement.type is marked as deprecated in MDN docs. Is the same thing true for SVGStyleElement? The spec seems to indicate the default value but not other values that might be supplied - what might they be?

Flags: needinfo?(longsonr)

1, 2, 3 SVG style elements work the same as for HTML style elements.

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