prototype findElements querySelectorAll error

Posted by JD on Stack Overflow See other posts from Stack Overflow or by JD
Published on 2009-05-19T15:54:01Z Indexed on 2010/05/08 5:08 UTC
Read the original article Hit count: 244

Filed under:

i'm call the "down" function but am getting an invalid argument using 1.6.1_rc2

here's the html snippet:

<TR id=000000214A class="activeRow searchResultsDisplayOver" conceptID="0000001KIU">
    <TD>
        <DIV class=gridRowWrapper>
            <SPAN class=SynDesc>Asymmetric breasts</SPAN> 
            <DIV class=buttonWrapper>
                <SPAN class=btnAddFav title="Add to Favorites">&nbsp;</SPAN> 
            </DIV>
        </DIV>
    </TD>
</TR>

here's the code:

var description = row.down('span.SynDesc').innerHTML;

row is a dom reference to the element.

prototype is appending a # then the id of the element:

findElements: function(root) {
    root = root || document;
    var e = this.expression, results;

    switch (this.mode) {
      case 'selectorsAPI':
        if (root !== document) {
          var oldId = root.id, id = $(root).identify();
          id = id.replace(/[\.:]/g, "\\$0");
          e = "#" + id + " " + e;
        }

        results = $A(root.querySelectorAll(e)).map(Element.extend); <-- e = "#000000214A span.SynDesc"
        root.id = oldId;

        return results;
      case 'xpath':
        return document._getElementsByXPath(this.xpath, root);
      default:
       return this.matcher(root);
    }

i get an "invalid argument" error?

if i put a breakpoint before the offending line and change e to be equal to "span.SynDesc" it works fine.

help. :)

© Stack Overflow or respective owner

Related posts about prototype