CSSOM
CSSOM copied to clipboard
assignments without a value
I don't know if it's a valid syntax according to W3C specifications but I sometimes see assignments like visibility:.
It seems these kind of assignments make the CSS elements disappear, so they are kind of shortcut for reassigning to default value.
This is not a big problem if you write the code yourself but this causes problems when you run javascript code in an arbitrary website. Current implementation gives a TypeError(you get undefined from array) in CSSStyleDeclaration.js file in cssText set method.
Is it possible to change the implementation for supporting assigments without a value in the way I described?
Thanks.
I see two ways to proceed with this fix:
- The quick and dirty fix: Use the CSS3 proposed keyword value: "initial". Considering that this is CSS3, older user agent support would be a problem, and we would be counting on user agents to get it right.
- The long way: Create an object list of properties containing their initial values and query it. This solution would have an issue with undefined | unknown properties, so a bailout would be needed. Github Project CSS-Crush seems to have a fairly complete list at a glance. A further issue from checking the project seems to indicate that there may be differences in the specification depending on locale, namely quotes.