- From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
- Date: Fri, 25 May 2012 18:25:47 +0400
- To: Shane Stephens <shans@google.com>
- Cc: Sebastian Zartner <sebastianzartner@gmx.de>,"florianr@opera.com" <florianr@opera.com>,"www-style@w3.org" <www-style@w3.org>,"jackalmage@gmail.com" <jackalmage@gmail.com>
25.05.2012, 12:14, "Shane Stephens" <shans@google.com>: >>> Additionally, it's not actually clear to me that you really want to have >>> very long selectors, given the performance problems that you'd incur. >>> Should we be encouraging this sort of thing? >> >> Well, it was just an example for when a variable could be used for selectors. It wouldn't make much sense to put "div" into a variable and use that variable inside a selector, no? > I'm pointing out that using variables as selectors is probably almost always undesirable, because providing this facility encourages the use of longer selectors, which are a performance issue. Long selectors exist and are (and will be) needed anyway. For example, we have a content block with 'content' class, we have '.product' block inside it, and we have '.info', '.image', '.price', '.order', and other blocks inside '.product' block. So we inevitably end up with selectors like '.content .product .info'. This can be addressed probably more elegantly with something like @with rules [1], but my point here is that long selector chains exist and are needed regardless of whether it is encouraged someway or not. BTW, browser vendors (WebKit [2], Mozilla [3]) already take steps to make selectors much faster and, in most cases, independent from how long selector is. [1] http://lists.w3.org/Archives/Public/www-style/2012Jan/0371.html [2] https://bugs.webkit.org/show_bug.cgi?id=53880 [3] https://bugzilla.mozilla.org/show_bug.cgi?id=705877
Received on Friday, 25 May 2012 14:27:46 UTC