Skip to content

Commit f9ef91d

Browse files
mikesherovdmethvin
authored andcommitted
Fix #10943, tabindex not set properly on clone in IE7. Close jquerygh-937.
This is only a unit test fix because the bug was tangentially fixed by a different commit
1 parent c3b1367 commit f9ef91d

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

test/unit/attributes.js

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -654,41 +654,46 @@ test("prop('tabindex')", function() {
654654
equal(jQuery("#linkWithNoHrefWithNegativeTabIndex").prop("tabindex"), -1, "anchor without href, no tabindex set");
655655
});
656656

657-
test("prop('tabindex', value)", function() {
658-
expect(9);
657+
test("prop('tabindex', value)", 10, function() {
658+
659+
var element = jQuery("#divWithNoTabIndex"),
660+
clone;
659661

660-
var element = jQuery("#divWithNoTabIndex");
661662
equal(element.prop("tabindex"), undefined, "start with no tabindex");
662663

663664
// set a positive string
664-
element.prop("tabindex", "1");
665-
equal(element.prop("tabindex"), 1, "set tabindex to 1 (string)");
665+
element.prop( "tabindex", "1" );
666+
equal( element.prop("tabindex"), 1, "set tabindex to 1 (string)" );
666667

667668
// set a zero string
668-
element.prop("tabindex", "0");
669-
equal(element.prop("tabindex"), 0, "set tabindex to 0 (string)");
669+
element.prop( "tabindex", "0" );
670+
equal( element.prop("tabindex"), 0, "set tabindex to 0 (string)" );
670671

671672
// set a negative string
672-
element.prop("tabindex", "-1");
673-
equal(element.prop("tabindex"), -1, "set tabindex to -1 (string)");
673+
element.prop( "tabindex", "-1" );
674+
equal( element.prop("tabindex"), -1, "set tabindex to -1 (string)" );
674675

675676
// set a positive number
676-
element.prop("tabindex", 1);
677-
equal(element.prop("tabindex"), 1, "set tabindex to 1 (number)");
677+
element.prop( "tabindex", 1 );
678+
equal( element.prop("tabindex"), 1, "set tabindex to 1 (number)" );
678679

679680
// set a zero number
680-
element.prop("tabindex", 0);
681-
equal(element.prop("tabindex"), 0, "set tabindex to 0 (number)");
681+
element.prop( "tabindex", 0 );
682+
equal( element.prop("tabindex"), 0, "set tabindex to 0 (number)" );
682683

683684
// set a negative number
684-
element.prop("tabindex", -1);
685-
equal(element.prop("tabindex"), -1, "set tabindex to -1 (number)");
685+
element.prop( "tabindex", -1 );
686+
equal( element.prop("tabindex"), -1, "set tabindex to -1 (number)" );
686687

687688
element = jQuery("#linkWithTabIndex");
688-
equal(element.prop("tabindex"), 2, "start with tabindex 2");
689+
equal( element.prop("tabindex"), 2, "start with tabindex 2" );
690+
691+
element.prop( "tabindex", -1 );
692+
equal( element.prop("tabindex"), -1, "set negative tabindex" );
689693

690-
element.prop("tabindex", -1);
691-
equal(element.prop("tabindex"), -1, "set negative tabindex");
694+
clone = element.clone();
695+
clone.prop( "tabindex", 1 );
696+
equal( clone[ 0 ].getAttribute("tabindex"), 1, "set tabindex on cloned element" );
692697
});
693698

694699
test("removeProp(String)", function() {

0 commit comments

Comments
 (0)