- From: Doron Rosenberg <doronr@gmail.com>
- Date: Sat, 21 Aug 2004 22:19:05 -0500
Wouldn't a getElementsByAttribute be a more flexiable solution? On Sat, 21 Aug 2004 19:03:03 +0000 (UTC), Ian Hickson <ian at hixie.ch> wrote: > On Sat, 24 Jul 2004 chriswa at comcast.net wrote: > > > > 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. > > I've added a getElementsByClass() method to the Web Apps spec draft which > is probably a more semantically correct solution: > > http://whatwg.org/specs/web-apps/current-work/#selecting > > > > 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. > > You could loop over all the elements and make their class attributes equal > their ID attributes with underscores changed to spaces quite easily, which > would then allow you to use the method mentioned above, as well as letting > you use CSS and other class-based mechanisms. > > Does this help, or do you really think a getElementByIdPart() method > would be better? What worries me about such a method is that an element's > ID is supposed to be unique and opaque, and such an API suggests that IDs > have some sort of structure. > > -- > Ian Hickson U+1047E )\._.,--....,'``. fL > http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. > Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.' >
Received on Saturday, 21 August 2004 20:19:05 UTC