Re: ISSUE-110: Do we need a singular method for getting just one element

Web APIs Issue Tracker wrote:
> ISSUE-110: Do we need a singular method for getting just one element
> 
> http://www.w3.org/2005/06/tracker/webapi/issues/110

There are significant performance benefits to using the singular method 
when only one element is desired [1] and also there are several use cases:

* Selecting the first element with either ID [2]
   document.selectElement("#foo, #bar")

* Selecing a single element to modify, where you know you only need a 
single element. e.g. This could be the event handler for for a change 
event of a form control.

function handler(evt) {
   var ctrl = event.target;
   var parent = ctrl.parentNode;
   var errMsg = parent.selectElement(".error");
   ...
   // Check the validity of the form control
   // and update the errMsg appropriately
}

* It's useful where you know only single element can be returned.  e.g.
   document.selectElement("#foo>p:first-child");

There's probably a few more use cases too.  Given these reasons, I think 
(unless there are any objections) we can resolve and close this issue, 
in favour of retaining both methods.

[1] http://lists.w3.org/Archives/Public/public-webapi/2007Feb/0024.html
[2] http://lists.w3.org/Archives/Public/public-webapi/2007Feb/0029.html

-- 
Lachlan Hunt
http://lachy.id.au/

Received on Sunday, 24 June 2007 14:55:50 UTC