W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2004

[whatwg] getElementsByIdPart

From: <chriswa@comcast.net>
Date: Mon, 09 Aug 2004 19:57:42 +0000
Message-ID: <080920041957.28024.4117D7360004572800006D7822007456720E999C079D080C@comcast.net>
Ok Zack or any one else on the list can you provide me with an example?  I've search the .net and I cannot find an example using XPATH that can provide a list of DOM elements matching an attribute substring.

Mind you I'm not saying that you cannot do that with an XML document.  You can but can you do this in an HTML DOM document?  In searching for a solution I found a JavaScript XPATH library but this is way too heavy and much more complicated than merely scanning the elements and using indexOf().

And only works if the document is a loaded XML document or if the page is an XHTML pages -- thus not backward compatible (unlikely to be supported by IE6).

I think it would be easier if there was a getElementsById(regExp) that can returns an array of elements.  The DOM already has the info and can scan the elements efficiently than JavaScript indexOf.

But I am open to suggesstions if you can provide me with an example.

Thanks,
Chris 


> On Wednesday 04 August 2004 23:41, Chris Waldron wrote:
> > Thus I think this is still a viable request to have built into the
> > DOM.
> 
> I don't think so. DOM3 XPath offers that and a lot more. 
> 
> Zack
> 
> -- 
> Question authority! Yeah, says who?
Received on Monday, 9 August 2004 12:57:42 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:36 UTC