W3C home > Mailing lists > Public > www-style@w3.org > January 2004

Re: [css-d] CSS Javascript API

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Fri, 02 Jan 2004 07:20:56 +0100
To: Ian Hickson <ian@hixie.ch>
Cc: www-style@w3.org
Message-ID: <4004e107.179428063@smtp.bjoern.hoehrmann.de>

* Ian Hickson wrote:
>> Say I want to write a general purpose CSS pretty printer based on DOM
>> Level 2 CSS.
>Why would you do that? That's a bit like saying "Say I want to write an
>IRC client using the libpng library". Why choose the API first?

You suggested DOM2 CSS satisfies my needs so I put up a hypothetical

>The reason I ask this is that if you are writing an application, it seems
>to make more sense to decide what your requirements are, then decide what
>ou want to implement it with -- in the case of a pretty printer, a DOM API
>is almost certainly not the right choice since DOMs do not model the
>source, but the semantics.

A document object model is supposed to provide object oriented access to
a document. A document is a representation of information, hence access
to the document typically means both, access to the representation and
access to the information.

    h1, h2 { color: green; background-color: silver; }

    h1, h2 { color: green; background-color: silver; } /* comment */

    h1, h2 { background-color: silver; color: green; }

    h2, h1 { color: green; background-color: silver; }

    h2, h1 { background-color: silver; color: green; }

    h1, h2 { color: #008000; background-color: #C0C0C0; }


    h1 { color: green; background-color: silver; }
    h2 { color: green; background-color: silver; }

    h1 { color: green }
    h1 { background-color: silver }
    h2 { color: green }
    h2 { background-color: silver }

    h1, h2 { color: black; background-color: yellow; }
    h1, h2 { color: green; background-color: silver; }

Ten style sheets. There is no difference in their effect on the
rendering of a document so its safe to say they contain the same
information; yet some of their DOM Level 2 CSS representations are
different. I'd thus rather say it depends on the particular DOM
whether it is suitable for a general purpose pretty printer; I
would for example not hestitate to use DOM Core to write a XML
pretty printer.

>> However, to make a start, I need a Selector API ...

>This seems highly detailed knowledge; are you expecting to deploy your
>applications in Web browsers? Or are these applications expected to run in
>environments that can host custom libraries (such as Web servers or C++
>applications that are shipped in binary or source form)?

Both of course.

>I ask because if you have control over the library, it makes no sense to
>limit yourself to W3C APIs -- interoperability at that level is not

I am not aware of a well-documented usable interface...
Received on Friday, 2 January 2004 01:23:19 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:10 UTC