Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tweak :submit/:reset tests to work against injected HTML.

  • Loading branch information...
commit 3ba396e439a07c2a2facafbe07cdaa1b80a24c00 1 parent 4817214
@jeresig jeresig authored
Showing with 4 additions and 11 deletions.
  1. +4 −11 test/unit/selector.js
View
15 test/unit/selector.js
@@ -425,20 +425,13 @@ test("pseudo - misc", function() {
document.body.appendChild( tmp );
jQuery.each( [ "button", "submit", "reset" ], function( i, type ) {
- var input = document.createElement( "input" );
- input.id = "input_" + type;
- input.setAttribute( "type", type );
- tmp.appendChild( input );
-
- var button = document.createElement( "button" );
- button.id = "button_" + type;
- button.setAttribute( "type", type );
- tmp.appendChild( button );
+ jQuery( tmp ).append(
+ "<input id='input_T' type='T'/><button id='button_T' type='T'>test</button>".replace(/T/g, type) );
t( "Input Buttons :" + type, "#tmp_input :" + type, [ "input_" + type, "button_" + type ] );
- ok( (window.Sizzle || window.jQuery.find).matchesSelector( input, ":" + type ), "Input Matches :" + type );
- ok( (window.Sizzle || window.jQuery.find).matchesSelector( button, ":" + type ), "Button Matches :" + type );
+ ok( (window.Sizzle || window.jQuery.find).matchesSelector( jQuery("#input_" + type)[0], ":" + type ), "Input Matches :" + type );
+ ok( (window.Sizzle || window.jQuery.find).matchesSelector( jQuery("#button_" + type)[0], ":" + type ), "Button Matches :" + type );
});
Please sign in to comment.
Something went wrong with that request. Please try again.