On Wednesday, October 5, 2011 at 11:08 AM, Robin Berjon wrote:

> Unless you're dealing with documents of incredible depth, walking up the tree 
> should really not be all that costly. What's more, since you're dealing with 
> a tree that doesn't change, you can walk the tree once and precompute the 
> language value for every element and cache it so that you only have to walk 
> the tree once.
This is true for my case. 
> But even without that note, have you looked at using 
> document.querySelectorAll("element:lang(en-us)")? It doesn't do exactly what 
> you want, but it should provide a decent starting place. If you're using 
> XPath instead, it has a lang() function that does more or less the same thing.
Yeah, I looked at document.querySelectorAll, which is what prompted me to write 
the email (I was trying to avoid using XPath:)). 
> 
> Oh, and happy birthday!
Thanks! :D 



Reply via email to