Re: DOM XPath and Text nodes

On Sep 13, 2011, at 20:47 , Anne van Kesteren wrote:
> On Tue, 13 Sep 2011 20:38:38 +0200, Bjoern Hoehrmann <derhoermi@gmx.net> wrote:
>> * Anne van Kesteren wrote:
>>> The couple of bugs filed against Opera indicated authors did expect what
>>> Firefox is doing.
>> 
>> Well, if those reports offer interesting reasoning you are welcome to
>> share the reasoning, but beyond that it's not very interesting; people
>> who expect the Opera behavior are not likely to tell you to change it,
>> and they can't offer opposing views either as the bugs are not public.
> 
> I think it would be more interesting if Gecko or WebKit had bug reports requesting them to match Opera's behavior.

I never bothered to file bugs about it since vendor interest in XPath has been generally low and IE doesn't support it in-document anyway, but I've certainly been bitten by strange behaviours of text() before. This is all the more annoying because support for selecting text() nodes faster than by walking the entire tree by hand is one of the reasons to use XPath instead of Selectors in the first place. I usually address it by calling document.normalize(), which is a PITA.

I don't know if there's a point in saving DOM 3 XPath. It was created by a group that IIRC wasn't convinced that it needed to be done and its design is clunky at the best of times. We'd probably be better off with either something like queryXPath(), or by providing ways of addressing its primary use cases directly (at least text nodes and axes).

-- 
Robin Berjon - http://berjon.com/ - @robinberjon

Received on Wednesday, 14 September 2011 10:02:53 UTC