Re: [css-om] CSSStyleDeclaration.isReadOnly

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