@@ -613,18 +613,56 @@ QUnit.test( "attributes - special characters", function( assert ) {
613613 "Long numeric escape (non-BMP)" ) ;
614614} ) ;
615615
616- QUnit . test ( "attributes" , function ( assert ) {
617- assert . expect ( 16 ) ;
616+ QUnit . test ( "attributes - others " , function ( assert ) {
617+ assert . expect ( 10 ) ;
618618
619- var div ;
619+ var div = document . getElementById ( "foo" ) ;
620620
621621 assert . t ( "Find elements with a tabindex attribute" , "[tabindex]" , [ "listWithTabIndex" , "foodWithNegativeTabIndex" , "linkWithTabIndex" , "linkWithNegativeTabIndex" , "linkWithNoHrefWithTabIndex" , "linkWithNoHrefWithNegativeTabIndex" ] ) ;
622622
623- assert . t ( "Multiple Attribute Equals" , "#form input[type='radio'], #form input[type='hidden']" , [ "radio1" , "radio2" , "hidden1" ] ) ;
624- assert . t ( "Multiple Attribute Equals" , "#form input[type='radio'], #form input[type=\"hidden\"]" , [ "radio1" , "radio2" , "hidden1" ] ) ;
625- assert . t ( "Multiple Attribute Equals" , "#form input[type='radio'], #form input[type=hidden]" , [ "radio1" , "radio2" , "hidden1" ] ) ;
623+ assert . t ( "Selector list with multiple quoted attribute-equals" ,
624+ "#form input[type='radio'], #form input[type='hidden']" ,
625+ [ "radio1" , "radio2" , "hidden1" ] ) ;
626+ assert . t ( "Selector list with differently-quoted attribute-equals" ,
627+ "#form input[type='radio'], #form input[type=\"hidden\"]" ,
628+ [ "radio1" , "radio2" , "hidden1" ] ) ;
629+ assert . t ( "Selector list with quoted and unquoted attribute-equals" ,
630+ "#form input[type='radio'], #form input[type=hidden]" ,
631+ [ "radio1" , "radio2" , "hidden1" ] ) ;
632+
633+ assert . t ( "Object.prototype property \"constructor\" (negative)" , "[constructor]" , [ ] ) ;
634+ assert . t ( "Gecko Object.prototype property \"watch\" (negative)" , "[watch]" , [ ] ) ;
635+ div . setAttribute ( "constructor" , "foo" ) ;
636+ div . setAttribute ( "watch" , "bar" ) ;
637+ assert . t ( "Object.prototype property \"constructor\"" , "[constructor='foo']" , [ "foo" ] ) ;
638+ assert . t ( "Gecko Object.prototype property \"watch\"" , "[watch='bar']" , [ "foo" ] ) ;
639+
640+ // #11115
641+ assert . ok ( jQuery ( "<input type='checkbox' checked='checked'/>" ) . prop ( "checked" , false ) . is ( "[checked]" ) ,
642+ "[checked] selects by attribute (positive)"
643+ ) ;
644+ assert . ok ( ! jQuery ( "<input type='checkbox'/>" ) . prop ( "checked" , true ) . is ( "[checked]" ) ,
645+ "[checked] selects by attribute (negative)"
646+ ) ;
647+ } ) ;
648+
649+ QUnit . test ( "pseudo - form" , function ( assert ) {
650+ assert . expect ( 16 ) ;
651+
652+ var extraTexts = jQuery ( "<input id=\"impliedText\"/><input id=\"capitalText\" type=\"TEXT\">" ) . appendTo ( "#form" ) ;
653+
654+ assert . t ( "Form element :radio" , "#form :radio" , [ "radio1" , "radio2" ] ) ;
655+ assert . t ( "Form element :checkbox" , "#form :checkbox" , [ "check1" , "check2" ] ) ;
656+ assert . t ( "Form element :text" , "#form :text" , [ "text1" , "text2" , "hidden2" , "name" , "impliedText" , "capitalText" ] ) ;
657+ assert . t ( "Form element :radio:checked" , "#form :radio:checked" , [ "radio2" ] ) ;
658+ assert . t ( "Form element :checkbox:checked" , "#form :checkbox:checked" , [ "check1" ] ) ;
659+ assert . t ( "Form element :radio:checked, :checkbox:checked" , "#form :radio:checked, #form :checkbox:checked" , [ "radio2" , "check1" ] ) ;
626660
627661 if ( jQuery . find . compile ) {
662+ assert . t ( "Selected option element" ,
663+ "#form option:selected" ,
664+ [ "option1a" , "option2d" , "option3b" , "option3c" , "option4b" , "option4c" , "option4d" ,
665+ "option5a" ] ) ;
628666 assert . t ( "Select options via :selected" , "#select1 option:selected" , [ "option1a" ] ) ;
629667 assert . t ( "Select options via :selected" , "#select2 option:selected" , [ "option2d" ] ) ;
630668 assert . t ( "Select options via :selected" , "#select3 option:selected" , [ "option3b" , "option3c" ] ) ;
@@ -634,23 +672,17 @@ QUnit.test( "attributes", function( assert ) {
634672 assert . ok ( "skip" , ":selected not supported in selector-native" ) ;
635673 assert . ok ( "skip" , ":selected not supported in selector-native" ) ;
636674 assert . ok ( "skip" , ":selected not supported in selector-native" ) ;
675+ assert . ok ( "skip" , ":selected not supported in selector-native" ) ;
637676 }
638677
639- div = document . getElementById ( "foo" ) ;
640- assert . t ( "Object.prototype property \"constructor\" (negative)" , "[constructor]" , [ ] ) ;
641- assert . t ( "Gecko Object.prototype property \"watch\" (negative)" , "[watch]" , [ ] ) ;
642- div . setAttribute ( "constructor" , "foo" ) ;
643- div . setAttribute ( "watch" , "bar" ) ;
644- assert . t ( "Object.prototype property \"constructor\"" , "[constructor='foo']" , [ "foo" ] ) ;
645- assert . t ( "Gecko Object.prototype property \"watch\"" , "[watch='bar']" , [ "foo" ] ) ;
646-
647678 if ( jQuery . find . compile ) {
679+ assert . t ( "Form element :input" , "#form :input" , [ "text1" , "text2" , "radio1" , "radio2" , "check1" , "check2" , "hidden1" , "hidden2" , "name" , "search" , "button" , "area1" , "select1" , "select2" , "select3" , "select4" , "select5" , "impliedText" , "capitalText" ] ) ;
648680
649- // # 12600
681+ // trac- 12600
650682 assert . ok (
651683 jQuery ( "<select value='12600'><option value='option' selected='selected'></option><option value=''></option></select>" )
652- . prop ( "value" , "option" )
653- . is ( ":input[value='12600']" ) ,
684+ . prop ( "value" , "option" )
685+ . is ( ":input[value='12600']" ) ,
654686
655687 ":input[value=foo] selects select by attribute"
656688 ) ;
@@ -660,16 +692,17 @@ QUnit.test( "attributes", function( assert ) {
660692 } else {
661693 assert . ok ( "skip" , ":input not supported in selector-native" ) ;
662694 assert . ok ( "skip" , ":input not supported in selector-native" ) ;
695+ assert . ok ( "skip" , ":input not supported in selector-native" ) ;
663696 }
664697
698+ assert . t ( "Selected option elements are also :checked" , "#form option:checked" ,
699+ [ "option1a" , "option2d" , "option3b" , "option3c" , "option4b" , "option4c" , "option4d" ,
700+ "option5a" ] ) ;
701+ assert . t ( "Hidden inputs are still :enabled" ,
702+ "#hidden1:enabled" ,
703+ [ "hidden1" ] ) ;
665704
666- // #11115
667- assert . ok ( jQuery ( "<input type='checkbox' checked='checked'/>" ) . prop ( "checked" , false ) . is ( "[checked]" ) ,
668- "[checked] selects by attribute (positive)"
669- ) ;
670- assert . ok ( ! jQuery ( "<input type='checkbox'/>" ) . prop ( "checked" , true ) . is ( "[checked]" ) ,
671- "[checked] selects by attribute (negative)"
672- ) ;
705+ extraTexts . remove ( ) ;
673706} ) ;
674707
675708QUnit . test ( "disconnected nodes" , function ( assert ) {
0 commit comments