[whatwg] getElementsByIdPart

After looking at this carefully I think there are some problems with the 
XPATH approach...

[1]  The HTML document object does not support XPATH.
       You need to create an XML document in order to use XPATH. 
        I noticed that someone wrote a JavaScript library whereby you 
can use XPATH on HTML but then that really defeats the purpose not to 
mention code bloat for an extremely simple method.

[2]   Legacy HTML.  Many pages are not XHTML.

Thus I think this is still a viable request to have built into the DOM.

Thanks,
Chris


Doron Rosenberg wrote:

>On Sat, 31 Jul 2004 15:31:46 -0700, Chris Waldron <chriswa at comcast.net> wrote:
>  
>
>>Doron,
>>
>>     Thanks for the suggestion.  I'm not an XPATH expert but just on
>>cursory lookup I cannot find any reference to how to obtain elements on
>>parts of an attribute value.  There are references to being able to get
>>elements using the whole attribute value.  Essentially I cannot seem to
>>find where I can use a regualar expression to express that I want
>>elements returns should the attribute match my regular expression.
>>
>>Thanks,
>>Chris
>>
>>
>>
>>Doron Rosenberg wrote:
>>
>>    
>>
>>>You could use XPATH to do that.  Mozilla for example supports running
>>>XPATH on documents.
>>>
>>>On Sat, 24 Jul 2004 06:19:39 +0000, chriswa at comcast.net
>>><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.
>>>>
>>>>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.
>>>>
>>>>Thanks,
>>>>Chriswa
>>>>
>>>>        
>>>>
>
>Function: boolean contains(string, string)
>
>The contains function returns true if the first argument string
>contains the second argument string, and otherwise returns false.
>
>  
>

Received on Wednesday, 4 August 2004 20:41:11 UTC