From 3ba396e439a07c2a2facafbe07cdaa1b80a24c00 Mon Sep 17 00:00:00 2001 From: John Resig Date: Tue, 10 May 2011 13:36:38 -0400 Subject: [PATCH] Tweak :submit/:reset tests to work against injected HTML. --- test/unit/selector.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/test/unit/selector.js b/test/unit/selector.js index 9d3877dc..cead99e3 100644 --- a/test/unit/selector.js +++ b/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( + "".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 ); });