1
0
mirror of synced 2024-11-29 16:16:02 +03:00

Merge pull request #1920 from jpotterm/prevent-ie-body-clicks

Prevent IE from generating unwanted clicks on the body.
This commit is contained in:
Kevin Brown 2014-01-09 11:43:21 -08:00
commit 2158a836e6

View File

@ -105,6 +105,14 @@ the specific language governing permissions and limitations under the Apache Lic
nextUid=(function() { var counter=1; return function() { return counter++; }; }());
function reinsertElement(element) {
var placeholder = $(document.createTextNode(''));
element.before(placeholder);
placeholder.before(element);
placeholder.remove();
}
function stripDiacritics(str) {
var ret, i, l, c;
@ -1296,6 +1304,9 @@ the specific language governing permissions and limitations under the Apache Lic
mask.hide();
mask.appendTo(this.body());
mask.on("mousedown touchstart click", function (e) {
// Prevent IE from generating a click event on the body
reinsertElement(mask);
var dropdown = $("#select2-drop"), self;
if (dropdown.length > 0) {
self=dropdown.data("select2");
@ -2048,6 +2059,8 @@ the specific language governing permissions and limitations under the Apache Lic
}));
selection.on("mousedown touchstart", this.bind(function (e) {
// Prevent IE from generating a click event on the body
reinsertElement(selection);
if (!this.container.hasClass("select2-container-active")) {
this.opts.element.trigger($.Event("select2-focus"));