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

Re: [css-om] CSSStyleDeclaration.isReadOnly

From: Simon Pieters <simonp@opera.com>
Date: Thu, 22 Aug 2013 10:52:30 +0200
To: "www-style@w3.org" <www-style@w3.org>, Fran├žois REMY <francois.remy.dev@outlook.com>
Message-ID: <op.w17mxsoeidj3kv@simons-macbook-pro.local>
On Thu, 22 Aug 2013 00:04:46 +0200, Fran├žois REMY  
<francois.remy.dev@outlook.com> wrote:

> By the way, I found out there's no way to know which kind of  
> CSSStyleDeclaration instance you're manipulating. While I believe  
> superclasses would be nice, in the meantime it would be cool to have an  
> isReadOnly property on the instances that enables you to know if you can  
> write the style of it the properties are actually computed values.

What's the use case?

This can trivially be checked already, e.g. by using:

   function isReadOnly(decl) {
     try {
       decl.setProperty('', '');
     } catch(e) {
       return true;
     }
     return false;
   }

Is it common to check for this?

-- 
Simon Pieters
Opera Software
Received on Thursday, 22 August 2013 08:47:04 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 22 August 2013 08:47:04 UTC