Ticket #3649: tabindex.patch
File tabindex.patch, 4.4 KB (added by , 14 years ago) |
---|
-
Users/sgonzale/Documents/workspace/jQuery/src/core.js
970 970 if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) 971 971 return elem.getAttributeNode( name ).nodeValue; 972 972 973 if ( name == jQuery.props.tabindex ) { 974 var attributeNode = elem.getAttributeNode(jQuery.props.tabindex); 975 return attributeNode && attributeNode.specified && attributeNode.value || undefined; 976 } 977 973 978 return elem[ name ]; 974 979 } 975 980 -
Users/sgonzale/Documents/workspace/jQuery/src/support.js
51 51 // (IE uses styleFloat instead of cssFloat) 52 52 cssFloat: !!a.style.cssFloat, 53 53 54 tabindex: !a.getAttributeNode('tabindex'), 55 54 56 // Will be defined later 55 57 scriptEval: false, 56 58 noCloneEvent: true … … 96 98 readonly: "readOnly", 97 99 maxlength: "maxLength", 98 100 cellspacing: "cellSpacing", 99 rowspan: "rowSpan" 101 rowspan: "rowSpan", 102 tabindex: jQuery.support.tabindex ? "tabindex" : "tabIndex" 100 103 }; -
Users/sgonzale/Documents/workspace/jQuery/test/index.html
195 195 <div><div class="hidden">hidden</div></div> 196 196 </div> 197 197 </div> 198 199 <h1>Food</h1> 200 <ol id="listWithTabIndex" tabindex="0"> 201 <li id="foodWithNegativeTabIndex" tabindex="-1">Rice</li> 202 <li id="foodNoTabIndex">Beans</li> 203 <li>Blinis</li> 204 <li>Tofu</li> 205 </ol> 206 207 <h2 id="headingWithNoTabIndex">I'm hungry. I should...</h2> 208 <a href="#" id="linkWithNoTabIndex">Eat lots of food</a> | 209 <a href="#" id="linkWithTabIndex" tabindex="2">Eat a little food</a> | 210 <a href="#" id="linkWithNegativeTabIndex" tabindex="-1">Eat no food</a> 198 211 </div> 199 212 </dl> 200 213 -
Users/sgonzale/Documents/workspace/jQuery/test/unit/core.js
545 545 }); 546 546 } 547 547 548 test("attr('tabindex')", function() { 549 expect(5); 550 551 // tabindex 0 552 equals(jQuery('#listWithTabIndex').attr('tabindex'), 0, 'tabindex of 0'); 553 554 // positive tabindex 555 equals(jQuery('#linkWithTabIndex').attr('tabindex'), 2, 'tabindex of 2'); 556 557 // negative tabindex 558 equals(jQuery('#linkWithNegativeTabIndex').attr('tabindex'), -1, 'negative tabindex'); 559 560 // regular element without a tabindex 561 equals(jQuery('#headingWithNoTabIndex').attr('tabindex'), undefined, 'no tabindex, not tabbable by default'); 562 563 // link without a tabindex 564 equals(jQuery('#linkWithNoTabIndex').attr('tabindex'), undefined, 'no tabindex, tabbable by default'); 565 }); 566 567 test("attr('tabindex', value)", function() { 568 expect(9); 569 570 var element = jQuery('#headingWithNoTabIndex'); 571 equals(element.attr('tabindex'), undefined, 'start with no tabindex'); 572 573 // set a positive string 574 element.attr('tabindex', '1'); 575 equals(element.attr('tabindex'), 1, 'set tabindex to 1 (string)'); 576 577 // set a zero string 578 element.attr('tabindex', '0'); 579 equals(element.attr('tabindex'), 0, 'set tabindex to 0 (string)'); 580 581 // set a negative string 582 element.attr('tabindex', '-1'); 583 equals(element.attr('tabindex'), -1, 'set tabindex to -1 (string)'); 584 585 // set a positive number 586 element.attr('tabindex', 1); 587 equals(element.attr('tabindex'), 1, 'set tabindex to 1 (number)'); 588 589 // set a zero number 590 element.attr('tabindex', 0); 591 equals(element.attr('tabindex'), 0, 'set tabindex to 0 (number)'); 592 593 // set a negative number 594 element.attr('tabindex', -1); 595 equals(element.attr('tabindex'), -1, 'set tabindex to -1 (number)'); 596 597 element = jQuery('#linkWithTabIndex'); 598 equals(element.attr('tabindex'), 2, 'start with tabindex 2'); 599 600 element.attr('tabindex', -1); 601 equals(element.attr('tabindex'), -1, 'set negative tabindex'); 602 }); 603 548 604 test("css(String|Hash)", function() { 549 605 expect(19); 550 606