aboutsummaryrefslogtreecommitdiffstats
path: root/external/jquery-simulate
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2020-05-16 08:26:48 +0200
committerGitHub <noreply@github.com>2020-05-16 08:26:48 +0200
commit512cbbf4d9d039519ef9c94716d7048ca2ff582f (patch)
tree8d403584c77a9e8a1ca7b287f23fd16c8ba65175 /external/jquery-simulate
parent9bb366ef8a710c06df924b2f6567cd5ed701cd44 (diff)
downloadjquery-ui-512cbbf4d9d039519ef9c94716d7048ca2ff582f.tar.gz
jquery-ui-512cbbf4d9d039519ef9c94716d7048ca2ff582f.zip
Build: Update jQuery Simulate, jQuery Migrate & jQuery Color
The jQuery Simulate & jQuery Color updates are needed for compatibility with jQuery master, a future jQuery 4. Closes gh-1914
Diffstat (limited to 'external/jquery-simulate')
-rw-r--r--external/jquery-simulate/LICENSE.txt3
-rw-r--r--external/jquery-simulate/jquery.simulate.js38
2 files changed, 25 insertions, 16 deletions
diff --git a/external/jquery-simulate/LICENSE.txt b/external/jquery-simulate/LICENSE.txt
index 24cad742e..38d2ab8bd 100644
--- a/external/jquery-simulate/LICENSE.txt
+++ b/external/jquery-simulate/LICENSE.txt
@@ -1,5 +1,4 @@
-Copyright 2007, 2014 jQuery Foundation and other contributors,
-https://jquery.org/
+Copyright jQuery Foundation and other contributors, https://jquery.org/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
diff --git a/external/jquery-simulate/jquery.simulate.js b/external/jquery-simulate/jquery.simulate.js
index 4a96cc310..8bcc2e479 100644
--- a/external/jquery-simulate/jquery.simulate.js
+++ b/external/jquery-simulate/jquery.simulate.js
@@ -1,19 +1,28 @@
/*!
- * jQuery Simulate v1.0.0 - simulate browser mouse and keyboard events
+ * jQuery Simulate v1.1.1 - simulate browser mouse and keyboard events
* https://github.com/jquery/jquery-simulate
*
- * Copyright 2012 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
- * Date: 2014-08-22
+ * Date: 2020-05-06
*/
;(function( $, undefined ) {
var rkeyEvent = /^key/,
+ rdashAlpha = /-([a-z])/g,
rmouseEvent = /^(?:mouse|contextmenu)|click/;
+function fcamelCase( _all, letter ) {
+ return letter.toUpperCase();
+}
+
+function camelCase( string ) {
+ return string.replace( rdashAlpha, fcamelCase );
+}
+
$.fn.simulate = function( type, options ) {
return this.each(function() {
new $.simulate( this, type, options );
@@ -21,7 +30,7 @@ $.fn.simulate = function( type, options ) {
};
$.simulate = function( elem, type, options ) {
- var method = $.camelCase( "simulate-" + type );
+ var method = camelCase( "simulate-" + type );
this.target = elem;
this.options = options;
@@ -201,10 +210,10 @@ $.extend( $.simulate.prototype, {
},
dispatchEvent: function( elem, type, event ) {
- if ( elem[ type ] ) {
- elem[ type ]();
- } else if ( elem.dispatchEvent ) {
+ if ( elem.dispatchEvent ) {
elem.dispatchEvent( event );
+ } else if ( type === "click" && elem.click && elem.nodeName.toLowerCase() === "input" ) {
+ elem.click();
} else if ( elem.fireEvent ) {
elem.fireEvent( "on" + type, event );
}
@@ -219,7 +228,7 @@ $.extend( $.simulate.prototype, {
triggered = true;
}
- element.bind( "focus", trigger );
+ element.on( "focus", trigger );
element[ 0 ].focus();
if ( !triggered ) {
@@ -228,7 +237,7 @@ $.extend( $.simulate.prototype, {
element.trigger( focusinEvent );
element.triggerHandler( "focus" );
}
- element.unbind( "focus", trigger );
+ element.off( "focus", trigger );
},
simulateBlur: function() {
@@ -240,7 +249,7 @@ $.extend( $.simulate.prototype, {
triggered = true;
}
- element.bind( "blur", trigger );
+ element.on( "blur", trigger );
element[ 0 ].blur();
// blur events are async in IE
@@ -258,7 +267,7 @@ $.extend( $.simulate.prototype, {
element.trigger( focusoutEvent );
element.triggerHandler( "blur" );
}
- element.unbind( "blur", trigger );
+ element.off( "blur", trigger );
}, 1 );
}
});
@@ -295,6 +304,7 @@ $.extend( $.simulate.prototype, {
simulateDrag: function() {
var i = 0,
target = this.target,
+ eventDoc = target.ownerDocument,
options = this.options,
center = options.handle === "corner" ? findCorner( target ) : findCenter( target ),
x = Math.floor( center.x ),
@@ -315,14 +325,14 @@ $.extend( $.simulate.prototype, {
clientY: Math.round( y )
};
- this.simulateEvent( target.ownerDocument, "mousemove", coord );
+ this.simulateEvent( eventDoc, "mousemove", coord );
}
- if ( $.contains( document, target ) ) {
+ if ( $.contains( eventDoc, target ) ) {
this.simulateEvent( target, "mouseup", coord );
this.simulateEvent( target, "click", coord );
} else {
- this.simulateEvent( document, "mouseup", coord );
+ this.simulateEvent( eventDoc, "mouseup", coord );
}
}
});