From 3276e22ab689fc286b84f1ea2b57c42d0623e438 Mon Sep 17 00:00:00 2001 From: TedLiang Date: Sat, 18 Aug 2012 16:42:59 +1000 Subject: [PATCH 1/2] escape special characters in containerId selector --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 76e984d0..611f27bf 100755 --- a/select2.js +++ b/select2.js @@ -942,7 +942,7 @@ */ // abstract opening: function() { - var cid = this.containerId, selector = "#"+ cid, + var cid = this.containerId, selector = "#"+ cid.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'), scroll = "scroll." + cid, resize = "resize." + cid; this.container.parents().each(function() { From 02d6f9f5db922e653d95db98478d68a57ac0acf3 Mon Sep 17 00:00:00 2001 From: TedLiang Date: Sat, 18 Aug 2012 20:40:48 +1000 Subject: [PATCH 2/2] escape special characters in containerId selector --- select2.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 611f27bf..c8120cb8 100755 --- a/select2.js +++ b/select2.js @@ -560,6 +560,7 @@ this.container = this.createContainer(); this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid()); + this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); this.container.attr("id", this.containerId); // cache the body so future lookups are cheap @@ -942,7 +943,7 @@ */ // abstract opening: function() { - var cid = this.containerId, selector = "#"+ cid.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'), + var cid = this.containerId, selector = this.containerSelector, scroll = "scroll." + cid, resize = "resize." + cid; this.container.parents().each(function() {