[whatwg] getElementsByIdPart

Ian Hickson ian at hixie.ch
Sun Aug 29 10:46:15 PDT 2004


On Thu, 26 Aug 2004 chriswa at comcast.net wrote:
> 
> What I'm looking for is a way to apply a regular expression that can 
> return matched elements.  What I am doing is taking advantage of the way 
> ASP.NET generates id names and use javascript to group them together as 
> structures.

I see you got the XPath solution working.

You should also be able to use DOM2 Traversal to obtain the results you 
are looking for, although IE does not support this.

   http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html#Iterator-overview

I am reluctant to add a getElementsByIdPart() method to the DOM since it 
would be primarily to address this single use case, and is of dubious 
semantic value (IDs are generally thought of as opaque, not as 
hierarchical strings).

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list