Commit 3e2a77c5 authored by timmywil's avatar timmywil

Remove the tabindex attrHook. Fixes #8473

parent f313384b
...@@ -494,9 +494,6 @@ jQuery.extend({ ...@@ -494,9 +494,6 @@ jQuery.extend({
} }
}); });
// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
// Hook for boolean attributes // Hook for boolean attributes
boolHook = { boolHook = {
get: function( elem, name ) { get: function( elem, name ) {
...@@ -558,9 +555,6 @@ if ( !getSetAttribute ) { ...@@ -558,9 +555,6 @@ if ( !getSetAttribute ) {
} }
}; };
// Apply the nodeHook to tabindex
jQuery.attrHooks.tabindex.set = nodeHook.set;
// Set width and height to auto instead of 0 on empty string( Bug #8150 ) // Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals // This is for removals
jQuery.each([ "width", "height" ], function( i, name ) { jQuery.each([ "width", "height" ], function( i, name ) {
......
...@@ -399,7 +399,7 @@ test("attr(jquery_method)", function(){ ...@@ -399,7 +399,7 @@ test("attr(jquery_method)", function(){
}); });
test("attr(String, Object) - Loaded via XML document", function() { test("attr(String, Object) - Loaded via XML document", function() {
expect(2); expect( 2 );
var xml = createDashboardXML(); var xml = createDashboardXML();
var titles = []; var titles = [];
jQuery( "tab", xml ).each(function() { jQuery( "tab", xml ).each(function() {
...@@ -410,44 +410,44 @@ test("attr(String, Object) - Loaded via XML document", function() { ...@@ -410,44 +410,44 @@ test("attr(String, Object) - Loaded via XML document", function() {
}); });
test("attr('tabindex')", function() { test("attr('tabindex')", function() {
expect(8); expect( 8 );
// elements not natively tabbable // elements not natively tabbable
equal(jQuery("#listWithTabIndex").attr("tabindex"), 5, "not natively tabbable, with tabindex set to 0"); equal( jQuery("#listWithTabIndex").attr("tabindex"), 5, "not natively tabbable, with tabindex set to 0" );
equal(jQuery("#divWithNoTabIndex").attr("tabindex"), undefined, "not natively tabbable, no tabindex set"); equal( jQuery("#divWithNoTabIndex").attr("tabindex"), undefined, "not natively tabbable, no tabindex set" );
// anchor with href // anchor with href
equal(jQuery("#linkWithNoTabIndex").attr("tabindex"), 0, "anchor with href, no tabindex set"); equal( jQuery("#linkWithNoTabIndex").attr("tabindex"), undefined, "anchor with href, no tabindex set" );
equal(jQuery("#linkWithTabIndex").attr("tabindex"), 2, "anchor with href, tabindex set to 2"); equal( jQuery("#linkWithTabIndex").attr("tabindex"), 2, "anchor with href, tabindex set to 2" );
equal(jQuery("#linkWithNegativeTabIndex").attr("tabindex"), -1, "anchor with href, tabindex set to -1"); equal( jQuery("#linkWithNegativeTabIndex").attr("tabindex"), -1, "anchor with href, tabindex set to -1" );
// anchor without href // anchor without href
equal(jQuery("#linkWithNoHrefWithNoTabIndex").attr("tabindex"), undefined, "anchor without href, no tabindex set"); equal( jQuery("#linkWithNoHrefWithNoTabIndex").attr("tabindex"), undefined, "anchor without href, no tabindex set" );
equal(jQuery("#linkWithNoHrefWithTabIndex").attr("tabindex"), 1, "anchor without href, tabindex set to 2"); equal( jQuery("#linkWithNoHrefWithTabIndex").attr("tabindex"), 1, "anchor without href, tabindex set to 2" );
equal(jQuery("#linkWithNoHrefWithNegativeTabIndex").attr("tabindex"), -1, "anchor without href, no tabindex set"); equal( jQuery("#linkWithNoHrefWithNegativeTabIndex").attr("tabindex"), -1, "anchor without href, no tabindex set" );
}); });
test("attr('tabindex', value)", function() { test("attr('tabindex', value)", function() {
expect(9); expect( 9 );
var element = jQuery("#divWithNoTabIndex"); var element = jQuery("#divWithNoTabIndex");
equal(element.attr("tabindex"), undefined, "start with no tabindex"); equal( element.attr("tabindex"), undefined, "start with no tabindex" );
// set a positive string // set a positive string
element.attr("tabindex", "1"); element.attr("tabindex", "1");
equal(element.attr("tabindex"), 1, "set tabindex to 1 (string)"); equal( element.attr("tabindex"), 1, "set tabindex to 1 (string)" );
// set a zero string // set a zero string
element.attr("tabindex", "0"); element.attr("tabindex", "0");
equal(element.attr("tabindex"), 0, "set tabindex to 0 (string)"); equal( element.attr("tabindex"), 0, "set tabindex to 0 (string)" );
// set a negative string // set a negative string
element.attr("tabindex", "-1"); element.attr("tabindex", "-1");
equal(element.attr("tabindex"), -1, "set tabindex to -1 (string)"); equal( element.attr("tabindex"), -1, "set tabindex to -1 (string)" );
// set a positive number // set a positive number
element.attr("tabindex", 1); element.attr("tabindex", 1);
equal(element.attr("tabindex"), 1, "set tabindex to 1 (number)"); equal( element.attr("tabindex"), 1, "set tabindex to 1 (number)" );
// set a zero number // set a zero number
element.attr("tabindex", 0); element.attr("tabindex", 0);
...@@ -455,13 +455,13 @@ test("attr('tabindex', value)", function() { ...@@ -455,13 +455,13 @@ test("attr('tabindex', value)", function() {
// set a negative number // set a negative number
element.attr("tabindex", -1); element.attr("tabindex", -1);
equal(element.attr("tabindex"), -1, "set tabindex to -1 (number)"); equal( element.attr("tabindex"), -1, "set tabindex to -1 (number)" );
element = jQuery("#linkWithTabIndex"); element = jQuery("#linkWithTabIndex");
equal(element.attr("tabindex"), 2, "start with tabindex 2"); equal( element.attr("tabindex"), 2, "start with tabindex 2" );
element.attr("tabindex", -1); element.attr("tabindex", -1);
equal(element.attr("tabindex"), -1, "set negative tabindex"); equal( element.attr("tabindex"), -1, "set negative tabindex" );
}); });
test("removeAttr(String)", function() { test("removeAttr(String)", function() {
......
...@@ -28,8 +28,14 @@ test("class - jQuery only", function() { ...@@ -28,8 +28,14 @@ test("class - jQuery only", function() {
deepEqual( jQuery("p").find(".blog").get(), q("mark", "simon"), "Finding elements with a context." ); deepEqual( jQuery("p").find(".blog").get(), q("mark", "simon"), "Finding elements with a context." );
}); });
test("attributes - jQuery only", function() {
expect( 1 );
t( "Find elements with a tabindex attribute", "[tabindex]", ["listWithTabIndex", "foodWithNegativeTabIndex", "linkWithTabIndex", "linkWithNegativeTabIndex", "linkWithNoHrefWithTabIndex", "linkWithNoHrefWithNegativeTabIndex"] );
});
test("pseudo - visibility", function() { test("pseudo - visibility", function() {
expect(9); expect( 9 );
t( "Is Visible", "div:visible:not(#qunit-testrunner-toolbar):lt(2)", ["nothiddendiv", "nothiddendivchild"] ); t( "Is Visible", "div:visible:not(#qunit-testrunner-toolbar):lt(2)", ["nothiddendiv", "nothiddendivchild"] );
t( "Is Not Hidden", "#qunit-fixture:hidden", [] ); t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
...@@ -50,7 +56,7 @@ test("pseudo - visibility", function() { ...@@ -50,7 +56,7 @@ test("pseudo - visibility", function() {
}); });
test("disconnected nodes", function() { test("disconnected nodes", function() {
expect(4); expect( 4 );
var $opt = jQuery('<option></option>').attr("value", "whipit").appendTo("#qunit-fixture").detach(); var $opt = jQuery('<option></option>').attr("value", "whipit").appendTo("#qunit-fixture").detach();
equal( $opt.val(), "whipit", "option value" ); equal( $opt.val(), "whipit", "option value" );
equal( $opt.is(":selected"), false, "unselected option" ); equal( $opt.is(":selected"), false, "unselected option" );
...@@ -62,7 +68,7 @@ test("disconnected nodes", function() { ...@@ -62,7 +68,7 @@ test("disconnected nodes", function() {
}); });
testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQuery, window, document ) { testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQuery, window, document ) {
expect(35); expect( 35 );
/** /**
* Returns an array of elements with the given IDs * Returns an array of elements with the given IDs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment