[Bug 14203] JavaScript API to access unsupported CSS properties

http://www.w3.org/Bugs/Public/show_bug.cgi?id=14203

--- Comment #2 from Marat Tanalin (tanalin.com) <mtanalin@yandex.ru> 2011-09-19 01:06:53 UTC ---
(In reply to comment #1)

Thank you for valuable comment, David.

The API I've proposed is a _minimal_ API _enough_ to get value of an
unsupported property.

Such minimal/enough API is _much, much_ better then current situation when we
have no access to unsupported properties _at all_ and are forced to parse
stylesheets entirely from scratch.

As far as I understand CSS-parsing mechanism, if we have following unsupported
property declaration:

    some-property: some value;

then entire string "some-property: some value;" is skipped by browser.

In this string, a browser can automatically treat string before first colon as
property name, while treating rest part of the string (after colon) as its
value.

Inheritance (when needed) could be calculated by JS-script itself by
iteratively checking the property for all parents of the element -- from direct
parent to root element of element's owner-document.

Feel free to supplement the API with additional features that would make
accessing unsupported properties (as well as unsupported values of supported
properties) even easier for web-developers.

Based on information available at your link, we could add 'inherit' boolean
parameter to getStyle() method:

// Second parameter specifies whether property should be inherited (false by
default):
element.getStyle('some-property', true);

(Actually, it's enough to be able to read individual properties via only
getStyle() method to achieve subject goal. getStyles() method is optional
compared with getStyle().)

As for "parse + compute function", I'm not sure it's reasonable enough to use
them in _client_ scripts (as opposed to internal browser's chrome scripts).
Appropriate parts of parsing script could be called later in script -- when raw
value is already obtained. There is no big need to do these actions in exactly
one step.

Thanks.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 19 September 2011 01:06:56 UTC