W3C home > Mailing lists > Public > www-style@w3.org > September 2010

[CSS idea] Style sets

From: Andrew Fedoniouk <andrew.fedoniouk@live.com>
Date: Mon, 27 Sep 2010 22:02:35 -0700
Message-ID: <bay141-DS16B24E0B7114F4D3698B8CF8660@phx.gbl>
To: <www-style@w3.org>
?As a celebration of first year anniversary of Style Sets use in my
implementation of CSS I wrote this article about them:

In brief, style set is declared as:

@style-set TabsComponent
   :root { ... }
   :root > ul.ui-tabs-nav { ... }
   :root > div.ui-tabs-panel { ...; display:none; }
   :root > div.ui-tabs-panel.current { ... ; display:block; }

Such style set is applied to some DOM sub-tree using style-set property on
"style set root" element as:

div#my-tabs { style-set: TabsComponent; }

this will define styles of the element itself and its children.

In principle most of features of style sets (but not all) can be achieved by 
use of
CSS preprocessors like http://lesscss.org/ but the main purpose of SS is to 
computational complexity of CSS resolution process.
In my case style set mechanism reduces order of magnitude number of 
that need to be scanned for finding style of particular DOM element.
Default style sheet (of the UA) contains just tens of rules assigning style 
And the whole number of rules in all style sets is about 2 thousands.
I've got overall complexity of DOM style resolving close to O(N*log(S)).
Where N is a number of DOM elements and S is a number of style rules.
In case of flat (conventional CSS) style system the complexity will be over
than O(N*S).

Just an idea.

Andrew Fedoniouk

Received on Tuesday, 28 September 2010 05:03:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:49:48 UTC