From 3c1482ae45fbc7a0f40a841a7228a838277fdb9f Mon Sep 17 00:00:00 2001 From: marek Date: Mon, 28 Apr 2014 12:59:17 +0200 Subject: [PATCH 1/2] Replace dots with underscores in event handler names. Dots are processed in special way in jQuery on/off. --- select2.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/select2.js b/select2.js index 96c46f42..574be872 100644 --- a/select2.js +++ b/select2.js @@ -685,7 +685,9 @@ the specific language governing permissions and limitations under the Apache Lic .appendTo(document.body); this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid()).replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); - this.containerSelector="#"+this.containerId; + this.containerEventName= "s2id_" + (opts.element.attr("id") || "autogen"+nextUid()) + .replace(/([.])/g, '_') + .replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); this.container.attr("id", this.containerId); this.container.attr("title", opts.element.attr("title")); @@ -1335,7 +1337,7 @@ the specific language governing permissions and limitations under the Apache Lic */ // abstract opening: function() { - var cid = this.containerId, + var cid = this.containerEventName, scroll = "scroll." + cid, resize = "resize."+cid, orient = "orientationchange."+cid, @@ -1407,7 +1409,7 @@ the specific language governing permissions and limitations under the Apache Lic close: function () { if (!this.opened()) return; - var cid = this.containerId, + var cid = this.containerEventName, scroll = "scroll." + cid, resize = "resize."+cid, orient = "orientationchange."+cid; From 97b897abe0e60d25712abaa0761bf76035e4d2cd Mon Sep 17 00:00:00 2001 From: marek Date: Mon, 28 Apr 2014 13:12:28 +0200 Subject: [PATCH 2/2] Set id in unescaped version. --- select2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/select2.js b/select2.js index 574be872..5525b1ea 100644 --- a/select2.js +++ b/select2.js @@ -684,8 +684,8 @@ the specific language governing permissions and limitations under the Apache Lic .addClass("select2-hidden-accessible") .appendTo(document.body); - this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid()).replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); - this.containerEventName= "s2id_" + (opts.element.attr("id") || "autogen"+nextUid()) + this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid()); + this.containerEventName= this.containerId .replace(/([.])/g, '_') .replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); this.container.attr("id", this.containerId);