W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: [DOM4] XML lang

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 05 Oct 2011 10:36:54 -0400
Message-ID: <4E8C6B86.3030509@mit.edu>
To: public-webapps@w3.org
On 10/5/11 4:14 AM, Marcos Caceres wrote:
> 1. I need to find elements of a particular type/name that are in a particular language (in tree order), so that I can extract that information to display to a user.

This use case is handled by querySelectorAll and :lang, no?

> 2. I need to check what the language of an element is (if any), without walking up the tree to look for an xml:lang attribute. Walking the tree is expensive, specially when XML says that xml:lang value is inherited by default.

So what you really want is for the UA to do the tree-walk for you 
instead?  I doubt any UA is going to burn memory on storing the language 
on every element just so they can quickly answer the rare question posed 
above...

Now a tree-walk in the UA code may be faster than doing it from JS.  But 
it'll still be a treewalk.

A better reason for doing this would be that there are sources of 
language information that are not xml:lang.  Or do you explicitly not 
want to take those into account?

One other question: "expensive" is a relative term.  How often do you 
expect to perform this operation?

-Boris
Received on Wednesday, 5 October 2011 14:37:23 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:48 GMT