safe-blur.js 493 B

123456789101112131415161718192021
  1. ( function( factory ) {
  2. if ( typeof define === "function" && define.amd ) {
  3. // AMD. Register as an anonymous module.
  4. define( [ "jquery", "./version" ], factory );
  5. } else {
  6. // Browser globals
  7. factory( jQuery );
  8. }
  9. } ( function( $ ) {
  10. return $.ui.safeBlur = function( element ) {
  11. // Support: IE9 - 10 only
  12. // If the <body> is blurred, IE will switch windows, see #9420
  13. if ( element && element.nodeName.toLowerCase() !== "body" ) {
  14. $( element ).trigger( "blur" );
  15. }
  16. };
  17. } ) );