diff --git a/CHANGELOG b/CHANGELOG index bd3bcf3..902b545 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Escape ":" and "." characters when doing contextual CSS selection in browsers that support querySelectorAll. [#559 state:resolved] (fxtentacle, Andrew Dupont) + * Ensure the `target` property on events is never undefined in IE. [#383 state:resolved] (Mathias Karstädt, Diego Perini, Andrew Dupont) * Ensure Element#descendants always returns an array. [#373 state:resolved] (kangax) diff --git a/src/dom/selector.js b/src/dom/selector.js index 979b7fe..331299d 100644 --- a/src/dom/selector.js +++ b/src/dom/selector.js @@ -122,9 +122,11 @@ var Selector = Class.create({ // Add an explicit context to the selector if necessary. if (root !== document) { var oldId = root.id, id = $(root).identify(); + // Escape special characters in the ID. + id = id.replace(/[\.:]/g, "\\$0"); e = "#" + id + " " + e; } - + results = $A(root.querySelectorAll(e)).map(Element.extend); root.id = oldId;