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

Re: Extending Class Proposal

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 30 Jan 2013 22:05:47 -0800
Message-ID: <CAAWBYDAXN82bMfqfCUW3+dxdrR0WvFmFb0Fy8XONXHzuOM4rfQ@mail.gmail.com>
To: Philip Walton <philip@philipwalton.com>
Cc: www-style list <www-style@w3.org>
On Thu, Jan 17, 2013 at 3:56 PM, Philip Walton <philip@philipwalton.com> wrote:
> I recently posted a proposal on my website for how I think CSS could/should
> handle the concept of extending a base class:
> http://philipwalton.com/articles/the-future-of-oocss-a-proposal/
> Tab sent me a link to this discussion from August started by David Baron,
> and my proposal basically aligns with method (b) that he suggests:
> http://lists.w3.org/Archives/Public/www-style/2012Aug/0363.html
> I've spent a lot of time thinking about this problem and trying to make it
> work with in Sass; I've firmly come to the conclusion that preprocessors
> can't handle this all by themselves. The article goes into a lot of detail
> why.
> Anyway, I'd love to be part of any discussion on this topic, which is why
> I'm sending this to the list.
> TL;DR for the article:
> * Create a new simple selector called the abstract class selector, which
> uses the % sign (Ex: %base-widget { } ). The abstract class selector would
> match any element with a class that extends from it.
> * Create a new @ rule called @extends to define the inheritance (Ex: @extend
> .widget < %base-widget; )
> The primary reason I think a new simple selector should be created is so you
> can target these elements via JavaScript without having to put the classes
> in the markup.
> document.querySelectorAll("#sidebar %base-widget");
> It would also allow for extending base classes within media queries, which
> currently Sass can't do.

While I *really* want this general ability, I don't like this
particular syntax for it, for the reasons I explain in
<http://lists.w3.org/Archives/Public/www-style/2012Aug/0438.html> - I
think it's somewhat more verbose and less clear than SASS's syntax,
and requires substantially more work to refactor when you decide to
start using it for a particular class.

Received on Thursday, 31 January 2013 06:06:34 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:23 UTC