Core: Move tabbable into its own module

Ref #9647
This commit is contained in:
Alexander Schmitz 2015-07-15 20:20:41 -04:00
parent 26fc3b5587
commit 6064a5e048
4 changed files with 41 additions and 11 deletions

View File

@ -1,8 +1,9 @@
define( [ define( [
"jquery", "jquery",
"ui/core",
"ui/data", "ui/data",
"ui/focusable" "ui/escape-selector",
"ui/focusable",
"ui/tabbable"
], function( $ ) { ], function( $ ) {
module( "core - selectors" ); module( "core - selectors" );

View File

@ -31,6 +31,7 @@
"./plugin", "./plugin",
"./safe-active-element", "./safe-active-element",
"./safe-blur", "./safe-blur",
"./tabbable",
"./version" "./version"
], factory ); ], factory );
} else { } else {
@ -78,12 +79,4 @@ $.fn.extend( {
} }
} ); } );
$.extend( $.expr[ ":" ], {
tabbable: function( element ) {
var tabIndex = $.attr( element, "tabindex" ),
hasTabindex = tabIndex != null;
return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );
}
} );
} ) ); } ) );

View File

@ -32,7 +32,8 @@
"./position", "./position",
"./resizable", "./resizable",
"./safe-active-element", "./safe-active-element",
"./safe-blur" "./safe-blur",
"./tabbable"
], factory ); ], factory );
} else { } else {

35
ui/tabbable.js Normal file
View File

@ -0,0 +1,35 @@
/*!
* jQuery UI Tabbable @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: focusable
//>>group: Core
//>>description: Selects elements which can be tabbed to.
//>>docs: http://api.jqueryui.com/tabbable-selector/
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version", "./focusable" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} ( function( $ ) {
return $.extend( $.expr[ ":" ], {
tabbable: function( element ) {
var tabIndex = $.attr( element, "tabindex" ),
hasTabindex = tabIndex != null;
return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );
}
} );
} ) );