W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2010

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

From: ASM Blur <asmblur@gmail.com>
Date: Sat, 10 Jul 2010 06:46:48 -0500
Message-ID: <AANLkTikh0TpLA_1WLMEe_y9cXyIaZrxuNxS2hozL4VLf@mail.gmail.com>
To: public-webapps@w3.org
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:39 GMT