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

Re: Select elements based on text content

From: David Chambers <david.chambers.05@gmail.com>
Date: Tue, 30 Mar 2010 13:51:39 +1300
Message-ID: <553826751003291751x788c7b37p96a485f76b7e30d8@mail.gmail.com>
To: www-style@w3.org
On 30 March 2010 05:28, Gabriele Romanato <gabriele.romanato@gmail.com>wrote:

This is somewhat that browser implementors would define "expensive", because
> it actually requires a full access to the DOM structure before the DOM is
> complete.
>

On 30 March 2010 11:11, Boris Zbarsky <bzbarsky@mit.edu> wrote:

In general, the use of such a selector would cause significant slowdowns in
> web page rendering (esp. incremental rendering).
>

That's interesting. I have very little understanding of how selectors work
behind the scenes, and had assumed that selecting elements based on their
text content would be no more difficult than selecting elements based on an
attribute value.

Thanks to the quoted responses, I believe that I now have an understanding
of why selecting elements based on their text content is a slower operation.

Without text content matching:

    <td class="unsupported">(browser can determine at this point which
selectors match this td)

With text content matching:

    <td class="unsupported">(browser unable to determine at this point which
selectors match this td)No</td>(browser can determine at this point which
selectors match this td)

Have I understood the problem correctly?

David
Received on Tuesday, 30 March 2010 00:52:12 UTC

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