Open
Bug 91370
Opened 24 years ago
Updated 2 years ago
Implement setting cssText on various CSSRule implementations
Categories
(Core :: DOM: CSS Object Model, enhancement, P3)
Core
DOM: CSS Object Model
Tracking
()
NEW
Future
People
(Reporter: bzbarsky, Unassigned)
References
Details
(Keywords: dom2, Whiteboard: [webcompat])
setting cssText doesn't work anywhere at the moment.
It needs to work in:
CSSCharsetRuleImpl
CSSImportRuleImpl
CSSMediaRuleImpl
CSSNameSpaceRuleImpl
CSSStyleRuleImpl
nsDOMCSSDeclaration
Most of the work for nsDOMCSSDeclaration is done already, so making that work is
a one-line change:
- // XXX TBI
- return NS_OK;
+ return ParseDeclaration(aCssText, PR_FALSE, PR_TRUE);
Arguably, this is the most likely-to-be-used case, so it may be worth checking
in on its own.
Comment 1•23 years ago
|
||
Peter, would you please review bz's patch in his comment above?
Status: NEW → ASSIGNED
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla0.9.8
Comment 2•23 years ago
|
||
r=peterv.
Comment 3•23 years ago
|
||
sr=jst, bz, would you be able to check this one in?
Reporter | ||
Comment 4•23 years ago
|
||
Checked in. Leaving open for now... we could make this the SetCssText metabug
or resolve it and file a bunch of new bugs..
Comment 6•22 years ago
|
||
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Status: ASSIGNED → NEW
Comment 7•20 years ago
|
||
Still needed? (Or: has anything been decided past 4 years?)
Comment 8•19 years ago
|
||
Ignore comment 7. It seems setting cssText is not implemented. At least not for cases like
document.styleSheets[0].cssRules[0].cssText = "p { background:lime }"
although it doesn't throw either.
On setting it should also be checked if the statement conforms to the syntax rules. If not, SYNTAX_ERR must be thrown. If one of the declarations is invalid, it should be dropped and not form part of the setted value. And you also should not be allowed to change the type of rule. That raises a INVALID_MODIFICATION_ERR exception...
Reporter | ||
Comment 9•19 years ago
|
||
> If not, SYNTAX_ERR must be thrown.
I don't think we want to do this. Unknown CSS is Unknown CSS -- this case should not differ from the invalid declaration case; in fact the two cannot be told apart.
Comment 10•19 years ago
|
||
Currently you throw for `p:-test- { background:lime }` for example, but not for `p { foo:bar }` (using insertRule).
Reporter | ||
Comment 11•19 years ago
|
||
Yeah, that's what the DOM2 CSS spec says; I now repent of implementing it that way. I think we might even have a bug on it; I know dbaron has commented about it in the past.
Updated•15 years ago
|
Assignee: general → nobody
QA Contact: ian → general
Comment 12•15 years ago
|
||
Is there a reason the patch in comment 1 has not landed?
Reporter | ||
Comment 13•15 years ago
|
||
Comment 14•15 years ago
|
||
Yes, sorry, I meant #0. I am confused because it doesn't seem to be landed:
http://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSStyleRule.cpp#1511
Reporter | ||
Comment 15•15 years ago
|
||
Comment 0 pretty clearly talks about nsDOMCSSDeclaration, no? http://hg.mozilla.org/mozilla-central/annotate/98c37ac79fdc/layout/style/nsDOMCSSDeclaration.cpp#l121
QA Contact: general → style-system
Comment 16•8 years ago
|
||
This came up in an issue about Google Drive.
https://webcompat.com/issues/3822
See Also: → https://webcompat.com/issues/3822
Whiteboard: [webcompat]
Reporter | ||
Comment 17•8 years ago
|
||
That doesn't look relevant to this bug at all. The code linked there is doing:
e = fb(d.querySelectorAll("*"));
...
var g = e[f],
...
g.style.cssText = l;
so I'm pretty sure "g" is an element. Setting .cssText on an element's .style works perfectly fine and has for 15 years, ever since comment 4.
The real issue you seem to be running into there is that _getting_ .cssText on computed style always returns an empty string in Gecko, whereas in Chrome it returns a very long string of all the computed styles. Looks like bug 137687 tracks this; this bug does NOT block that one.
No longer blocks: 137687
Summary: Implement setting cssText → Implement setting cssText on various CSSRule implementations
Updated•7 years ago
|
Priority: -- → P3
Comment 18•6 years ago
|
||
Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.
Webcompat Priority: --- → ?
Comment 19•6 years ago
|
||
See bug 1547409. Migrating whiteboard priority tags to program flags.
Updated•6 years ago
|
Type: defect → enhancement
Updated•5 years ago
|
Webcompat Priority: ? → ---
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•