Re: [DOM4] XML lang

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 UTC