Why does the svg spec differentiate between unsettable and readonly attributes? -


section 4.5.1 of svg 1.1 spec (version 2) describes svgelement interface--the 'base class' of svg objects. says:

interface svgelement : element {            attribute domstring id setraises(domexception);            attribute domstring xmlbase setraises(domexception);   readonly attribute svgsvgelement ownersvgelement;   readonly attribute svgelement viewportelement; }; 

attributes:

  • id (domstring)

    • the value of ‘id’ attribute on given element, or empty string if ‘id’ not present. exceptions on setting

      • domexception, code no_modification_allowed_err raised on attempt change value of read attribute.
  • xmlbase (domstring)

    • corresponds attribute ‘xml:base’ on given element.

      exceptions on setting

      • domexception, code no_modification_allowed_err raised on attempt change value of read attribute.
  • ownersvgelement (readonly svgsvgelement)

    the nearest ancestor ‘svg’ element. null if given element outermost svg element.

  • viewportelement (readonly svgelement)

    the element established current viewport. often, nearest ancestor ‘svg’ element. null if given element outermost svg element.

so none of these attributes writeable. why 2 of them raise exceptions if try write them? other 2 not raise exceptions? difference between 'readonly' , 'setraises'?

setraises doesn't mean attribute isn't writeable. means setting may raise domexception. in svg dom, attributes not readonly annotated way.

in case of svgelement.id, not aware of situation in setting id throw exception. perhaps, in svg implementations, there rare situations in dom in state doesn't allow id changed. don't think need worry that.

as far readonly attributes go. implementation whether ignores attempts set it, or throws exception.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -