CSSOM icon indicating copy to clipboard operation
CSSOM copied to clipboard

assignments without a value

Open ucarbehlul opened this issue 12 years ago • 1 comments

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.

ucarbehlul avatar Sep 29 '13 19:09 ucarbehlul

I see two ways to proceed with this fix:

  1. 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.
  2. 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.

PlNG avatar Nov 15 '13 01:11 PlNG