W3C home > Mailing lists > Public > www-style@w3.org > July 2013

RE: [cssom] Identifying types and shorthand and unsupported properties

From: François REMY <francois.remy.dev@outlook.com>
Date: Sun, 14 Jul 2013 07:41:48 +0200
Message-ID: <DUB120-W2E51E77D70E9E36256C21A5660@phx.gbl>
To: Sylvain Galineau <galineau@adobe.com>, 'Tab Atkins Jr.' <jackalmage@gmail.com>, 'Leif Arne Storset' <lstorset@opera.com>
CC: 'www-style list' <www-style@w3.org>, "mail@rodneyrehm.de" <mail@rodneyrehm.de>
>>± It's already happened in IE for many, many years. Unknown properties are
>>± added to the style object as an expando. So if you have:
>>±
>>± #something {
>>± foo: bar;
>>± }
>>±
>>± …then document.getElementById('something').style.foo returns "bar".
>>
>>I'm not 100% sure about that one. I know for sure that if you do <el
>>style="foo: bar"> in IE, that works, and also that you can access the
>>value at the CSSDeclaration level if it's in a stylesheet, but I don’t
>>think the cascade enter in action at any point for those expandos. We may
>>want to double-check that.
>
> This example certainly works. The feature is definitely super simple and
> for polyfilling it does the job.

Okay, got it. You probably meant "currentStyle" for which you indeed get "bar".

<!doctype html>
<html>
 <head>
  <title>...</title>
  <style>
   #something {
    foo: bar;
   }
  </style>
 </head>
 <body>
  <div id="something"></div>
  <script>document.write(document.all.something.style.foo);</script><BR>
  <script>document.write(document.all.something.currentStyle.foo);</script><BR>
  <script>document.write(getComputedStyle(document.all.something).foo);</script><BR>
 </body>
</html>

outputs

    undefined
    bar
    bar

in IE10



>>It could be possible to instruct the browser to keep some properties even
>>if he does not understand them, as an opt-in:
>>
>> @polyfill background-3d-distance {
>> cascade: true;
>> inherit: false;
>> initial: 0px
>> }
>>
>>That would however only work at a style-sheet level (if you have multiple
>>stylesheets, you need to specify this in each one of them, before any
>>declaration).
>>
>>
>>Thoughts?
>
> Well, if this rule can be at the end of all your stylesheets then you'd
> better keep all the properties if you don't want to reparse...

Okay, let's add some @coffee at-rule at the end of the reply and let Sylvain reparse the mail :-)

hint: "at the stylesheet level" ... "before any declaration" 		 	   		  
Received on Sunday, 14 July 2013 05:42:15 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:32 UTC