W3C home > Mailing lists > Public > www-style@w3.org > March 2011

Re: CSS Mixins proposal

From: Shane Stephens <shans@google.com>
Date: Thu, 31 Mar 2011 21:49:31 +1100
Message-ID: <BANLkTinqy=vyggFuHLPabfv8+1FNqCPQQg@mail.gmail.com>
To: Garrett Smith <dhtmlkitchen@gmail.com>
Cc: Sylvain Galineau <sylvaing@microsoft.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, Alan Gresley <alan@css-class.com>, www-style list <www-style@w3.org>, Nathan Weizenbaum <nweiz@google.com>, Chris Eppstein <chris@eppsteins.net>
On Wed, Mar 23, 2011 at 3:46 PM, Garrett Smith <dhtmlkitchen@gmail.com>wrote:

> On 3/22/11, Shane Stephens <shans@google.com> wrote:
> > Hi list,
> >
> [...]
> > I think it's clear that using an @-rule in this manner is safe on pretty
> > much every browser likely to be currently in use, or at least the vast
> > majority.
> >
> Test the DOM, e.g. sheet.cssRules[0].style.length

I looked into sheet.cssRules[].style objects today.  The most important
result is that @mixin declarations will not impact code which uses
cssRules[].style objects.

Here are the messy details:

cssRules[].style (or rules[].style, depending on browser) objects come in
two forms:
* Internet Explorer 6 thru 9 provide objects with properties that correspond
to CSS property names.  These objects are unaffected by @mixin declarations,
except that an additional "mixin" property is created with an undefined
value.  Any code which looks for specific properties will still find those
properties; while any code which iterates through all of the properties on
the object must already be able to handle undefined values as this is how IE
represents style properties that have not been set by a style rule.
* Firefox 2, 3, 3.6, and 4; Opera 11; Safari 3, 4 and 5; and Chrome 10
provide an array of CSS properties.  This array is completely unaffected by
@mixin declarations - it remains the same length regardless of the location
of the declaration, and contains the same values.


> --
> Garrett
Received on Thursday, 31 March 2011 10:50:07 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:57 UTC