Escape ":" and "." characters when doing contextual CSS selection in browsers that support querySelectorAll. [#559 state:resolved] (fxtentacle, Andrew Dupont)

This commit is contained in:
Andrew Dupont 2009-02-22 12:45:00 -06:00
parent 9da5045df2
commit 97fc24a0b2
2 changed files with 5 additions and 1 deletions

View File

@ -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)

View File

@ -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;