[Bug 14203] New: JavaScript API to access unsupported CSS properties

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

           Summary: JavaScript API to access unsupported CSS properties
           Product: HTML WG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML5 spec (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: mtanalin@yandex.ru
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


We need an API to read raw values of CSS properties including those unsupported
by browser. This will allow us to incredibly speedup evolution of the web by
making it possible to easily add support for new CSS properties to existing
browsers that have no native support for them with pretty trivial JavaScript.

Currently, unsupported properties are just ignored and are unavailable for easy
access from JavaScript.

"Easy access" means access without need for full-fledged manual CSS-parsing
from scratch with JavaScript. Such JavaScript-based parsing is error-prone,
very slow, leads scripts to have terribly-big size, and therefore inapplicable
in most cases.

    We need more smart and usable solution.
    We need more smart and usable solution. (Yes, I've repeated this twice.)

The solution is a dedicated API to read raw values of CSS-properties. The API
could consist of two methods:

    // Returns all CSS-properties as name-value pairs:
    element.getStyles();

    // Returns specified CSS-properties only:
    element.getStyles(['lorem', 'ipsum']);

    // Returns value of single specified CSS-property:
    element.getStyle('some-property');

The element.getStyles() method could return an associative-array-like object.
For example, if we have CSS:

    #example {
        some-property: some value;
        another-property: another value;
    }

then we could use following JavaScript code to access the CSS properties:

    var styles = document.getElementById('example').getStyles();

    // The 'styles' variable now contain two name-value pairs:
    // styles['some-property'] === "some value"
    // styles['another-property'] === "another value"

element.getStyle('some-property') could return value of single specified
property:

    var style = document.getElementById('example').getStyle('some-property');
    // The 'style' variable now contain string "some value".

Once we've got value of the property, all we need is to parse just this
individual value.

Needless to say, parsing an individual value is incomparably more easy and
feasible than parsing full stylesheet from scratch.

For browsers, this could be quite easy to implement the API since they _do_
read all CSS-properties (including unsupported ones), but just _skips_
unsupported ones. For API to be implemented, it's probably enough to just
expose such skipped properties via the API described above.

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 Sunday, 18 September 2011 23:21:00 UTC