Hi,
I've stumbled onto the case in which we want to perform a selector
find on an element with a period in its id:
$('my_mail_google.com').down('img')
and the result is null, since Selector.findElements alters the
selector for the selector API by inserting
# and the id into the selector, resulting in the new selector:
'#my_mail_google.com img'
which of course looks for an img element under an element with id
'my_mail_google' and class 'com'.

In short, findElements is missing an escaping for the id. Here's a
revised code:
  findElements: function(root) {
    root = root || document;
    var e = this.expression, results;

    switch (this.mode) {
      case 'selectorsAPI':
        // querySelectorAll queries document-wide, then filters to
descendants
        // of the context element. That's not what we want.
        // Add an explicit context to the selector if necessary.
        if (root !== document) {
          var oldId = root.id, id = $(root).identify();
          e = "#" + id.replace(/\./, '\\.') + " " + e;
        }

        results = $A(root.querySelectorAll(e)).map(Element.extend);
        root.id = oldId;

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


Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to