From 97fc24a0b2f32717c40a0d71bbdea4ca58e0847b Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Sun, 22 Feb 2009 12:45:00 -0600 Subject: [PATCH] Escape ":" and "." characters when doing contextual CSS selection in browsers that support querySelectorAll. [#559 state:resolved] (fxtentacle, Andrew Dupont) --- CHANGELOG | 2 ++ src/dom/selector.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) 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;