IDs should NOT contaign plus signs. You should have read the links I posted before.
*ID* and *NAME* tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). And obviously characters like > (children) and + (siblings) affect the selector's behaviour Gabriel Gilini www.usosim.com.br gabr...@usosim.com.br On Thu, Apr 30, 2009 at 6:31 AM, HissingInfernoOfAudio <rono.mu...@gmail.com > wrote: > > Hi, I've discover that IDs containing plus sign (+) are also bad, so I > would suggest escaping plus as well. > > On Apr 23, 5:08 pm, HissingInfernoOfAudio <rono.mu...@gmail.com> > wrote: > > 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 -~----------~----~----~----~------~----~------~--~---