From bb49bd794bc8ea4238162725b518fb46234f3cf9 Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski-Owczarek Date: Wed, 1 May 2024 00:54:19 +0200 Subject: All: Drop support for IE & some other browsers (but mostly IE) Closes gh-2249 --- ui/core.js | 4 ---- ui/effect.js | 24 ++++++----------------- ui/focusable.js | 14 ++----------- ui/form-reset-mixin.js | 3 +-- ui/form.js | 23 ---------------------- ui/ie.js | 18 ----------------- ui/labels.js | 5 ++--- ui/safe-active-element.js | 44 ----------------------------------------- ui/safe-blur.js | 25 ----------------------- ui/widgets/accordion.js | 10 ---------- ui/widgets/autocomplete.js | 48 +++++---------------------------------------- ui/widgets/button.js | 6 +++--- ui/widgets/checkboxradio.js | 2 +- ui/widgets/dialog.js | 16 +++------------ ui/widgets/draggable.js | 6 ++---- ui/widgets/menu.js | 5 ++--- ui/widgets/mouse.js | 42 +++++++++++++-------------------------- ui/widgets/resizable.js | 7 +------ ui/widgets/selectmenu.js | 43 +++++++--------------------------------- ui/widgets/sortable.js | 16 ++++----------- ui/widgets/spinner.js | 29 +++------------------------ ui/widgets/tabs.js | 20 ++----------------- ui/widgets/tooltip.js | 31 ++++++++++++----------------- 23 files changed, 71 insertions(+), 370 deletions(-) delete mode 100644 ui/form.js delete mode 100644 ui/ie.js delete mode 100644 ui/safe-active-element.js delete mode 100644 ui/safe-blur.js (limited to 'ui') diff --git a/ui/core.js b/ui/core.js index 862851391..33d7974e2 100644 --- a/ui/core.js +++ b/ui/core.js @@ -7,14 +7,10 @@ define( [ "./data", "./disable-selection", "./focusable", - "./form", - "./ie", "./keycode", "./labels", "./jquery-patch", "./plugin", - "./safe-active-element", - "./safe-blur", "./scroll-parent", "./tabbable", "./unique-id", diff --git a/ui/effect.js b/ui/effect.js index ac9b0c809..bbbb733c3 100644 --- a/ui/effect.js +++ b/ui/effect.js @@ -81,26 +81,14 @@ function camelCase( string ) { function getElementStyles( elem ) { var key, len, - style = elem.ownerDocument.defaultView ? - elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : - elem.currentStyle, + style = elem.ownerDocument.defaultView.getComputedStyle( elem ), styles = {}; - if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { - len = style.length; - while ( len-- ) { - key = style[ len ]; - if ( typeof style[ key ] === "string" ) { - styles[ camelCase( key ) ] = style[ key ]; - } - } - - // Support: Opera, IE <9 - } else { - for ( key in style ) { - if ( typeof style[ key ] === "string" ) { - styles[ key ] = style[ key ]; - } + len = style.length; + while ( len-- ) { + key = style[ len ]; + if ( typeof style[ key ] === "string" ) { + styles[ camelCase( key ) ] = style[ key ]; } } diff --git a/ui/focusable.js b/ui/focusable.js index 2db058678..4920417fc 100644 --- a/ui/focusable.js +++ b/ui/focusable.js @@ -62,20 +62,10 @@ $.ui.focusable = function( element, hasTabindex ) { focusableIfVisible = hasTabindex; } - return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) ); + return focusableIfVisible && $( element ).is( ":visible" ) && + $( element ).css( "visibility" ) === "visible"; }; -// Support: IE 8 only -// IE 8 doesn't resolve inherit to visible/hidden for computed values -function visible( element ) { - var visibility = element.css( "visibility" ); - while ( visibility === "inherit" ) { - element = element.parent(); - visibility = element.css( "visibility" ); - } - return visibility === "visible"; -} - $.extend( $.expr.pseudos, { focusable: function( element ) { return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); diff --git a/ui/form-reset-mixin.js b/ui/form-reset-mixin.js index a60299d13..9a2e73aac 100644 --- a/ui/form-reset-mixin.js +++ b/ui/form-reset-mixin.js @@ -20,7 +20,6 @@ // AMD. Register as an anonymous module. define( [ "jquery", - "./form", "./version" ], factory ); } else { @@ -45,7 +44,7 @@ return $.ui.formResetMixin = { }, _bindFormResetHandler: function() { - this.form = this.element._form(); + this.form = $( this.element.prop( "form" ) ); if ( !this.form.length ) { return; } diff --git a/ui/form.js b/ui/form.js deleted file mode 100644 index 60b052277..000000000 --- a/ui/form.js +++ /dev/null @@ -1,23 +0,0 @@ -( function( factory ) { - "use strict"; - - if ( typeof define === "function" && define.amd ) { - - // AMD. Register as an anonymous module. - define( [ "jquery", "./version" ], factory ); - } else { - - // Browser globals - factory( jQuery ); - } -} )( function( $ ) { -"use strict"; - -// Support: IE8 Only -// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop -// with a string, so we need to find the proper form. -return $.fn._form = function() { - return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form ); -}; - -} ); diff --git a/ui/ie.js b/ui/ie.js deleted file mode 100644 index 1754b94a9..000000000 --- a/ui/ie.js +++ /dev/null @@ -1,18 +0,0 @@ -( function( factory ) { - "use strict"; - - if ( typeof define === "function" && define.amd ) { - - // AMD. Register as an anonymous module. - define( [ "jquery", "./version" ], factory ); - } else { - - // Browser globals - factory( jQuery ); - } -} )( function( $ ) { -"use strict"; - -// This file is deprecated -return $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); -} ); diff --git a/ui/labels.js b/ui/labels.js index 9f1c3296b..4f6533451 100644 --- a/ui/labels.js +++ b/ui/labels.js @@ -39,9 +39,8 @@ return $.fn.labels = function() { return this.pushStack( this[ 0 ].labels ); } - // Support: IE <= 11, FF <= 37, Android <= 2.3 only - // Above browsers do not support control.labels. Everything below is to support them - // as well as document fragments. control.labels does not work on document fragments + // If `control.labels` is empty - e.g. inside of document fragments - find + // the labels manually labels = this.eq( 0 ).parents( "label" ); // Look for the label based on the id diff --git a/ui/safe-active-element.js b/ui/safe-active-element.js deleted file mode 100644 index 9d6968e08..000000000 --- a/ui/safe-active-element.js +++ /dev/null @@ -1,44 +0,0 @@ -( function( factory ) { - "use strict"; - - if ( typeof define === "function" && define.amd ) { - - // AMD. Register as an anonymous module. - define( [ "jquery", "./version" ], factory ); - } else { - - // Browser globals - factory( jQuery ); - } -} )( function( $ ) { -"use strict"; - -return $.ui.safeActiveElement = function( document ) { - var activeElement; - - // Support: IE 9 only - // IE9 throws an "Unspecified error" accessing document.activeElement from an