Skip to content
Permalink
Browse files

Added test for passing null to .show()

  • Loading branch information
Scott Gonzalez authored and jeresig committed Nov 12, 2009
1 parent 9cd5866 commit 8cb8ae27d8e0c732b711d73d2ef71125b0a7769b
Showing with 7 additions and 1 deletion.
  1. +7 −1 test/unit/fx.js
@@ -1,13 +1,19 @@
module("fx");

test("show()", function() {
expect(15);
expect(16);
var pass = true, div = jQuery("#main div");
div.show().each(function(){
if ( this.style.display == "none" ) pass = false;
});
ok( pass, "Show" );

pass = true;
div.hide().show(null).each(function() {
if ( this.style.display == "none" ) pass = false;
});
ok( pass, "Show will null speed");

jQuery("#main").append('<div id="show-tests"><div><p><a href="#"></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div>');

var old = jQuery("#show-tests table").show().css("display") !== "table";

3 comments on commit 8cb8ae2

@DBJDBJ

This comment has been minimized.

Copy link

DBJDBJ replied Nov 13, 2009

There are jokers who pass number to $(). For some devious reasons. Can/should we add :

if ( "number" === typeof arguments[0] ) return ;

Into the $(), itself ?

@jeresig

This comment has been minimized.

Copy link
Member

jeresig replied Nov 13, 2009

No? I mean, otherwise we would be checking for every possible input and that doesn't really make much sense - I mean if someone wants to try and use jQuery in a non-standard way, we shouldn't really stop them (unless it's in an unintended way - such as passing in a null or undefined).

@DBJDBJ

This comment has been minimized.

Copy link

DBJDBJ replied Nov 14, 2009

OK

Please sign in to comment.
You can’t perform that action at this time.