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

Re: [css3-selectors] :parent selector

From: Matthew Raymond <mattraymond@earthlink.net>
Date: Sun, 24 Sep 2006 09:25:04 -0400
Message-ID: <45168730.4050504@earthlink.net>
To: Mihai Sucan <mihai.sucan@gmail.com>
CC: www-style@w3.org

   Let me see if I understand this right. Here's an example from the
email you link too:

| input[type="radio"] < form:not(input[type="radio"]:checked < form)

   Here, "<" is the parent selector, so your :parent pseudo-class is
pretty much "< *". If we wanted to use :parent to reproduce the above
example, we could to the following:

| form > input[type="radio"]:not(:checked):parent

   The problem here is that you have to check all of the parent's
children to see if they match the part of the selector before :parent,
which strikes me as a serious performance hit. On top of this, it could
be recursive:

| element1 > element2 > element3 > element4:parent:parent:parent

   In the above, the user agent has to check every child of every
element in the chain. If you assume that each element has just two
children, then you're checking 2 + 4 + 8 (14) nodes.
Received on Sunday, 24 September 2006 13:25:20 UTC

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