[selectors-api] : bugs in latest level 1 and level 2 drafts

Hello,

I'm not very familiar with how everything works here at w3 but I
believe there are bugs in the final example script in both "levels" of
"selectors-api", including the latest drafts of each.  The variable
"elms" is being referenced but is not defined.  Instead the variable
"list" is declared which I assume is the intended variable.  In the
Level 2 draft someone changed one of the references to "elms" to
"list" but left the others so the script is still bugged.

>From Level 1 draft("list" declared but "elms" referenced):
var list = document.querySelectorAll("svg video");
var result = new Array();
var svgns = "http://www.w3.org/2000/svg"

for(var i = 0; i < elms.length; i++) {
  if(elms[i].namespaceURI == svgns) {
    result.push(elms[i]);
  }
}

>From Level 2 draft("list" declared and referenced in one place but
"elms" is still referenced in others"
var list = document.querySelectorAll("svg video");
var result = new Array();
var svgns = "http://www.w3.org/2000/svg"

for(var i = 0; i < elms.length; i++) {
// ASM: the next line was changed to reference "list" instead of "elms".
  if(list[i].namespaceURI == svgns) {
    result.push(elms[i]);
  }
}

I like the name "elist" for the variable myself so my fixed script is:
var elist = document.querySelectorAll("svg video");
var result = new Array();
var svgns = "http://www.w3.org/2000/svg"

for(var i = 0; i < elist.length; i++) {
  if(elist[i].namespaceURI == svgns) {
    result.push(ellist[i]);
  }
}

Sorry if this has already been brought up.   I tried searching the
archives for any mention of it...

Kind Regards,
ASM

Received on Saturday, 10 July 2010 12:57:24 UTC