On Wednesday, October 5, 2011 at 4:36 PM, Boris Zbarsky wrote:
> 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? Ah, yes. I'll try that. > > 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... Agreed. My case is fairly unique. Probably would not warrant it. > > Now a tree-walk in the UA code may be faster than doing it from JS. But > it'll still be a treewalk. Agreed. > > 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? I was not planning on any other sources. > One other question: "expensive" is a relative term. How often do you > expect to perform this operation? Not very in my case. The document is static.
