From 26fc3b5587ed117a972224ac661255998e59f9e1 Mon Sep 17 00:00:00 2001 From: Alexander Schmitz Date: Wed, 15 Jul 2015 20:17:12 -0400 Subject: [PATCH] Core: Move safe blur into its own module Ref #9647 --- ui/core.js | 14 +------------- ui/dialog.js | 3 ++- ui/draggable.js | 1 + ui/safe-blur.js | 21 +++++++++++++++++++++ 4 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 ui/safe-blur.js diff --git a/ui/core.js b/ui/core.js index f0eef1328..9e799a04c 100644 --- a/ui/core.js +++ b/ui/core.js @@ -30,6 +30,7 @@ "./jquery-1-7", "./plugin", "./safe-active-element", + "./safe-blur", "./version" ], factory ); } else { @@ -39,19 +40,6 @@ } }( function( $ ) { -$.extend( $.ui, { - - // Internal use only - safeBlur: function( element ) { - - // Support: IE9 - 10 only - // If the is blurred, IE will switch windows, see #9420 - if ( element && element.nodeName.toLowerCase() !== "body" ) { - $( element ).trigger( "blur" ); - } - } -} ); - // plugins $.fn.extend( { scrollParent: function( includeHidden ) { diff --git a/ui/dialog.js b/ui/dialog.js index e2369d0b0..acb7814d1 100644 --- a/ui/dialog.js +++ b/ui/dialog.js @@ -31,7 +31,8 @@ "./mouse", "./position", "./resizable", - "./safe-active-element" + "./safe-active-element", + "./safe-blur" ], factory ); } else { diff --git a/ui/draggable.js b/ui/draggable.js index d3afc9add..b2169703f 100644 --- a/ui/draggable.js +++ b/ui/draggable.js @@ -25,6 +25,7 @@ "./mouse", "./plugin", "./safe-active-element", + "./safe-blur", "./version", "./widget" ], factory ); diff --git a/ui/safe-blur.js b/ui/safe-blur.js new file mode 100644 index 000000000..525878268 --- /dev/null +++ b/ui/safe-blur.js @@ -0,0 +1,21 @@ +( function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "jquery", "./version" ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +} ( function( $ ) { +return $.ui.safeBlur = function( element ) { + + // Support: IE9 - 10 only + // If the is blurred, IE will switch windows, see #9420 + if ( element && element.nodeName.toLowerCase() !== "body" ) { + $( element ).trigger( "blur" ); + } +}; + +} ) ); -- 2.39.5