W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2001

Implementation of CSSStyleDeclaration

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Wed, 18 Apr 2001 21:17:21 +0200
To: www-dom@w3.org
Message-ID: <r7nrdtcqrjfkn6m38d3bkhrdjt90k8qosu@4ax.com>

   I wonder how to implement the CSSStyleDeclaration interface in DOM
Level 2.

  * attribute item: "Used to retrieve the properties that have been
    explicitly set in this declaration block. The order of the
    properties retrieved using this method does not have to be the order
    in which they were set." How does this interact with setProperty()?
    If I add a new property via setProperty(), which index number does
    it get? length i.e. it is inserted at the end of the 'list'? Or
    doesn't that matter, i.e. the order may be changed through calling
    setProperty()or removeProperty()

  * the other methods access properties by their name. Let's say my
    implementation doesn't support a specific level of CSS (what seems
    to be legal, otherwise it should be the Document Object Model CSS2
    and that's not its name):

     * getPropertyCSSValue() and getPropertyValue return alway the same
       thing, right? The difference is the treatment of shorthand
       properties, my implementation doesn't know what a shorthand
       property is in CSS Level 1, 2, 3, 4, ... so it could not
       differentiate between them

     * given a declaration like 'c { coolness: allrighty !important }'
       and I call decl->setProperty('coolness', 'root', '') it has no
       effect, since the cascade says !important declarations override
       those without, right?

     * so the interface provides access to the explicitly set properties
       after applying the cascade in the current block. Applicable rules

         * !important declarations override others for the same property
         * only the last declaration counts

       so the in the following style sheet

         elem {
           margin: 0 0 0 0 !important;
           margin-left: inherit !important;
           margin: 1em;
           margin-left: -99.6qp;
           margin-left: 6cm !important;

      results in my DOM implementation in

        printf "%s\n", decl->getPropertyValue('margin');
        printf "%s\n", decl->getPropertyCSSValue('margin');
        printf "%s\n", decl->getPropertyValue('margin-left');
        printf "%s\n", decl->getPropertyCSSValue('margin-left');


        0 0 0 0
        0 0 0 0

Björn Höhrmann { mailto:bjoern@hoehrmann.de } http://www.bjoernsworld.de
am Badedeich 7 } Telefon: +49(0)4667/981028 { http://bjoern.hoehrmann.de
25899 Dagebüll { PGP Pub. KeyID: 0xA4357E78 } http://www.learn.to/quote/
Received on Wednesday, 18 April 2001 15:16:33 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC