According to the old DOM L2 Style, getPropertyValue
was not required:
The CSS2Properties
interface represents a convenience mechanism for
retrieving and setting properties within a CSSStyleDeclaration
.
The attributes of this interface correspond to all the properties
specified in CSS2. Getting an attribute of this interface is
equivalent to calling the getPropertyValue
method of the
CSSStyleDeclaration interface. Setting an attribute of this
interface is equivalent to calling the setProperty
method of the
CSSStyleDeclaration
interface.
However, implementations were not required to support it, so using getPropertyValue
was safer.
A conformant implementation of the CSS module is not required to
implement the CSS2Properties
interface.
But according to the newer CSSOM, using camel-case without getPropertyValue
must work:
For each CSS property property that is a supported CSS property, the
following partial interface applies where camel-cased attribute is
obtained by running the CSS property to IDL attribute algorithm for
property.
partial interface CSSStyleDeclaration {
attribute DOMString _camel-cased attribute;
};
The camel-cased attribute
attribute, on getting, must return the
result of invoking getPropertyValue()
with the argument being the
result of running the IDL attribute to CSS property algorithm for
camel-cased attribute.
Setting the camel-cased attribute
attribute must invoke
setProperty()
with the first argument being the result of
running the IDL attribute to CSS property algorithm for
camel-cased attribute, as second argument the given value, and no third argument. Any exceptions thrown must be re-thrown.
Therefore, getPropertyValue
is no longer necessary to retrieve CSS values.
getComputedStyle
is no longer required neither. – Sailfish