No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

88 líneas
2.2 KiB

  1. /*!
  2. * jQuery UI Focusable 1.13.1
  3. * http://jqueryui.com
  4. *
  5. * Copyright jQuery Foundation and other contributors
  6. * Released under the MIT license.
  7. * http://jquery.org/license
  8. */
  9. //>>label: :focusable Selector
  10. //>>group: Core
  11. //>>description: Selects elements which can be focused.
  12. //>>docs: http://api.jqueryui.com/focusable-selector/
  13. ( function( factory ) {
  14. "use strict";
  15. if ( typeof define === "function" && define.amd ) {
  16. // AMD. Register as an anonymous module.
  17. define( [ "jquery", "./version" ], factory );
  18. } else {
  19. // Browser globals
  20. factory( jQuery );
  21. }
  22. } )( function( $ ) {
  23. "use strict";
  24. // Selectors
  25. $.ui.focusable = function( element, hasTabindex ) {
  26. var map, mapName, img, focusableIfVisible, fieldset,
  27. nodeName = element.nodeName.toLowerCase();
  28. if ( "area" === nodeName ) {
  29. map = element.parentNode;
  30. mapName = map.name;
  31. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  32. return false;
  33. }
  34. img = $( "img[usemap='#" + mapName + "']" );
  35. return img.length > 0 && img.is( ":visible" );
  36. }
  37. if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) {
  38. focusableIfVisible = !element.disabled;
  39. if ( focusableIfVisible ) {
  40. // Form controls within a disabled fieldset are disabled.
  41. // However, controls within the fieldset's legend do not get disabled.
  42. // Since controls generally aren't placed inside legends, we skip
  43. // this portion of the check.
  44. fieldset = $( element ).closest( "fieldset" )[ 0 ];
  45. if ( fieldset ) {
  46. focusableIfVisible = !fieldset.disabled;
  47. }
  48. }
  49. } else if ( "a" === nodeName ) {
  50. focusableIfVisible = element.href || hasTabindex;
  51. } else {
  52. focusableIfVisible = hasTabindex;
  53. }
  54. return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) );
  55. };
  56. // Support: IE 8 only
  57. // IE 8 doesn't resolve inherit to visible/hidden for computed values
  58. function visible( element ) {
  59. var visibility = element.css( "visibility" );
  60. while ( visibility === "inherit" ) {
  61. element = element.parent();
  62. visibility = element.css( "visibility" );
  63. }
  64. return visibility === "visible";
  65. }
  66. $.extend( $.expr.pseudos, {
  67. focusable: function( element ) {
  68. return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
  69. }
  70. } );
  71. return $.ui.focusable;
  72. } );