[whatwg] getElementsByIdPart

Ben Meadowcroft ben at benmeadowcroft.com
Sat Jul 24 00:10:14 PDT 2004


> -----Original Message-----
> From: whatwg-whatwg.org-bounces at lists.whatwg.org
> [mailto:whatwg-whatwg.org-bounces at lists.whatwg.org] On Behalf
> Of chriswa at comcast.net
> Sent: 24 July 2004 07:20
> To: whatwg-whatwg.org at lists.whatwg.org
> Subject: [whatwg] getElementsByIdPart
>
>
> It would be nice if you can add an API to that permit you to
> get elements based on part of the Id name.  This would permit
> you to create classes of controls in JavaScript.
>
> For example ASP.NET labels the id of controls as
> ControlOuter1_ControlInner1_element.  If use such an API I
> can obtain all the elements of ControlOuter1 then all the
> elements of ControlInner1.  Thus I can build a control
> heirarchy in JavaScript.
>
> Currently I use indexOf but it would be faster and more
> efficient if there was such an API of the DOM that supplies
> that information.

How about adding something more general like getElementsBySelector and use
CSS selectors syntax? If we used CSS3 syntax (at candidate rec stage) then
you can use substring matches in your selection.

see http://www.w3.org/TR/css3-selectors/#attribute-substrings for CSS3
selector syntax
and http://simon.incutio.com/archive/2003/03/25/getElementsBySelector for
info on an existing javascript implementation (CSS2 syntax I believe).

--
Ben Meadowcroft
http://www.benmeadowcroft.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3034 bytes
Desc: not available
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20040724/ac43f1c8/attachment-0001.bin>


More information about the whatwg mailing list