diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-07-15 20:20:41 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-08-08 00:29:37 -0400 |
commit | 6064a5e0487428d53bd694dcebce952730992c46 (patch) | |
tree | ba7ebad41e006e6690dfd270a9a5743a9dbdf7a2 /ui/tabbable.js | |
parent | 26fc3b5587ed117a972224ac661255998e59f9e1 (diff) | |
download | jquery-ui-6064a5e0487428d53bd694dcebce952730992c46.tar.gz jquery-ui-6064a5e0487428d53bd694dcebce952730992c46.zip |
Core: Move tabbable into its own module
Ref #9647
Diffstat (limited to 'ui/tabbable.js')
-rw-r--r-- | ui/tabbable.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ui/tabbable.js b/ui/tabbable.js new file mode 100644 index 000000000..86bebb77b --- /dev/null +++ b/ui/tabbable.js @@ -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 ); + } +} ); + +} ) ); |