Skip to content

Commit 3c1482a

Browse files
committed
Replace dots with underscores in event handler names. Dots are processed in special way in jQuery on/off.
1 parent 8b463bf commit 3c1482a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

select2.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,9 @@ the specific language governing permissions and limitations under the Apache Lic
685685
.appendTo(document.body);
686686

687687
this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid()).replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
688-
this.containerSelector="#"+this.containerId;
688+
this.containerEventName= "s2id_" + (opts.element.attr("id") || "autogen"+nextUid())
689+
.replace(/([.])/g, '_')
690+
.replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
689691
this.container.attr("id", this.containerId);
690692

691693
this.container.attr("title", opts.element.attr("title"));
@@ -1335,7 +1337,7 @@ the specific language governing permissions and limitations under the Apache Lic
13351337
*/
13361338
// abstract
13371339
opening: function() {
1338-
var cid = this.containerId,
1340+
var cid = this.containerEventName,
13391341
scroll = "scroll." + cid,
13401342
resize = "resize."+cid,
13411343
orient = "orientationchange."+cid,
@@ -1407,7 +1409,7 @@ the specific language governing permissions and limitations under the Apache Lic
14071409
close: function () {
14081410
if (!this.opened()) return;
14091411

1410-
var cid = this.containerId,
1412+
var cid = this.containerEventName,
14111413
scroll = "scroll." + cid,
14121414
resize = "resize."+cid,
14131415
orient = "orientationchange."+cid;

0 commit comments

Comments
 (0)