jbarnette-johnson 1.0.0.20090127202936 → 1.0.0.20090225110820

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/MANIFEST CHANGED
@@ -157,6 +157,7 @@ vendor/spidermonkey/config/Darwin1.3.mk
157
157
  vendor/spidermonkey/config/Darwin1.4.mk
158
158
  vendor/spidermonkey/config/Darwin5.2.mk
159
159
  vendor/spidermonkey/config/Darwin5.3.mk
160
+ vendor/spidermonkey/config/FreeBSD.mk
160
161
  vendor/spidermonkey/config/HP-UXB.10.10.mk
161
162
  vendor/spidermonkey/config/HP-UXB.10.20.mk
162
163
  vendor/spidermonkey/config/HP-UXB.11.00.mk
data/Rakefile CHANGED
@@ -9,6 +9,7 @@ abort "Need Ruby version 1.8.x!" unless RUBY_VERSION > "1.8"
9
9
  kind = Config::CONFIG["DLEXT"]
10
10
 
11
11
  CROSS = ENV["CROSS"]
12
+ MAKE = ENV["MAKE"] || RUBY_PLATFORM =~ /freebsd/ ? 'gmake' : 'make'
12
13
  LIBJS = FileList["vendor/spidermonkey/#{CROSS || ''}*.OBJ/libjs.{#{kind},so}"].first || :libjs
13
14
 
14
15
  GENERATED_NODE = "ext/spidermonkey/immutable_node.c"
@@ -79,8 +80,8 @@ task :install_expat do
79
80
  `tar -xf xmlparser-0.6.8.tar`
80
81
  Dir.chdir("xmlparser") do
81
82
  puts `#{Gem.ruby} extconf.rb`
82
- puts `make`
83
- puts `sudo make install`
83
+ puts `#{MAKE}`
84
+ puts `sudo #{MAKE} install`
84
85
  end
85
86
  end
86
87
  end
@@ -100,7 +101,7 @@ namespace :extensions do
100
101
  end
101
102
 
102
103
  build_sm = lambda do
103
- cmd = "make -f Makefile.ref"
104
+ cmd = "#{MAKE} -f Makefile.ref"
104
105
  cmd << " OS_CONFIG=#{CROSS}" if CROSS
105
106
  Dir.chdir("vendor/spidermonkey") { sh cmd }
106
107
  end
@@ -126,7 +127,7 @@ file "ext/spidermonkey/spidermonkey.#{kind}" =>
126
127
  ["ext/spidermonkey/Makefile"] + FileList["ext/spidermonkey/*.{c,h}"].to_a do |t|
127
128
 
128
129
  old_time = File.mtime(t.name) rescue nil
129
- Dir.chdir("ext/spidermonkey") { sh "make" }
130
+ Dir.chdir("ext/spidermonkey") { sh "#{MAKE}" }
130
131
 
131
132
  # If make chose not to rebuild the file, we'll touch it, so we don't
132
133
  # bother to call make again next time.
data/johnson.gemspec CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{johnson}
5
- s.version = "1.0.0.20090127202936"
5
+ s.version = "1.0.0.20090225110820"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["John Barnette", "Aaron Patterson", "Yehuda Katz", "Matthew Draper"]
9
- s.date = %q{2009-01-27}
9
+ s.date = %q{2009-02-25}
10
10
  s.default_executable = %q{johnson}
11
11
  s.description = %q{Johnson wraps JavaScript in a loving Ruby embrace.}
12
12
  s.email = %q{johnson-talk@googlegroups.com}
13
13
  s.executables = ["johnson"]
14
14
  s.extensions = ["Rakefile"]
15
15
  s.extra_rdoc_files = ["README.rdoc", "cross-compile.txt"]
16
- s.files = [".autotest", "CHANGELOG", "MANIFEST", "MINGW32.mk", "README.rdoc", "Rakefile", "bin/johnson", "cross-compile.txt", "ext/spidermonkey/context.c", "ext/spidermonkey/context.h", "ext/spidermonkey/conversions.c", "ext/spidermonkey/conversions.h", "ext/spidermonkey/debugger.c", "ext/spidermonkey/debugger.h", "ext/spidermonkey/extconf.rb", "ext/spidermonkey/extensions.c", "ext/spidermonkey/extensions.h", "ext/spidermonkey/global.c", "ext/spidermonkey/global.h", "ext/spidermonkey/idhash.c", "ext/spidermonkey/idhash.h", "ext/spidermonkey/immutable_node.c", "ext/spidermonkey/immutable_node.c.erb", "ext/spidermonkey/immutable_node.h", "ext/spidermonkey/jroot.h", "ext/spidermonkey/js_land_proxy.c", "ext/spidermonkey/js_land_proxy.h", "ext/spidermonkey/ruby_land_proxy.c", "ext/spidermonkey/ruby_land_proxy.h", "ext/spidermonkey/runtime.c", "ext/spidermonkey/runtime.h", "ext/spidermonkey/spidermonkey.c", "ext/spidermonkey/spidermonkey.h", "johnson.gemspec", "js/johnson/browser.js", "js/johnson/browser/env.js", "js/johnson/browser/jquery.js", "js/johnson/browser/xmlsax.js", "js/johnson/browser/xmlw3cdom.js", "js/johnson/cli.js", "js/johnson/prelude.js", "js/johnson/template.js", "lib/hoe.rb", "lib/johnson.rb", "lib/johnson/cli.rb", "lib/johnson/cli/options.rb", "lib/johnson/error.rb", "lib/johnson/nodes.rb", "lib/johnson/nodes/binary_node.rb", "lib/johnson/nodes/for.rb", "lib/johnson/nodes/for_in.rb", "lib/johnson/nodes/function.rb", "lib/johnson/nodes/list.rb", "lib/johnson/nodes/node.rb", "lib/johnson/nodes/ternary_node.rb", "lib/johnson/parser.rb", "lib/johnson/parser/syntax_error.rb", "lib/johnson/runtime.rb", "lib/johnson/spidermonkey/context.rb", "lib/johnson/spidermonkey/debugger.rb", "lib/johnson/spidermonkey/immutable_node.rb", "lib/johnson/spidermonkey/js_land_proxy.rb", "lib/johnson/spidermonkey/mutable_tree_visitor.rb", "lib/johnson/spidermonkey/ruby_land_proxy.rb", "lib/johnson/spidermonkey/runtime.rb", "lib/johnson/version.rb", "lib/johnson/visitable.rb", "lib/johnson/visitors.rb", "lib/johnson/visitors/dot_visitor.rb", "lib/johnson/visitors/ecma_visitor.rb", "lib/johnson/visitors/enumerating_visitor.rb", "lib/johnson/visitors/sexp_visitor.rb", "lib/johnson/visitors/visitor.rb", "lib/rails/init.rb", "srcs/xmlparser-0.6.8.tar", "test/assets/index.html", "test/assets/jquery_test.html", "test/helper.rb", "test/johnson/browser_test.rb", "test/johnson/conversions/array_test.rb", "test/johnson/conversions/boolean_test.rb", "test/johnson/conversions/callable_test.rb", "test/johnson/conversions/file_test.rb", "test/johnson/conversions/nil_test.rb", "test/johnson/conversions/number_test.rb", "test/johnson/conversions/regexp_test.rb", "test/johnson/conversions/string_test.rb", "test/johnson/conversions/struct_test.rb", "test/johnson/conversions/symbol_test.rb", "test/johnson/conversions/thread_test.rb", "test/johnson/error_test.rb", "test/johnson/extensions_test.rb", "test/johnson/nodes/array_literal_test.rb", "test/johnson/nodes/array_node_test.rb", "test/johnson/nodes/binary_node_test.rb", "test/johnson/nodes/bracket_access_test.rb", "test/johnson/nodes/delete_test.rb", "test/johnson/nodes/do_while_test.rb", "test/johnson/nodes/dot_accessor_test.rb", "test/johnson/nodes/export_test.rb", "test/johnson/nodes/for_test.rb", "test/johnson/nodes/function_test.rb", "test/johnson/nodes/if_test.rb", "test/johnson/nodes/import_test.rb", "test/johnson/nodes/label_test.rb", "test/johnson/nodes/let_test.rb", "test/johnson/nodes/object_literal_test.rb", "test/johnson/nodes/return_test.rb", "test/johnson/nodes/semi_test.rb", "test/johnson/nodes/switch_test.rb", "test/johnson/nodes/ternary_test.rb", "test/johnson/nodes/throw_test.rb", "test/johnson/nodes/try_node_test.rb", "test/johnson/nodes/typeof_test.rb", "test/johnson/nodes/unary_node_test.rb", "test/johnson/nodes/void_test.rb", "test/johnson/nodes/while_test.rb", "test/johnson/nodes/with_test.rb", "test/johnson/prelude_test.rb", "test/johnson/runtime_test.rb", "test/johnson/spidermonkey/context_test.rb", "test/johnson/spidermonkey/immutable_node_test.rb", "test/johnson/spidermonkey/js_land_proxy_test.rb", "test/johnson/spidermonkey/ruby_land_proxy_test.rb", "test/johnson/spidermonkey/runtime_test.rb", "test/johnson/version_test.rb", "test/johnson/visitors/dot_visitor_test.rb", "test/johnson/visitors/enumerating_visitor_test.rb", "test/johnson_test.rb", "test/jquery_units/simple.js", "test/jquery_units/test.js", "test/jquery_units/test_helper.js", "test/jquery_units/units/ajax.js", "test/jquery_units/units/core.js", "test/jquery_units/units/event.js", "test/jquery_units/units/fx.js", "test/jquery_units/units/offset.js", "test/jquery_units/units/selector.js", "test/jspec/helper.js", "test/jspec/jspec.js", "test/jspec/simple_spec.js", "test/parser_test.rb", "todo/.keep", "vendor/spidermonkey/.cvsignore", "vendor/spidermonkey/Makefile.in", "vendor/spidermonkey/Makefile.ref", "vendor/spidermonkey/README.html", "vendor/spidermonkey/SpiderMonkey.rsp", "vendor/spidermonkey/Y.js", "vendor/spidermonkey/build.mk", "vendor/spidermonkey/config.mk", "vendor/spidermonkey/config/AIX4.1.mk", "vendor/spidermonkey/config/AIX4.2.mk", "vendor/spidermonkey/config/AIX4.3.mk", "vendor/spidermonkey/config/Darwin.mk", "vendor/spidermonkey/config/Darwin1.3.mk", "vendor/spidermonkey/config/Darwin1.4.mk", "vendor/spidermonkey/config/Darwin5.2.mk", "vendor/spidermonkey/config/Darwin5.3.mk", "vendor/spidermonkey/config/HP-UXB.10.10.mk", "vendor/spidermonkey/config/HP-UXB.10.20.mk", "vendor/spidermonkey/config/HP-UXB.11.00.mk", "vendor/spidermonkey/config/IRIX.mk", "vendor/spidermonkey/config/IRIX5.3.mk", "vendor/spidermonkey/config/IRIX6.1.mk", "vendor/spidermonkey/config/IRIX6.2.mk", "vendor/spidermonkey/config/IRIX6.3.mk", "vendor/spidermonkey/config/IRIX6.5.mk", "vendor/spidermonkey/config/Linux_All.mk", "vendor/spidermonkey/config/Mac_OS10.0.mk", "vendor/spidermonkey/config/OSF1V4.0.mk", "vendor/spidermonkey/config/OSF1V5.0.mk", "vendor/spidermonkey/config/SunOS4.1.4.mk", "vendor/spidermonkey/config/SunOS5.10.mk", "vendor/spidermonkey/config/SunOS5.3.mk", "vendor/spidermonkey/config/SunOS5.4.mk", "vendor/spidermonkey/config/SunOS5.5.1.mk", "vendor/spidermonkey/config/SunOS5.5.mk", "vendor/spidermonkey/config/SunOS5.6.mk", "vendor/spidermonkey/config/SunOS5.7.mk", "vendor/spidermonkey/config/SunOS5.8.mk", "vendor/spidermonkey/config/SunOS5.9.mk", "vendor/spidermonkey/config/WINNT4.0.mk", "vendor/spidermonkey/config/WINNT5.0.mk", "vendor/spidermonkey/config/WINNT5.1.mk", "vendor/spidermonkey/config/WINNT5.2.mk", "vendor/spidermonkey/config/WINNT6.0.mk", "vendor/spidermonkey/config/dgux.mk", "vendor/spidermonkey/editline/Makefile.ref", "vendor/spidermonkey/editline/README", "vendor/spidermonkey/editline/editline.3", "vendor/spidermonkey/editline/editline.c", "vendor/spidermonkey/editline/editline.h", "vendor/spidermonkey/editline/sysunix.c", "vendor/spidermonkey/editline/unix.h", "vendor/spidermonkey/fdlibm/.cvsignore", "vendor/spidermonkey/fdlibm/Makefile.in", "vendor/spidermonkey/fdlibm/Makefile.ref", "vendor/spidermonkey/fdlibm/e_acos.c", "vendor/spidermonkey/fdlibm/e_acosh.c", "vendor/spidermonkey/fdlibm/e_asin.c", "vendor/spidermonkey/fdlibm/e_atan2.c", "vendor/spidermonkey/fdlibm/e_atanh.c", "vendor/spidermonkey/fdlibm/e_cosh.c", "vendor/spidermonkey/fdlibm/e_exp.c", "vendor/spidermonkey/fdlibm/e_fmod.c", "vendor/spidermonkey/fdlibm/e_gamma.c", "vendor/spidermonkey/fdlibm/e_gamma_r.c", "vendor/spidermonkey/fdlibm/e_hypot.c", "vendor/spidermonkey/fdlibm/e_j0.c", "vendor/spidermonkey/fdlibm/e_j1.c", "vendor/spidermonkey/fdlibm/e_jn.c", "vendor/spidermonkey/fdlibm/e_lgamma.c", "vendor/spidermonkey/fdlibm/e_lgamma_r.c", "vendor/spidermonkey/fdlibm/e_log.c", "vendor/spidermonkey/fdlibm/e_log10.c", "vendor/spidermonkey/fdlibm/e_pow.c", "vendor/spidermonkey/fdlibm/e_rem_pio2.c", "vendor/spidermonkey/fdlibm/e_remainder.c", "vendor/spidermonkey/fdlibm/e_scalb.c", "vendor/spidermonkey/fdlibm/e_sinh.c", "vendor/spidermonkey/fdlibm/e_sqrt.c", "vendor/spidermonkey/fdlibm/fdlibm.h", "vendor/spidermonkey/fdlibm/fdlibm.mak", "vendor/spidermonkey/fdlibm/fdlibm.mdp", "vendor/spidermonkey/fdlibm/k_cos.c", "vendor/spidermonkey/fdlibm/k_rem_pio2.c", "vendor/spidermonkey/fdlibm/k_sin.c", "vendor/spidermonkey/fdlibm/k_standard.c", "vendor/spidermonkey/fdlibm/k_tan.c", "vendor/spidermonkey/fdlibm/s_asinh.c", "vendor/spidermonkey/fdlibm/s_atan.c", "vendor/spidermonkey/fdlibm/s_cbrt.c", "vendor/spidermonkey/fdlibm/s_ceil.c", "vendor/spidermonkey/fdlibm/s_copysign.c", "vendor/spidermonkey/fdlibm/s_cos.c", "vendor/spidermonkey/fdlibm/s_erf.c", "vendor/spidermonkey/fdlibm/s_expm1.c", "vendor/spidermonkey/fdlibm/s_fabs.c", "vendor/spidermonkey/fdlibm/s_finite.c", "vendor/spidermonkey/fdlibm/s_floor.c", "vendor/spidermonkey/fdlibm/s_frexp.c", "vendor/spidermonkey/fdlibm/s_ilogb.c", "vendor/spidermonkey/fdlibm/s_isnan.c", "vendor/spidermonkey/fdlibm/s_ldexp.c", "vendor/spidermonkey/fdlibm/s_lib_version.c", "vendor/spidermonkey/fdlibm/s_log1p.c", "vendor/spidermonkey/fdlibm/s_logb.c", "vendor/spidermonkey/fdlibm/s_matherr.c", "vendor/spidermonkey/fdlibm/s_modf.c", "vendor/spidermonkey/fdlibm/s_nextafter.c", "vendor/spidermonkey/fdlibm/s_rint.c", "vendor/spidermonkey/fdlibm/s_scalbn.c", "vendor/spidermonkey/fdlibm/s_signgam.c", "vendor/spidermonkey/fdlibm/s_significand.c", "vendor/spidermonkey/fdlibm/s_sin.c", "vendor/spidermonkey/fdlibm/s_tan.c", "vendor/spidermonkey/fdlibm/s_tanh.c", "vendor/spidermonkey/fdlibm/w_acos.c", "vendor/spidermonkey/fdlibm/w_acosh.c", "vendor/spidermonkey/fdlibm/w_asin.c", "vendor/spidermonkey/fdlibm/w_atan2.c", "vendor/spidermonkey/fdlibm/w_atanh.c", "vendor/spidermonkey/fdlibm/w_cosh.c", "vendor/spidermonkey/fdlibm/w_exp.c", "vendor/spidermonkey/fdlibm/w_fmod.c", "vendor/spidermonkey/fdlibm/w_gamma.c", "vendor/spidermonkey/fdlibm/w_gamma_r.c", "vendor/spidermonkey/fdlibm/w_hypot.c", "vendor/spidermonkey/fdlibm/w_j0.c", "vendor/spidermonkey/fdlibm/w_j1.c", "vendor/spidermonkey/fdlibm/w_jn.c", "vendor/spidermonkey/fdlibm/w_lgamma.c", "vendor/spidermonkey/fdlibm/w_lgamma_r.c", "vendor/spidermonkey/fdlibm/w_log.c", "vendor/spidermonkey/fdlibm/w_log10.c", "vendor/spidermonkey/fdlibm/w_pow.c", "vendor/spidermonkey/fdlibm/w_remainder.c", "vendor/spidermonkey/fdlibm/w_scalb.c", "vendor/spidermonkey/fdlibm/w_sinh.c", "vendor/spidermonkey/fdlibm/w_sqrt.c", "vendor/spidermonkey/javascript-trace.d", "vendor/spidermonkey/js.c", "vendor/spidermonkey/js.mak", "vendor/spidermonkey/js.mdp", "vendor/spidermonkey/js.msg", "vendor/spidermonkey/js3240.rc", "vendor/spidermonkey/jsOS240.def", "vendor/spidermonkey/jsapi.c", "vendor/spidermonkey/jsapi.h", "vendor/spidermonkey/jsarena.c", "vendor/spidermonkey/jsarena.h", "vendor/spidermonkey/jsarray.c", "vendor/spidermonkey/jsarray.h", "vendor/spidermonkey/jsatom.c", "vendor/spidermonkey/jsatom.h", "vendor/spidermonkey/jsbit.h", "vendor/spidermonkey/jsbool.c", "vendor/spidermonkey/jsbool.h", "vendor/spidermonkey/jsclist.h", "vendor/spidermonkey/jscntxt.c", "vendor/spidermonkey/jscntxt.h", "vendor/spidermonkey/jscompat.h", "vendor/spidermonkey/jsconfig.h", "vendor/spidermonkey/jsconfig.mk", "vendor/spidermonkey/jscpucfg.c", "vendor/spidermonkey/jscpucfg.h", "vendor/spidermonkey/jsdate.c", "vendor/spidermonkey/jsdate.h", "vendor/spidermonkey/jsdbgapi.c", "vendor/spidermonkey/jsdbgapi.h", "vendor/spidermonkey/jsdhash.c", "vendor/spidermonkey/jsdhash.h", "vendor/spidermonkey/jsdtoa.c", "vendor/spidermonkey/jsdtoa.h", "vendor/spidermonkey/jsdtracef.c", "vendor/spidermonkey/jsdtracef.h", "vendor/spidermonkey/jsemit.c", "vendor/spidermonkey/jsemit.h", "vendor/spidermonkey/jsexn.c", "vendor/spidermonkey/jsexn.h", "vendor/spidermonkey/jsfile.c", "vendor/spidermonkey/jsfile.h", "vendor/spidermonkey/jsfile.msg", "vendor/spidermonkey/jsfun.c", "vendor/spidermonkey/jsfun.h", "vendor/spidermonkey/jsgc.c", "vendor/spidermonkey/jsgc.h", "vendor/spidermonkey/jshash.c", "vendor/spidermonkey/jshash.h", "vendor/spidermonkey/jsify.pl", "vendor/spidermonkey/jsinterp.c", "vendor/spidermonkey/jsinterp.h", "vendor/spidermonkey/jsinvoke.c", "vendor/spidermonkey/jsiter.c", "vendor/spidermonkey/jsiter.h", "vendor/spidermonkey/jskeyword.tbl", "vendor/spidermonkey/jskwgen.c", "vendor/spidermonkey/jslibmath.h", "vendor/spidermonkey/jslock.c", "vendor/spidermonkey/jslock.h", "vendor/spidermonkey/jslocko.asm", "vendor/spidermonkey/jslog2.c", "vendor/spidermonkey/jslong.c", "vendor/spidermonkey/jslong.h", "vendor/spidermonkey/jsmath.c", "vendor/spidermonkey/jsmath.h", "vendor/spidermonkey/jsnum.c", "vendor/spidermonkey/jsnum.h", "vendor/spidermonkey/jsobj.c", "vendor/spidermonkey/jsobj.h", "vendor/spidermonkey/jsopcode.c", "vendor/spidermonkey/jsopcode.h", "vendor/spidermonkey/jsopcode.tbl", "vendor/spidermonkey/jsotypes.h", "vendor/spidermonkey/jsparse.c", "vendor/spidermonkey/jsparse.h", "vendor/spidermonkey/jsprf.c", "vendor/spidermonkey/jsprf.h", "vendor/spidermonkey/jsproto.tbl", "vendor/spidermonkey/jsprvtd.h", "vendor/spidermonkey/jspubtd.h", "vendor/spidermonkey/jsregexp.c", "vendor/spidermonkey/jsregexp.h", "vendor/spidermonkey/jsreops.tbl", "vendor/spidermonkey/jsscan.c", "vendor/spidermonkey/jsscan.h", "vendor/spidermonkey/jsscope.c", "vendor/spidermonkey/jsscope.h", "vendor/spidermonkey/jsscript.c", "vendor/spidermonkey/jsscript.h", "vendor/spidermonkey/jsshell.msg", "vendor/spidermonkey/jsstddef.h", "vendor/spidermonkey/jsstr.c", "vendor/spidermonkey/jsstr.h", "vendor/spidermonkey/jstypes.h", "vendor/spidermonkey/jsutil.c", "vendor/spidermonkey/jsutil.h", "vendor/spidermonkey/jsxdrapi.c", "vendor/spidermonkey/jsxdrapi.h", "vendor/spidermonkey/jsxml.c", "vendor/spidermonkey/jsxml.h", "vendor/spidermonkey/lock_SunOS.s", "vendor/spidermonkey/perfect.js", "vendor/spidermonkey/plify_jsdhash.sed", "vendor/spidermonkey/prmjtime.c", "vendor/spidermonkey/prmjtime.h", "vendor/spidermonkey/resource.h", "vendor/spidermonkey/rules.mk", "vendor/spidermonkey/win32.order"]
16
+ s.files = [".autotest", "CHANGELOG", "MANIFEST", "MINGW32.mk", "README.rdoc", "Rakefile", "bin/johnson", "cross-compile.txt", "ext/spidermonkey/context.c", "ext/spidermonkey/context.h", "ext/spidermonkey/conversions.c", "ext/spidermonkey/conversions.h", "ext/spidermonkey/debugger.c", "ext/spidermonkey/debugger.h", "ext/spidermonkey/extconf.rb", "ext/spidermonkey/extensions.c", "ext/spidermonkey/extensions.h", "ext/spidermonkey/global.c", "ext/spidermonkey/global.h", "ext/spidermonkey/idhash.c", "ext/spidermonkey/idhash.h", "ext/spidermonkey/immutable_node.c", "ext/spidermonkey/immutable_node.c.erb", "ext/spidermonkey/immutable_node.h", "ext/spidermonkey/jroot.h", "ext/spidermonkey/js_land_proxy.c", "ext/spidermonkey/js_land_proxy.h", "ext/spidermonkey/ruby_land_proxy.c", "ext/spidermonkey/ruby_land_proxy.h", "ext/spidermonkey/runtime.c", "ext/spidermonkey/runtime.h", "ext/spidermonkey/spidermonkey.c", "ext/spidermonkey/spidermonkey.h", "johnson.gemspec", "js/johnson/browser.js", "js/johnson/browser/env.js", "js/johnson/browser/jquery.js", "js/johnson/browser/xmlsax.js", "js/johnson/browser/xmlw3cdom.js", "js/johnson/cli.js", "js/johnson/prelude.js", "js/johnson/template.js", "lib/hoe.rb", "lib/johnson.rb", "lib/johnson/cli.rb", "lib/johnson/cli/options.rb", "lib/johnson/error.rb", "lib/johnson/nodes.rb", "lib/johnson/nodes/binary_node.rb", "lib/johnson/nodes/for.rb", "lib/johnson/nodes/for_in.rb", "lib/johnson/nodes/function.rb", "lib/johnson/nodes/list.rb", "lib/johnson/nodes/node.rb", "lib/johnson/nodes/ternary_node.rb", "lib/johnson/parser.rb", "lib/johnson/parser/syntax_error.rb", "lib/johnson/runtime.rb", "lib/johnson/spidermonkey/context.rb", "lib/johnson/spidermonkey/debugger.rb", "lib/johnson/spidermonkey/immutable_node.rb", "lib/johnson/spidermonkey/js_land_proxy.rb", "lib/johnson/spidermonkey/mutable_tree_visitor.rb", "lib/johnson/spidermonkey/ruby_land_proxy.rb", "lib/johnson/spidermonkey/runtime.rb", "lib/johnson/version.rb", "lib/johnson/visitable.rb", "lib/johnson/visitors.rb", "lib/johnson/visitors/dot_visitor.rb", "lib/johnson/visitors/ecma_visitor.rb", "lib/johnson/visitors/enumerating_visitor.rb", "lib/johnson/visitors/sexp_visitor.rb", "lib/johnson/visitors/visitor.rb", "lib/rails/init.rb", "srcs/xmlparser-0.6.8.tar", "test/assets/index.html", "test/assets/jquery_test.html", "test/helper.rb", "test/johnson/browser_test.rb", "test/johnson/conversions/array_test.rb", "test/johnson/conversions/boolean_test.rb", "test/johnson/conversions/callable_test.rb", "test/johnson/conversions/file_test.rb", "test/johnson/conversions/nil_test.rb", "test/johnson/conversions/number_test.rb", "test/johnson/conversions/regexp_test.rb", "test/johnson/conversions/string_test.rb", "test/johnson/conversions/struct_test.rb", "test/johnson/conversions/symbol_test.rb", "test/johnson/conversions/thread_test.rb", "test/johnson/error_test.rb", "test/johnson/extensions_test.rb", "test/johnson/nodes/array_literal_test.rb", "test/johnson/nodes/array_node_test.rb", "test/johnson/nodes/binary_node_test.rb", "test/johnson/nodes/bracket_access_test.rb", "test/johnson/nodes/delete_test.rb", "test/johnson/nodes/do_while_test.rb", "test/johnson/nodes/dot_accessor_test.rb", "test/johnson/nodes/export_test.rb", "test/johnson/nodes/for_test.rb", "test/johnson/nodes/function_test.rb", "test/johnson/nodes/if_test.rb", "test/johnson/nodes/import_test.rb", "test/johnson/nodes/label_test.rb", "test/johnson/nodes/let_test.rb", "test/johnson/nodes/object_literal_test.rb", "test/johnson/nodes/return_test.rb", "test/johnson/nodes/semi_test.rb", "test/johnson/nodes/switch_test.rb", "test/johnson/nodes/ternary_test.rb", "test/johnson/nodes/throw_test.rb", "test/johnson/nodes/try_node_test.rb", "test/johnson/nodes/typeof_test.rb", "test/johnson/nodes/unary_node_test.rb", "test/johnson/nodes/void_test.rb", "test/johnson/nodes/while_test.rb", "test/johnson/nodes/with_test.rb", "test/johnson/prelude_test.rb", "test/johnson/runtime_test.rb", "test/johnson/spidermonkey/context_test.rb", "test/johnson/spidermonkey/immutable_node_test.rb", "test/johnson/spidermonkey/js_land_proxy_test.rb", "test/johnson/spidermonkey/ruby_land_proxy_test.rb", "test/johnson/spidermonkey/runtime_test.rb", "test/johnson/version_test.rb", "test/johnson/visitors/dot_visitor_test.rb", "test/johnson/visitors/enumerating_visitor_test.rb", "test/johnson_test.rb", "test/jquery_units/simple.js", "test/jquery_units/test.js", "test/jquery_units/test_helper.js", "test/jquery_units/units/ajax.js", "test/jquery_units/units/core.js", "test/jquery_units/units/event.js", "test/jquery_units/units/fx.js", "test/jquery_units/units/offset.js", "test/jquery_units/units/selector.js", "test/jspec/helper.js", "test/jspec/jspec.js", "test/jspec/simple_spec.js", "test/parser_test.rb", "todo/.keep", "vendor/spidermonkey/.cvsignore", "vendor/spidermonkey/Makefile.in", "vendor/spidermonkey/Makefile.ref", "vendor/spidermonkey/README.html", "vendor/spidermonkey/SpiderMonkey.rsp", "vendor/spidermonkey/Y.js", "vendor/spidermonkey/build.mk", "vendor/spidermonkey/config.mk", "vendor/spidermonkey/config/AIX4.1.mk", "vendor/spidermonkey/config/AIX4.2.mk", "vendor/spidermonkey/config/AIX4.3.mk", "vendor/spidermonkey/config/Darwin.mk", "vendor/spidermonkey/config/Darwin1.3.mk", "vendor/spidermonkey/config/Darwin1.4.mk", "vendor/spidermonkey/config/Darwin5.2.mk", "vendor/spidermonkey/config/Darwin5.3.mk", "vendor/spidermonkey/config/FreeBSD.mk", "vendor/spidermonkey/config/HP-UXB.10.10.mk", "vendor/spidermonkey/config/HP-UXB.10.20.mk", "vendor/spidermonkey/config/HP-UXB.11.00.mk", "vendor/spidermonkey/config/IRIX.mk", "vendor/spidermonkey/config/IRIX5.3.mk", "vendor/spidermonkey/config/IRIX6.1.mk", "vendor/spidermonkey/config/IRIX6.2.mk", "vendor/spidermonkey/config/IRIX6.3.mk", "vendor/spidermonkey/config/IRIX6.5.mk", "vendor/spidermonkey/config/Linux_All.mk", "vendor/spidermonkey/config/Mac_OS10.0.mk", "vendor/spidermonkey/config/OSF1V4.0.mk", "vendor/spidermonkey/config/OSF1V5.0.mk", "vendor/spidermonkey/config/SunOS4.1.4.mk", "vendor/spidermonkey/config/SunOS5.10.mk", "vendor/spidermonkey/config/SunOS5.3.mk", "vendor/spidermonkey/config/SunOS5.4.mk", "vendor/spidermonkey/config/SunOS5.5.1.mk", "vendor/spidermonkey/config/SunOS5.5.mk", "vendor/spidermonkey/config/SunOS5.6.mk", "vendor/spidermonkey/config/SunOS5.7.mk", "vendor/spidermonkey/config/SunOS5.8.mk", "vendor/spidermonkey/config/SunOS5.9.mk", "vendor/spidermonkey/config/WINNT4.0.mk", "vendor/spidermonkey/config/WINNT5.0.mk", "vendor/spidermonkey/config/WINNT5.1.mk", "vendor/spidermonkey/config/WINNT5.2.mk", "vendor/spidermonkey/config/WINNT6.0.mk", "vendor/spidermonkey/config/dgux.mk", "vendor/spidermonkey/editline/Makefile.ref", "vendor/spidermonkey/editline/README", "vendor/spidermonkey/editline/editline.3", "vendor/spidermonkey/editline/editline.c", "vendor/spidermonkey/editline/editline.h", "vendor/spidermonkey/editline/sysunix.c", "vendor/spidermonkey/editline/unix.h", "vendor/spidermonkey/fdlibm/.cvsignore", "vendor/spidermonkey/fdlibm/Makefile.in", "vendor/spidermonkey/fdlibm/Makefile.ref", "vendor/spidermonkey/fdlibm/e_acos.c", "vendor/spidermonkey/fdlibm/e_acosh.c", "vendor/spidermonkey/fdlibm/e_asin.c", "vendor/spidermonkey/fdlibm/e_atan2.c", "vendor/spidermonkey/fdlibm/e_atanh.c", "vendor/spidermonkey/fdlibm/e_cosh.c", "vendor/spidermonkey/fdlibm/e_exp.c", "vendor/spidermonkey/fdlibm/e_fmod.c", "vendor/spidermonkey/fdlibm/e_gamma.c", "vendor/spidermonkey/fdlibm/e_gamma_r.c", "vendor/spidermonkey/fdlibm/e_hypot.c", "vendor/spidermonkey/fdlibm/e_j0.c", "vendor/spidermonkey/fdlibm/e_j1.c", "vendor/spidermonkey/fdlibm/e_jn.c", "vendor/spidermonkey/fdlibm/e_lgamma.c", "vendor/spidermonkey/fdlibm/e_lgamma_r.c", "vendor/spidermonkey/fdlibm/e_log.c", "vendor/spidermonkey/fdlibm/e_log10.c", "vendor/spidermonkey/fdlibm/e_pow.c", "vendor/spidermonkey/fdlibm/e_rem_pio2.c", "vendor/spidermonkey/fdlibm/e_remainder.c", "vendor/spidermonkey/fdlibm/e_scalb.c", "vendor/spidermonkey/fdlibm/e_sinh.c", "vendor/spidermonkey/fdlibm/e_sqrt.c", "vendor/spidermonkey/fdlibm/fdlibm.h", "vendor/spidermonkey/fdlibm/fdlibm.mak", "vendor/spidermonkey/fdlibm/fdlibm.mdp", "vendor/spidermonkey/fdlibm/k_cos.c", "vendor/spidermonkey/fdlibm/k_rem_pio2.c", "vendor/spidermonkey/fdlibm/k_sin.c", "vendor/spidermonkey/fdlibm/k_standard.c", "vendor/spidermonkey/fdlibm/k_tan.c", "vendor/spidermonkey/fdlibm/s_asinh.c", "vendor/spidermonkey/fdlibm/s_atan.c", "vendor/spidermonkey/fdlibm/s_cbrt.c", "vendor/spidermonkey/fdlibm/s_ceil.c", "vendor/spidermonkey/fdlibm/s_copysign.c", "vendor/spidermonkey/fdlibm/s_cos.c", "vendor/spidermonkey/fdlibm/s_erf.c", "vendor/spidermonkey/fdlibm/s_expm1.c", "vendor/spidermonkey/fdlibm/s_fabs.c", "vendor/spidermonkey/fdlibm/s_finite.c", "vendor/spidermonkey/fdlibm/s_floor.c", "vendor/spidermonkey/fdlibm/s_frexp.c", "vendor/spidermonkey/fdlibm/s_ilogb.c", "vendor/spidermonkey/fdlibm/s_isnan.c", "vendor/spidermonkey/fdlibm/s_ldexp.c", "vendor/spidermonkey/fdlibm/s_lib_version.c", "vendor/spidermonkey/fdlibm/s_log1p.c", "vendor/spidermonkey/fdlibm/s_logb.c", "vendor/spidermonkey/fdlibm/s_matherr.c", "vendor/spidermonkey/fdlibm/s_modf.c", "vendor/spidermonkey/fdlibm/s_nextafter.c", "vendor/spidermonkey/fdlibm/s_rint.c", "vendor/spidermonkey/fdlibm/s_scalbn.c", "vendor/spidermonkey/fdlibm/s_signgam.c", "vendor/spidermonkey/fdlibm/s_significand.c", "vendor/spidermonkey/fdlibm/s_sin.c", "vendor/spidermonkey/fdlibm/s_tan.c", "vendor/spidermonkey/fdlibm/s_tanh.c", "vendor/spidermonkey/fdlibm/w_acos.c", "vendor/spidermonkey/fdlibm/w_acosh.c", "vendor/spidermonkey/fdlibm/w_asin.c", "vendor/spidermonkey/fdlibm/w_atan2.c", "vendor/spidermonkey/fdlibm/w_atanh.c", "vendor/spidermonkey/fdlibm/w_cosh.c", "vendor/spidermonkey/fdlibm/w_exp.c", "vendor/spidermonkey/fdlibm/w_fmod.c", "vendor/spidermonkey/fdlibm/w_gamma.c", "vendor/spidermonkey/fdlibm/w_gamma_r.c", "vendor/spidermonkey/fdlibm/w_hypot.c", "vendor/spidermonkey/fdlibm/w_j0.c", "vendor/spidermonkey/fdlibm/w_j1.c", "vendor/spidermonkey/fdlibm/w_jn.c", "vendor/spidermonkey/fdlibm/w_lgamma.c", "vendor/spidermonkey/fdlibm/w_lgamma_r.c", "vendor/spidermonkey/fdlibm/w_log.c", "vendor/spidermonkey/fdlibm/w_log10.c", "vendor/spidermonkey/fdlibm/w_pow.c", "vendor/spidermonkey/fdlibm/w_remainder.c", "vendor/spidermonkey/fdlibm/w_scalb.c", "vendor/spidermonkey/fdlibm/w_sinh.c", "vendor/spidermonkey/fdlibm/w_sqrt.c", "vendor/spidermonkey/javascript-trace.d", "vendor/spidermonkey/js.c", "vendor/spidermonkey/js.mak", "vendor/spidermonkey/js.mdp", "vendor/spidermonkey/js.msg", "vendor/spidermonkey/js3240.rc", "vendor/spidermonkey/jsOS240.def", "vendor/spidermonkey/jsapi.c", "vendor/spidermonkey/jsapi.h", "vendor/spidermonkey/jsarena.c", "vendor/spidermonkey/jsarena.h", "vendor/spidermonkey/jsarray.c", "vendor/spidermonkey/jsarray.h", "vendor/spidermonkey/jsatom.c", "vendor/spidermonkey/jsatom.h", "vendor/spidermonkey/jsbit.h", "vendor/spidermonkey/jsbool.c", "vendor/spidermonkey/jsbool.h", "vendor/spidermonkey/jsclist.h", "vendor/spidermonkey/jscntxt.c", "vendor/spidermonkey/jscntxt.h", "vendor/spidermonkey/jscompat.h", "vendor/spidermonkey/jsconfig.h", "vendor/spidermonkey/jsconfig.mk", "vendor/spidermonkey/jscpucfg.c", "vendor/spidermonkey/jscpucfg.h", "vendor/spidermonkey/jsdate.c", "vendor/spidermonkey/jsdate.h", "vendor/spidermonkey/jsdbgapi.c", "vendor/spidermonkey/jsdbgapi.h", "vendor/spidermonkey/jsdhash.c", "vendor/spidermonkey/jsdhash.h", "vendor/spidermonkey/jsdtoa.c", "vendor/spidermonkey/jsdtoa.h", "vendor/spidermonkey/jsdtracef.c", "vendor/spidermonkey/jsdtracef.h", "vendor/spidermonkey/jsemit.c", "vendor/spidermonkey/jsemit.h", "vendor/spidermonkey/jsexn.c", "vendor/spidermonkey/jsexn.h", "vendor/spidermonkey/jsfile.c", "vendor/spidermonkey/jsfile.h", "vendor/spidermonkey/jsfile.msg", "vendor/spidermonkey/jsfun.c", "vendor/spidermonkey/jsfun.h", "vendor/spidermonkey/jsgc.c", "vendor/spidermonkey/jsgc.h", "vendor/spidermonkey/jshash.c", "vendor/spidermonkey/jshash.h", "vendor/spidermonkey/jsify.pl", "vendor/spidermonkey/jsinterp.c", "vendor/spidermonkey/jsinterp.h", "vendor/spidermonkey/jsinvoke.c", "vendor/spidermonkey/jsiter.c", "vendor/spidermonkey/jsiter.h", "vendor/spidermonkey/jskeyword.tbl", "vendor/spidermonkey/jskwgen.c", "vendor/spidermonkey/jslibmath.h", "vendor/spidermonkey/jslock.c", "vendor/spidermonkey/jslock.h", "vendor/spidermonkey/jslocko.asm", "vendor/spidermonkey/jslog2.c", "vendor/spidermonkey/jslong.c", "vendor/spidermonkey/jslong.h", "vendor/spidermonkey/jsmath.c", "vendor/spidermonkey/jsmath.h", "vendor/spidermonkey/jsnum.c", "vendor/spidermonkey/jsnum.h", "vendor/spidermonkey/jsobj.c", "vendor/spidermonkey/jsobj.h", "vendor/spidermonkey/jsopcode.c", "vendor/spidermonkey/jsopcode.h", "vendor/spidermonkey/jsopcode.tbl", "vendor/spidermonkey/jsotypes.h", "vendor/spidermonkey/jsparse.c", "vendor/spidermonkey/jsparse.h", "vendor/spidermonkey/jsprf.c", "vendor/spidermonkey/jsprf.h", "vendor/spidermonkey/jsproto.tbl", "vendor/spidermonkey/jsprvtd.h", "vendor/spidermonkey/jspubtd.h", "vendor/spidermonkey/jsregexp.c", "vendor/spidermonkey/jsregexp.h", "vendor/spidermonkey/jsreops.tbl", "vendor/spidermonkey/jsscan.c", "vendor/spidermonkey/jsscan.h", "vendor/spidermonkey/jsscope.c", "vendor/spidermonkey/jsscope.h", "vendor/spidermonkey/jsscript.c", "vendor/spidermonkey/jsscript.h", "vendor/spidermonkey/jsshell.msg", "vendor/spidermonkey/jsstddef.h", "vendor/spidermonkey/jsstr.c", "vendor/spidermonkey/jsstr.h", "vendor/spidermonkey/jstypes.h", "vendor/spidermonkey/jsutil.c", "vendor/spidermonkey/jsutil.h", "vendor/spidermonkey/jsxdrapi.c", "vendor/spidermonkey/jsxdrapi.h", "vendor/spidermonkey/jsxml.c", "vendor/spidermonkey/jsxml.h", "vendor/spidermonkey/lock_SunOS.s", "vendor/spidermonkey/perfect.js", "vendor/spidermonkey/plify_jsdhash.sed", "vendor/spidermonkey/prmjtime.c", "vendor/spidermonkey/prmjtime.h", "vendor/spidermonkey/resource.h", "vendor/spidermonkey/rules.mk", "vendor/spidermonkey/win32.order"]
17
17
  s.has_rdoc = true
18
18
  s.homepage = %q{http://github.com/jbarnette/johnson/wikis}
19
19
  s.rdoc_options = ["--main", "README.rdoc"]
@@ -8,7 +8,7 @@
8
8
  var window = this;
9
9
 
10
10
  Ruby.require("uri");
11
- Ruby.require("xml/dom/builder");
11
+ Ruby.require("taka");
12
12
 
13
13
  print = function(txt) { Ruby.puts(txt); };
14
14
 
@@ -140,9 +140,10 @@ print = function(txt) { Ruby.puts(txt); };
140
140
  // DOM Document
141
141
 
142
142
  var parse = function(text) {
143
- var parser = new Ruby.XML.DOM.Builder();
144
143
  try {
145
- return parser.parse(text);
144
+ // Annoying. We have to do send because HTML isn't recognized
145
+ // as a function.
146
+ return Ruby.Taka.DOM.send("HTML", text);
146
147
  } catch(e) {
147
148
  Ruby.puts("FAIL\n" + text);
148
149
  Ruby.raise(e)
@@ -175,7 +176,7 @@ print = function(txt) { Ruby.puts(txt); };
175
176
 
176
177
  },
177
178
  getElementById: function(id){
178
- return makeNode( this._dom._searchID(id) );
179
+ return this._dom.getElementById(id);
179
180
  },
180
181
  get body(){
181
182
  return this.getElementsByTagName("body")[0];
@@ -26,7 +26,7 @@ module Johnson
26
26
  end
27
27
 
28
28
  def load(*files)
29
- files.each { |f| delegate.evaluate(File.read(f).gsub(/\A#!.*$/, ''), f, 1) }
29
+ files.map { |f| delegate.evaluate(File.read(f).gsub(/\A#!.*$/, ''), f, 1) }.last
30
30
  end
31
31
 
32
32
  ###
@@ -10,6 +10,10 @@ Johnson.waitForThreads = function() {
10
10
  window.location = "file://" + Ruby.File.expand_path(Ruby.Dir.pwd()) + "/test/assets/jquery_test.html";
11
11
  Ruby.eval("(Thread.list - [Thread.main]).each {|t| t.join}");
12
12
 
13
+ document = Ruby.Taka.DOM.send("HTML",
14
+ Ruby.File.open(Ruby.File.expand_path(Ruby.Dir.pwd()) + "/test/assets/jquery_test.html")
15
+ );
16
+
13
17
  // Load the test runner
14
18
  Johnson.require("test/jquery_units/test_helper.js");
15
19
 
@@ -194,4 +194,4 @@ function triggerEvent( elem, type, event ) {
194
194
  */
195
195
  function url(value) {
196
196
  return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);
197
- }
197
+ }
@@ -3,301 +3,306 @@ module("core");
3
3
  var isLocal = true;
4
4
 
5
5
  test("Basic requirements", function() {
6
- expect(7);
7
- ok( Array.prototype.push, "Array.push()" );
8
- ok( Function.prototype.apply, "Function.apply()" );
9
- ok( document.getElementById, "getElementById" );
10
- ok( document.getElementsByTagName, "getElementsByTagName" );
11
- ok( RegExp, "RegExp" );
12
- ok( jQuery, "jQuery" );
13
- ok( $, "$()" );
6
+ expect(7);
7
+ ok( Array.prototype.push, "Array.push()" );
8
+ ok( Function.prototype.apply, "Function.apply()" );
9
+ ok( document.getElementById, "getElementById" );
10
+ ok( document.getElementsByTagName, "getElementsByTagName" );
11
+ ok( RegExp, "RegExp" );
12
+ ok( jQuery, "jQuery" );
13
+ ok( $, "$()" );
14
14
  });
15
15
 
16
16
  test("$()", function() {
17
- expect(4);
18
-
19
- var main = $("#main");
20
-
21
- isSet( $("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" );
22
-
17
+ expect(4);
18
+
19
+ var main = $("#main");
20
+
21
+ isSet( $("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" );
22
+
23
23
  /*
24
- // disabled since this test was doing nothing. i tried to fix it but i'm not sure
25
- // what the expected behavior should even be. FF returns "\n" for the text node
26
- // make sure this is handled
27
- var crlfContainer = $('<p>\r\n</p>');
28
- var x = crlfContainer.contents().get(0).nodeValue;
29
- equals( x, what???, "Check for \\r and \\n in jQuery()" );
24
+ // disabled since this test was doing nothing. i tried to fix it but i'm not sure
25
+ // what the expected behavior should even be. FF returns "\n" for the text node
26
+ // make sure this is handled
27
+ var crlfContainer = $('<p>\r\n</p>');
28
+ var x = crlfContainer.contents().get(0).nodeValue;
29
+ equals( x, what???, "Check for \\r and \\n in jQuery()" );
30
30
  */
31
-
32
- /* // Disabled until we add this functionality in
33
- var pass = true;
34
- try {
35
- $("<div>Testing</div>").appendTo(document.getElementById("iframe").contentDocument.body);
36
- } catch(e){
37
- pass = false;
38
- }
39
- ok( pass, "$('&lt;tag&gt;') needs optional document parameter to ease cross-frame DOM wrangling, see #968" );*/
40
-
41
- var code = $("<code/>");
42
- equals( code.length, 1, "Correct number of elements generated for code" );
43
- var img = $("<img/>");
44
- equals( img.length, 1, "Correct number of elements generated for img" );
45
- var div = $("<div/><hr/><code/><b/>");
46
- equals( div.length, 4, "Correct number of elements generated for div hr code b" );
31
+
32
+ /* // Disabled until we add this functionality in
33
+ var pass = true;
34
+ try {
35
+ $("<div>Testing</div>").appendTo(document.getElementById("iframe").contentDocument.body);
36
+ } catch(e){
37
+ pass = false;
38
+ }
39
+ ok( pass, "$('&lt;tag&gt;') needs optional document parameter to ease cross-frame DOM wrangling, see #968" );*/
40
+
41
+ var code = $("<code/>");
42
+ equals( code.length, 1, "Correct number of elements generated for code" );
43
+ var img = $("<img/>");
44
+ equals( img.length, 1, "Correct number of elements generated for img" );
45
+ var div = $("<div/><hr/><code/><b/>");
46
+ equals( div.length, 4, "Correct number of elements generated for div hr code b" );
47
47
  });
48
48
 
49
49
  test("browser", function() {
50
- expect(13);
51
- var browsers = {
52
- //Internet Explorer
53
- "Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)": "6.0",
54
- "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)": "7.0",
55
- /** Failing #1876
56
- * "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30)": "7.0",
57
- */
58
- //Browsers with Gecko engine
59
- //Mozilla
60
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915" : "1.7.12",
61
- //Firefox
62
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3": "1.8.1.3",
63
- //Netscape
64
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20070321 Netscape/8.1.3" : "1.7.5",
65
- //Flock
66
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070321 Firefox/1.5.0.11 Flock/0.7.12" : "1.8.0.11",
67
- //Opera browser
68
- "Opera/9.20 (X11; Linux x86_64; U; en)": "9.20",
69
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.20" : "9.20",
70
- "Mozilla/5.0 (Windows NT 5.1; U; pl; rv:1.8.0) Gecko/20060728 Firefox/1.5.0 Opera 9.20": "9.20",
71
- //WebKit engine
72
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3": "418.9",
73
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3" : "418.8",
74
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.5": "312.8",
75
- //Other user agent string
76
- "Other browser's user agent 1.0":null
77
- };
78
- for (var i in browsers) {
79
- var v = i.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ); // RegEx from Core jQuery.browser.version check
80
- version = v ? v[1] : null;
81
- equals( version, browsers[i], "Checking UA string" );
82
- }
50
+ expect(13);
51
+ var browsers = {
52
+ //Internet Explorer
53
+ "Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)": "6.0",
54
+ "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)": "7.0",
55
+ /** Failing #1876
56
+ * "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30)": "7.0",
57
+ */
58
+ //Browsers with Gecko engine
59
+ //Mozilla
60
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915" : "1.7.12",
61
+ //Firefox
62
+ "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3": "1.8.1.3",
63
+ //Netscape
64
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20070321 Netscape/8.1.3" : "1.7.5",
65
+ //Flock
66
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070321 Firefox/1.5.0.11 Flock/0.7.12" : "1.8.0.11",
67
+ //Opera browser
68
+ "Opera/9.20 (X11; Linux x86_64; U; en)": "9.20",
69
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.20" : "9.20",
70
+ "Mozilla/5.0 (Windows NT 5.1; U; pl; rv:1.8.0) Gecko/20060728 Firefox/1.5.0 Opera 9.20": "9.20",
71
+ //WebKit engine
72
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3": "418.9",
73
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3" : "418.8",
74
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.5": "312.8",
75
+ //Other user agent string
76
+ "Other browser's user agent 1.0":null
77
+ };
78
+ for (var i in browsers) {
79
+ var v = i.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ); // RegEx from Core jQuery.browser.version check
80
+ version = v ? v[1] : null;
81
+ equals( version, browsers[i], "Checking UA string" );
82
+ }
83
83
  });
84
84
 
85
85
  test("noConflict", function() {
86
- expect(6);
87
-
88
- var old = jQuery;
89
- var newjQuery = jQuery.noConflict();
86
+ expect(6);
87
+
88
+ var old = jQuery;
89
+ var newjQuery = jQuery.noConflict();
90
90
 
91
- ok( newjQuery == old, "noConflict returned the jQuery object" );
92
- ok( jQuery == old, "Make sure jQuery wasn't touched." );
93
- ok( $ == "$", "Make sure $ was reverted." );
91
+ ok( newjQuery == old, "noConflict returned the jQuery object" );
92
+ ok( jQuery == old, "Make sure jQuery wasn't touched." );
93
+ ok( $ == "$", "Make sure $ was reverted." );
94
94
 
95
- jQuery = $ = old;
95
+ jQuery = $ = old;
96
96
 
97
- newjQuery = jQuery.noConflict(true);
97
+ newjQuery = jQuery.noConflict(true);
98
98
 
99
- ok( newjQuery == old, "noConflict returned the jQuery object" );
100
- ok( jQuery == "jQuery", "Make sure jQuery was reverted." );
101
- ok( $ == "$", "Make sure $ was reverted." );
99
+ ok( newjQuery == old, "noConflict returned the jQuery object" );
100
+ ok( jQuery == "jQuery", "Make sure jQuery was reverted." );
101
+ ok( $ == "$", "Make sure $ was reverted." );
102
102
 
103
- jQuery = $ = old;
103
+ jQuery = $ = old;
104
104
  });
105
105
 
106
106
  test("isFunction", function() {
107
- expect(21);
107
+ expect(21);
108
108
 
109
- // Make sure that false values return false
110
- ok( !jQuery.isFunction(), "No Value" );
111
- ok( !jQuery.isFunction( null ), "null Value" );
112
- ok( !jQuery.isFunction( undefined ), "undefined Value" );
113
- ok( !jQuery.isFunction( "" ), "Empty String Value" );
114
- ok( !jQuery.isFunction( 0 ), "0 Value" );
109
+ // Make sure that false values return false
110
+ ok( !jQuery.isFunction(), "No Value" );
111
+ ok( !jQuery.isFunction( null ), "null Value" );
112
+ ok( !jQuery.isFunction( undefined ), "undefined Value" );
113
+ ok( !jQuery.isFunction( "" ), "Empty String Value" );
114
+ ok( !jQuery.isFunction( 0 ), "0 Value" );
115
115
 
116
- // Check built-ins
117
- // Safari uses "(Internal Function)"
118
- ok( jQuery.isFunction(String), "String Function" );
119
- ok( jQuery.isFunction(Array), "Array Function" );
120
- ok( jQuery.isFunction(Object), "Object Function" );
121
- ok( jQuery.isFunction(Function), "Function Function" );
116
+ // Check built-ins
117
+ // Safari uses "(Internal Function)"
118
+ ok( jQuery.isFunction(String), "String Function" );
119
+ ok( jQuery.isFunction(Array), "Array Function" );
120
+ ok( jQuery.isFunction(Object), "Object Function" );
121
+ ok( jQuery.isFunction(Function), "Function Function" );
122
122
 
123
- // When stringified, this could be misinterpreted
124
- var mystr = "function";
125
- ok( !jQuery.isFunction(mystr), "Function String" );
123
+ // When stringified, this could be misinterpreted
124
+ var mystr = "function";
125
+ ok( !jQuery.isFunction(mystr), "Function String" );
126
126
 
127
- // When stringified, this could be misinterpreted
128
- var myarr = [ "function" ];
129
- ok( !jQuery.isFunction(myarr), "Function Array" );
127
+ // When stringified, this could be misinterpreted
128
+ var myarr = [ "function" ];
129
+ ok( !jQuery.isFunction(myarr), "Function Array" );
130
130
 
131
- // When stringified, this could be misinterpreted
132
- var myfunction = { "function": "test" };
133
- ok( !jQuery.isFunction(myfunction), "Function Object" );
131
+ // When stringified, this could be misinterpreted
132
+ var myfunction = { "function": "test" };
133
+ ok( !jQuery.isFunction(myfunction), "Function Object" );
134
134
 
135
- // Make sure normal functions still work
136
- var fn = function(){};
137
- ok( jQuery.isFunction(fn), "Normal Function" );
135
+ // Make sure normal functions still work
136
+ var fn = function(){};
137
+ ok( jQuery.isFunction(fn), "Normal Function" );
138
138
 
139
- var obj = document.createElement("object");
139
+ var obj = document.createElement("object");
140
140
 
141
- // Firefox says this is a function
142
- ok( !jQuery.isFunction(obj), "Object Element" );
141
+ // Firefox says this is a function
142
+ ok( !jQuery.isFunction(obj), "Object Element" );
143
143
 
144
- // IE says this is an object
145
- ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );
144
+ // IE says this is an object
145
+ ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );
146
146
 
147
- var nodes = document.body.childNodes;
147
+ var nodes = document.body.childNodes;
148
148
 
149
- // Safari says this is a function
150
- ok( !jQuery.isFunction(nodes), "childNodes Property" );
149
+ // Safari says this is a function
150
+ ok( !jQuery.isFunction(nodes), "childNodes Property" );
151
151
 
152
- var first = document.body.firstChild;
153
-
154
- // Normal elements are reported ok everywhere
155
- ok( !jQuery.isFunction(first), "A normal DOM Element" );
152
+ var first = document.body.firstChild;
153
+
154
+ // Normal elements are reported ok everywhere
155
+ ok( !jQuery.isFunction(first), "A normal DOM Element" );
156
156
 
157
- var input = document.createElement("input");
158
- input.type = "text";
159
- document.body.appendChild( input );
157
+ var input = document.createElement("input");
158
+ input.type = "text";
159
+ document.body.appendChild( input );
160
160
 
161
- // IE says this is an object
162
- ok( jQuery.isFunction(input.focus), "A default function property" );
161
+ // IE says this is an object
162
+ ok( jQuery.isFunction(input.focus), "A default function property" );
163
163
 
164
- document.body.removeChild( input );
164
+ document.body.removeChild( input );
165
165
 
166
- var a = document.createElement("a");
167
- a.href = "some-function";
168
- document.body.appendChild( a );
166
+ var a = document.createElement("a");
167
+ a.href = "some-function";
168
+ document.body.appendChild( a );
169
169
 
170
- // This serializes with the word 'function' in it
171
- ok( !jQuery.isFunction(a), "Anchor Element" );
170
+ // This serializes with the word 'function' in it
171
+ ok( !jQuery.isFunction(a), "Anchor Element" );
172
172
 
173
- document.body.removeChild( a );
173
+ document.body.removeChild( a );
174
174
 
175
- // Recursive function calls have lengths and array-like properties
176
- function callme(callback){
177
- function fn(response){
178
- callback(response);
179
- }
175
+ // Recursive function calls have lengths and array-like properties
176
+ function callme(callback){
177
+ function fn(response){
178
+ callback(response);
179
+ }
180
180
 
181
- ok( jQuery.isFunction(fn), "Recursive Function Call" );
181
+ ok( jQuery.isFunction(fn), "Recursive Function Call" );
182
182
 
183
- fn({ some: "data" });
184
- };
183
+ fn({ some: "data" });
184
+ };
185
185
 
186
- callme(function(){
187
- callme(function(){});
188
- });
186
+ callme(function(){
187
+ callme(function(){});
188
+ });
189
189
  });
190
190
 
191
191
  var foo = false;
192
192
 
193
193
  test("$('html')", function() {
194
- expect(6);
194
+ expect(6);
195
195
 
196
- reset();
197
- foo = false;
198
- var s = $("<script>var foo='test';</script>")[0];
199
- ok( s, "Creating a script" );
200
- ok( !foo, "Make sure the script wasn't executed prematurely" );
201
- $("body").append(s);
202
- ok( foo, "Executing a scripts contents in the right context" );
203
-
204
- reset();
205
- ok( $("<link rel='stylesheet'/>")[0], "Creating a link" );
206
-
207
- reset();
196
+ reset();
197
+ foo = false;
198
+ var s = $("<script>var foo='test';</script>")[0];
199
+ ok( s, "Creating a script" );
200
+ ok( !foo, "Make sure the script wasn't executed prematurely" );
201
+ $("body").append(s);
202
+ ok( foo, "Executing a scripts contents in the right context" );
203
+
204
+ reset();
205
+ ok( $("<link rel='stylesheet'/>")[0], "Creating a link" );
206
+
207
+ reset();
208
208
 
209
- var j = $("<span>hi</span> there <!-- mon ami -->");
210
- ok( j.length >= 2, "Check node,textnode,comment creation (some browsers delete comments)" );
209
+ var j = $("<span>hi</span> there <!-- mon ami -->");
210
+ ok( j.length >= 2, "Check node,textnode,comment creation (some browsers delete comments)" );
211
211
 
212
- ok( !$("<option>test</option>")[0].selected, "Make sure that options are auto-selected #2050" );
212
+ // FIXME I have no idea what is wrong with this
213
+ ok( !$("<option>test</option>")[0].selected, "Make sure that options are auto-selected #2050" );
213
214
  });
214
215
 
215
216
  test("$('html', context)", function() {
216
- expect(1);
217
+ expect(1);
217
218
 
218
- var $div = $("<div/>");
219
- var $span = $("<span/>", $div);
220
- equals($span.length, 1, "Verify a span created with a div context works, #1763");
219
+ var $div = $("<div/>");
220
+ var $span = $("<span/>", $div);
221
+ equals($span.length, 1, "Verify a span created with a div context works, #1763");
221
222
  });
222
223
 
223
224
  if ( !isLocal ) {
224
225
  test("$(selector, xml).text(str) - Loaded via XML document", function() {
225
- expect(2);
226
- stop();
227
- $.get('data/dashboard.xml', function(xml) {
228
- // tests for #1419 where IE was a problem
229
- equals( $("tab:first", xml).text(), "blabla", "Verify initial text correct" );
230
- $("tab:first", xml).text("newtext");
231
- equals( $("tab:first", xml).text(), "newtext", "Verify new text correct" );
232
- start();
233
- });
226
+ expect(2);
227
+ stop();
228
+ $.get('data/dashboard.xml', function(xml) {
229
+ // tests for #1419 where IE was a problem
230
+ equals( $("tab:first", xml).text(), "blabla", "Verify initial text correct" );
231
+ $("tab:first", xml).text("newtext");
232
+ equals( $("tab:first", xml).text(), "newtext", "Verify new text correct" );
233
+ start();
234
+ });
234
235
  });
235
236
  }
236
237
 
237
238
  test("length", function() {
238
- expect(1);
239
- ok( $("p").length == 6, "Get Number of Elements Found" );
239
+ expect(1);
240
+ ok( $("p").length == 6, "Get Number of Elements Found" );
240
241
  });
241
242
 
242
243
  test("size()", function() {
243
- expect(1);
244
- ok( $("p").size() == 6, "Get Number of Elements Found" );
244
+ expect(1);
245
+ ok( $("p").size() == 6, "Get Number of Elements Found" );
245
246
  });
246
247
 
247
248
  test("get()", function() {
248
- expect(1);
249
- isSet( $("p").get(), q("firstp","ap","sndp","en","sap","first"), "Get All Elements" );
249
+ expect(1);
250
+ isSet( $("p").get(), q("firstp","ap","sndp","en","sap","first"), "Get All Elements" );
250
251
  });
251
252
 
252
253
  test("get(Number)", function() {
253
- expect(1);
254
- ok( $("p").get(0) == document.getElementById("firstp"), "Get A Single Element" );
254
+ expect(1);
255
+ ok( $("p").get(0) == document.getElementById("firstp"), "Get A Single Element" );
255
256
  });
256
257
 
257
258
  test("add(String|Element|Array|undefined)", function() {
258
- expect(8);
259
- isSet( $("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
260
- isSet( $("#sndp").add( $("#en")[0] ).add( $("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" );
261
- ok( $([]).add($("#form")[0].elements).length >= 13, "Check elements from array" );
262
-
263
- // For the time being, we're discontinuing support for $(form.elements) since it's ambiguous in IE
264
- // use $([]).add(form.elements) instead.
265
- //equals( $([]).add($("#form")[0].elements).length, $($("#form")[0].elements).length, "Array in constructor must equals array in add()" );
266
-
267
- var x = $([]).add($("<p id='x1'>xxx</p>")).add($("<p id='x2'>xxx</p>"));
268
- ok( x[0].id == "x1", "Check on-the-fly element1" );
269
- ok( x[1].id == "x2", "Check on-the-fly element2" );
270
-
271
- var x = $([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");
272
- ok( x[0].id == "x1", "Check on-the-fly element1" );
273
- ok( x[1].id == "x2", "Check on-the-fly element2" );
274
-
275
- var notDefined;
276
- equals( $([]).add(notDefined).length, 0, "Check that undefined adds nothing." );
259
+ expect(8);
260
+ isSet( $("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
261
+ isSet( $("#sndp").add( $("#en")[0] ).add( $("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" );
262
+
263
+ // FIXME wtf. for some reason, this totally breaks. I have
264
+ // no idea why... The problem boils down to this line though:
265
+ // $("#form");
266
+ ok( $([]).add($("#form")[0].elements).length >= 13, "Check elements from array" );
267
+
268
+ // For the time being, we're discontinuing support for $(form.elements) since it's ambiguous in IE
269
+ // use $([]).add(form.elements) instead.
270
+ //equals( $([]).add($("#form")[0].elements).length, $($("#form")[0].elements).length, "Array in constructor must equals array in add()" );
271
+
272
+ var x = $([]).add($("<p id='x1'>xxx</p>")).add($("<p id='x2'>xxx</p>"));
273
+ ok( x[0].id == "x1", "Check on-the-fly element1" );
274
+ ok( x[1].id == "x2", "Check on-the-fly element2" );
275
+
276
+ var x = $([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");
277
+ ok( x[0].id == "x1", "Check on-the-fly element1" );
278
+ ok( x[1].id == "x2", "Check on-the-fly element2" );
279
+
280
+ var notDefined;
281
+ equals( $([]).add(notDefined).length, 0, "Check that undefined adds nothing." );
277
282
  });
278
283
 
279
284
  test("each(Function)", function() {
280
- expect(1);
281
- var div = $("div");
282
- div.each(function(){this.foo = 'zoo';});
283
- var pass = true;
284
- for ( var i = 0; i < div.size(); i++ ) {
285
- if ( div.get(i).foo != "zoo" ) pass = false;
286
- }
287
- ok( pass, "Execute a function, Relative" );
285
+ expect(1);
286
+ var div = $("div");
287
+ div.each(function(){this.foo = 'zoo';});
288
+ var pass = true;
289
+ for ( var i = 0; i < div.size(); i++ ) {
290
+ if ( div.get(i).foo != "zoo" ) pass = false;
291
+ }
292
+ ok( pass, "Execute a function, Relative" );
288
293
  });
289
294
 
290
295
  test("index(Object)", function() {
291
- expect(8);
292
- ok( $([window, document]).index(window) == 0, "Check for index of elements" );
293
- ok( $([window, document]).index(document) == 1, "Check for index of elements" );
294
- var inputElements = $('#radio1,#radio2,#check1,#check2');
295
- ok( inputElements.index(document.getElementById('radio1')) == 0, "Check for index of elements" );
296
- ok( inputElements.index(document.getElementById('radio2')) == 1, "Check for index of elements" );
297
- ok( inputElements.index(document.getElementById('check1')) == 2, "Check for index of elements" );
298
- ok( inputElements.index(document.getElementById('check2')) == 3, "Check for index of elements" );
299
- ok( inputElements.index(window) == -1, "Check for not found index" );
300
- ok( inputElements.index(document) == -1, "Check for not found index" );
296
+ expect(8);
297
+ ok( $([window, document]).index(window) == 0, "Check for index of elements" );
298
+ ok( $([window, document]).index(document) == 1, "Check for index of elements" );
299
+ var inputElements = $('#radio1,#radio2,#check1,#check2');
300
+ ok( inputElements.index(document.getElementById('radio1')) == 0, "Check for index of elements" );
301
+ ok( inputElements.index(document.getElementById('radio2')) == 1, "Check for index of elements" );
302
+ ok( inputElements.index(document.getElementById('check1')) == 2, "Check for index of elements" );
303
+ ok( inputElements.index(document.getElementById('check2')) == 3, "Check for index of elements" );
304
+ ok( inputElements.index(window) == -1, "Check for not found index" );
305
+ ok( inputElements.index(document) == -1, "Check for not found index" );
301
306
  });
302
307
 
303
308
  test("attr(String)", function() {
@@ -327,776 +332,776 @@ test("attr(String)", function() {
327
332
  });
328
333
 
329
334
  if ( !isLocal ) {
330
- test("attr(String) in XML Files", function() {
331
- expect(2);
332
- stop();
333
- $.get("data/dashboard.xml", function(xml) {
334
- ok( $("locations", xml).attr("class") == "foo", "Check class attribute in XML document" );
335
- ok( $("location", xml).attr("for") == "bar", "Check for attribute in XML document" );
336
- start();
337
- });
338
- });
335
+ test("attr(String) in XML Files", function() {
336
+ expect(2);
337
+ stop();
338
+ $.get("data/dashboard.xml", function(xml) {
339
+ ok( $("locations", xml).attr("class") == "foo", "Check class attribute in XML document" );
340
+ ok( $("location", xml).attr("for") == "bar", "Check for attribute in XML document" );
341
+ start();
342
+ });
343
+ });
339
344
  }
340
345
 
341
346
  test("attr(String, Function)", function() {
342
- expect(2);
343
- ok( $('#text1').attr('value', function() { return this.id })[0].value == "text1", "Set value from id" );
344
- ok( $('#text1').attr('title', function(i) { return i }).attr('title') == "0", "Set value with an index");
347
+ expect(2);
348
+ ok( $('#text1').attr('value', function() { return this.id })[0].value == "text1", "Set value from id" );
349
+ ok( $('#text1').attr('title', function(i) { return i }).attr('title') == "0", "Set value with an index");
345
350
  });
346
351
 
347
352
  test("attr(Hash)", function() {
348
- expect(1);
349
- var pass = true;
350
- $("div").attr({foo: 'baz', zoo: 'ping'}).each(function(){
351
- if ( this.getAttribute('foo') != "baz" && this.getAttribute('zoo') != "ping" ) pass = false;
352
- });
353
- ok( pass, "Set Multiple Attributes" );
353
+ expect(1);
354
+ var pass = true;
355
+ $("div").attr({foo: 'baz', zoo: 'ping'}).each(function(){
356
+ if ( this.getAttribute('foo') != "baz" && this.getAttribute('zoo') != "ping" ) pass = false;
357
+ });
358
+ ok( pass, "Set Multiple Attributes" );
354
359
  });
355
360
 
356
361
  test("attr(String, Object)", function() {
357
- expect(17);
358
- var div = $("div");
359
- div.attr("foo", "bar");
360
- var pass = true;
361
- for ( var i = 0; i < div.size(); i++ ) {
362
- if ( div.get(i).getAttribute('foo') != "bar" ) pass = false;
363
- }
364
- ok( pass, "Set Attribute" );
365
-
366
- ok( $("#foo").attr({"width": null}), "Try to set an attribute to nothing" );
367
-
368
- $("#name").attr('name', 'something');
369
- ok( $("#name").attr('name') == 'something', 'Set name attribute' );
370
- $("#check2").attr('checked', true);
371
- ok( document.getElementById('check2').checked == true, 'Set checked attribute' );
372
- $("#check2").attr('checked', false);
373
- ok( document.getElementById('check2').checked == false, 'Set checked attribute' );
374
- $("#text1").attr('readonly', true);
375
- ok( document.getElementById('text1').readOnly == true, 'Set readonly attribute' );
376
- $("#text1").attr('readonly', false);
377
- ok( document.getElementById('text1').readOnly == false, 'Set readonly attribute' );
378
- $("#name").attr('maxlength', '5');
379
- ok( document.getElementById('name').maxLength == '5', 'Set maxlength attribute' );
380
- $("#name").attr('maxLength', '10');
381
- ok( document.getElementById('name').maxLength == '10', 'Set maxlength attribute' );
382
-
383
- // for #1070
384
- $("#name").attr('someAttr', '0');
385
- equals( $("#name").attr('someAttr'), '0', 'Set attribute to a string of "0"' );
386
- $("#name").attr('someAttr', 0);
387
- equals( $("#name").attr('someAttr'), 0, 'Set attribute to the number 0' );
388
- $("#name").attr('someAttr', 1);
389
- equals( $("#name").attr('someAttr'), 1, 'Set attribute to the number 1' );
390
-
391
- // using contents will get comments regular, text, and comment nodes
392
- var j = $("#nonnodes").contents();
393
-
394
- j.attr("name", "attrvalue");
395
- equals( j.attr("name"), "attrvalue", "Check node,textnode,comment for attr" );
396
- j.removeAttr("name")
397
-
398
- reset();
399
-
400
- var type = $("#check2").attr('type');
401
- var thrown = false;
402
- try {
403
- $("#check2").attr('type','hidden');
404
- } catch(e) {
405
- thrown = true;
406
- }
407
- ok( thrown, "Exception thrown when trying to change type property" );
408
- equals( type, $("#check2").attr('type'), "Verify that you can't change the type of an input element" );
409
-
410
- var check = document.createElement("input");
411
- var thrown = true;
412
- try {
413
- $(check).attr('type','checkbox');
414
- } catch(e) {
415
- thrown = false;
416
- }
417
- ok( thrown, "Exception thrown when trying to change type property" );
418
- equals( "checkbox", $(check).attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" );
362
+ expect(17);
363
+ var div = $("div");
364
+ div.attr("foo", "bar");
365
+ var pass = true;
366
+ for ( var i = 0; i < div.size(); i++ ) {
367
+ if ( div.get(i).getAttribute('foo') != "bar" ) pass = false;
368
+ }
369
+ ok( pass, "Set Attribute" );
370
+
371
+ ok( $("#foo").attr({"width": null}), "Try to set an attribute to nothing" );
372
+
373
+ $("#name").attr('name', 'something');
374
+ ok( $("#name").attr('name') == 'something', 'Set name attribute' );
375
+ $("#check2").attr('checked', true);
376
+ ok( document.getElementById('check2').checked == true, 'Set checked attribute' );
377
+ $("#check2").attr('checked', false);
378
+ ok( document.getElementById('check2').checked == false, 'Set checked attribute' );
379
+ $("#text1").attr('readonly', true);
380
+ ok( document.getElementById('text1').readOnly == true, 'Set readonly attribute' );
381
+ $("#text1").attr('readonly', false);
382
+ ok( document.getElementById('text1').readOnly == false, 'Set readonly attribute' );
383
+ $("#name").attr('maxlength', '5');
384
+ ok( document.getElementById('name').maxLength == '5', 'Set maxlength attribute' );
385
+ $("#name").attr('maxLength', '10');
386
+ ok( document.getElementById('name').maxLength == '10', 'Set maxlength attribute' );
387
+
388
+ // for #1070
389
+ $("#name").attr('someAttr', '0');
390
+ equals( $("#name").attr('someAttr'), '0', 'Set attribute to a string of "0"' );
391
+ $("#name").attr('someAttr', 0);
392
+ equals( $("#name").attr('someAttr'), 0, 'Set attribute to the number 0' );
393
+ $("#name").attr('someAttr', 1);
394
+ equals( $("#name").attr('someAttr'), 1, 'Set attribute to the number 1' );
395
+
396
+ // using contents will get comments regular, text, and comment nodes
397
+ var j = $("#nonnodes").contents();
398
+
399
+ j.attr("name", "attrvalue");
400
+ equals( j.attr("name"), "attrvalue", "Check node,textnode,comment for attr" );
401
+ j.removeAttr("name")
402
+
403
+ reset();
404
+
405
+ var type = $("#check2").attr('type');
406
+ var thrown = false;
407
+ try {
408
+ $("#check2").attr('type','hidden');
409
+ } catch(e) {
410
+ thrown = true;
411
+ }
412
+ ok( thrown, "Exception thrown when trying to change type property" );
413
+ equals( type, $("#check2").attr('type'), "Verify that you can't change the type of an input element" );
414
+
415
+ var check = document.createElement("input");
416
+ var thrown = true;
417
+ try {
418
+ $(check).attr('type','checkbox');
419
+ } catch(e) {
420
+ thrown = false;
421
+ }
422
+ ok( thrown, "Exception thrown when trying to change type property" );
423
+ equals( "checkbox", $(check).attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" );
419
424
  });
420
425
 
421
426
  if ( !isLocal ) {
422
- test("attr(String, Object) - Loaded via XML document", function() {
423
- expect(2);
424
- stop();
425
- $.get('data/dashboard.xml', function(xml) {
426
- var titles = [];
427
- $('tab', xml).each(function() {
428
- titles.push($(this).attr('title'));
429
- });
430
- equals( titles[0], 'Location', 'attr() in XML context: Check first title' );
431
- equals( titles[1], 'Users', 'attr() in XML context: Check second title' );
432
- start();
433
- });
434
- });
427
+ test("attr(String, Object) - Loaded via XML document", function() {
428
+ expect(2);
429
+ stop();
430
+ $.get('data/dashboard.xml', function(xml) {
431
+ var titles = [];
432
+ $('tab', xml).each(function() {
433
+ titles.push($(this).attr('title'));
434
+ });
435
+ equals( titles[0], 'Location', 'attr() in XML context: Check first title' );
436
+ equals( titles[1], 'Users', 'attr() in XML context: Check second title' );
437
+ start();
438
+ });
439
+ });
435
440
  }
436
441
 
437
442
  test("css(String|Hash)", function() {
438
- expect(19);
439
-
440
- ok( $('#main').css("display") == 'none', 'Check for css property "display"');
441
-
442
- ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');
443
- $('#foo').css({display: 'none'});
444
- ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden');
445
- $('#foo').css({display: 'block'});
446
- ok( $('#foo').is(':visible'), 'Modified CSS display: Assert element is visible');
447
-
448
- $('#floatTest').css({styleFloat: 'right'});
449
- ok( $('#floatTest').css('styleFloat') == 'right', 'Modified CSS float using "styleFloat": Assert float is right');
450
- $('#floatTest').css({cssFloat: 'left'});
451
- ok( $('#floatTest').css('cssFloat') == 'left', 'Modified CSS float using "cssFloat": Assert float is left');
452
- $('#floatTest').css({'float': 'right'});
453
- ok( $('#floatTest').css('float') == 'right', 'Modified CSS float using "float": Assert float is right');
454
- $('#floatTest').css({'font-size': '30px'});
455
- ok( $('#floatTest').css('font-size') == '30px', 'Modified CSS font-size: Assert font-size is 30px');
456
-
457
- $.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
458
- $('#foo').css({opacity: n});
459
- ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
460
- $('#foo').css({opacity: parseFloat(n)});
461
- ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
462
- });
463
- $('#foo').css({opacity: ''});
464
- ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );
443
+ expect(19);
444
+
445
+ ok( $('#main').css("display") == 'none', 'Check for css property "display"');
446
+
447
+ ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');
448
+ $('#foo').css({display: 'none'});
449
+ ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden');
450
+ $('#foo').css({display: 'block'});
451
+ ok( $('#foo').is(':visible'), 'Modified CSS display: Assert element is visible');
452
+
453
+ $('#floatTest').css({styleFloat: 'right'});
454
+ ok( $('#floatTest').css('styleFloat') == 'right', 'Modified CSS float using "styleFloat": Assert float is right');
455
+ $('#floatTest').css({cssFloat: 'left'});
456
+ ok( $('#floatTest').css('cssFloat') == 'left', 'Modified CSS float using "cssFloat": Assert float is left');
457
+ $('#floatTest').css({'float': 'right'});
458
+ ok( $('#floatTest').css('float') == 'right', 'Modified CSS float using "float": Assert float is right');
459
+ $('#floatTest').css({'font-size': '30px'});
460
+ ok( $('#floatTest').css('font-size') == '30px', 'Modified CSS font-size: Assert font-size is 30px');
461
+
462
+ $.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
463
+ $('#foo').css({opacity: n});
464
+ ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
465
+ $('#foo').css({opacity: parseFloat(n)});
466
+ ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
467
+ });
468
+ $('#foo').css({opacity: ''});
469
+ ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );
465
470
  });
466
471
 
467
472
  test("css(String, Object)", function() {
468
- expect(21);
469
- ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');
470
- $('#foo').css('display', 'none');
471
- ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden');
472
- $('#foo').css('display', 'block');
473
- ok( $('#foo').is(':visible'), 'Modified CSS display: Assert element is visible');
474
-
475
- $('#floatTest').css('styleFloat', 'left');
476
- ok( $('#floatTest').css('styleFloat') == 'left', 'Modified CSS float using "styleFloat": Assert float is left');
477
- $('#floatTest').css('cssFloat', 'right');
478
- ok( $('#floatTest').css('cssFloat') == 'right', 'Modified CSS float using "cssFloat": Assert float is right');
479
- $('#floatTest').css('float', 'left');
480
- ok( $('#floatTest').css('float') == 'left', 'Modified CSS float using "float": Assert float is left');
481
- $('#floatTest').css('font-size', '20px');
482
- ok( $('#floatTest').css('font-size') == '20px', 'Modified CSS font-size: Assert font-size is 20px');
483
-
484
- $.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
485
- $('#foo').css('opacity', n);
486
- ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
487
- $('#foo').css('opacity', parseFloat(n));
488
- ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
489
- });
490
- $('#foo').css('opacity', '');
491
- ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );
492
- // for #1438, IE throws JS error when filter exists but doesn't have opacity in it
493
- if (jQuery.browser.msie) {
494
- $('#foo').css("filter", "progid:DXImageTransform.Microsoft.Chroma(color='red');");
495
- }
496
- equals( $('#foo').css('opacity'), '1', "Assert opacity is 1 when a different filter is set in IE, #1438" );
497
-
498
- // using contents will get comments regular, text, and comment nodes
499
- var j = $("#nonnodes").contents();
500
- j.css("padding-left", "1px");
501
- equals( j.css("padding-left"), "1px", "Check node,textnode,comment css works" );
502
-
503
- // opera sometimes doesn't update 'display' correctly, see #2037
504
- $("#t2037")[0].innerHTML = $("#t2037")[0].innerHTML
505
- equals( $("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" );
473
+ expect(21);
474
+ ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');
475
+ $('#foo').css('display', 'none');
476
+ ok( !$('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden');
477
+ $('#foo').css('display', 'block');
478
+ ok( $('#foo').is(':visible'), 'Modified CSS display: Assert element is visible');
479
+
480
+ $('#floatTest').css('styleFloat', 'left');
481
+ ok( $('#floatTest').css('styleFloat') == 'left', 'Modified CSS float using "styleFloat": Assert float is left');
482
+ $('#floatTest').css('cssFloat', 'right');
483
+ ok( $('#floatTest').css('cssFloat') == 'right', 'Modified CSS float using "cssFloat": Assert float is right');
484
+ $('#floatTest').css('float', 'left');
485
+ ok( $('#floatTest').css('float') == 'left', 'Modified CSS float using "float": Assert float is left');
486
+ $('#floatTest').css('font-size', '20px');
487
+ ok( $('#floatTest').css('font-size') == '20px', 'Modified CSS font-size: Assert font-size is 20px');
488
+
489
+ $.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
490
+ $('#foo').css('opacity', n);
491
+ ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
492
+ $('#foo').css('opacity', parseFloat(n));
493
+ ok( $('#foo').css('opacity') == parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
494
+ });
495
+ $('#foo').css('opacity', '');
496
+ ok( $('#foo').css('opacity') == '1', "Assert opacity is 1 when set to an empty String" );
497
+ // for #1438, IE throws JS error when filter exists but doesn't have opacity in it
498
+ if (jQuery.browser.msie) {
499
+ $('#foo').css("filter", "progid:DXImageTransform.Microsoft.Chroma(color='red');");
500
+ }
501
+ equals( $('#foo').css('opacity'), '1', "Assert opacity is 1 when a different filter is set in IE, #1438" );
502
+
503
+ // using contents will get comments regular, text, and comment nodes
504
+ var j = $("#nonnodes").contents();
505
+ j.css("padding-left", "1px");
506
+ equals( j.css("padding-left"), "1px", "Check node,textnode,comment css works" );
507
+
508
+ // opera sometimes doesn't update 'display' correctly, see #2037
509
+ $("#t2037")[0].innerHTML = $("#t2037")[0].innerHTML
510
+ equals( $("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" );
506
511
  });
507
512
 
508
513
  test("jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () {
509
- expect(4);
514
+ expect(4);
510
515
 
511
- var $checkedtest = $("#checkedtest");
512
- // IE6 was clearing "checked" in jQuery.css(elem, "height");
513
- jQuery.css($checkedtest[0], "height");
514
- ok( !! $(":radio:first", $checkedtest).attr("checked"), "Check first radio still checked." );
515
- ok( ! $(":radio:last", $checkedtest).attr("checked"), "Check last radio still NOT checked." );
516
- ok( !! $(":checkbox:first", $checkedtest).attr("checked"), "Check first checkbox still checked." );
517
- ok( ! $(":checkbox:last", $checkedtest).attr("checked"), "Check last checkbox still NOT checked." );
516
+ var $checkedtest = $("#checkedtest");
517
+ // IE6 was clearing "checked" in jQuery.css(elem, "height");
518
+ jQuery.css($checkedtest[0], "height");
519
+ ok( !! $(":radio:first", $checkedtest).attr("checked"), "Check first radio still checked." );
520
+ ok( ! $(":radio:last", $checkedtest).attr("checked"), "Check last radio still NOT checked." );
521
+ ok( !! $(":checkbox:first", $checkedtest).attr("checked"), "Check first checkbox still checked." );
522
+ ok( ! $(":checkbox:last", $checkedtest).attr("checked"), "Check last checkbox still NOT checked." );
518
523
  });
519
524
 
520
525
  test("width()", function() {
521
- expect(9);
522
-
523
- var $div = $("#nothiddendiv");
524
- $div.width(30);
525
- equals($div.width(), 30, "Test set to 30 correctly");
526
- $div.width(-1); // handle negative numbers by ignoring #1599
527
- equals($div.width(), 30, "Test negative width ignored");
528
- $div.css("padding", "20px");
529
- equals($div.width(), 30, "Test padding specified with pixels");
530
- $div.css("border", "2px solid #fff");
531
- equals($div.width(), 30, "Test border specified with pixels");
532
- $div.css("padding", "2em");
533
- equals($div.width(), 30, "Test padding specified with ems");
534
- $div.css("border", "1em solid #fff");
535
- equals($div.width(), 30, "Test border specified with ems");
536
- $div.css("padding", "2%");
537
- equals($div.width(), 30, "Test padding specified with percent");
538
- $div.hide();
539
- equals($div.width(), 30, "Test hidden div");
540
-
541
- $div.css({ display: "", border: "", padding: "" });
542
-
543
- $("#nothiddendivchild").css({ padding: "3px", border: "2px solid #fff" });
544
- equals($("#nothiddendivchild").width(), 20, "Test child width with border and padding");
545
- $("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", width: "" });
526
+ expect(9);
527
+
528
+ var $div = $("#nothiddendiv");
529
+ $div.width(30);
530
+ equals($div.width(), 30, "Test set to 30 correctly");
531
+ $div.width(-1); // handle negative numbers by ignoring #1599
532
+ equals($div.width(), 30, "Test negative width ignored");
533
+ $div.css("padding", "20px");
534
+ equals($div.width(), 30, "Test padding specified with pixels");
535
+ $div.css("border", "2px solid #fff");
536
+ equals($div.width(), 30, "Test border specified with pixels");
537
+ $div.css("padding", "2em");
538
+ equals($div.width(), 30, "Test padding specified with ems");
539
+ $div.css("border", "1em solid #fff");
540
+ equals($div.width(), 30, "Test border specified with ems");
541
+ $div.css("padding", "2%");
542
+ equals($div.width(), 30, "Test padding specified with percent");
543
+ $div.hide();
544
+ equals($div.width(), 30, "Test hidden div");
545
+
546
+ $div.css({ display: "", border: "", padding: "" });
547
+
548
+ $("#nothiddendivchild").css({ padding: "3px", border: "2px solid #fff" });
549
+ equals($("#nothiddendivchild").width(), 20, "Test child width with border and padding");
550
+ $("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", width: "" });
546
551
  });
547
552
 
548
553
  test("height()", function() {
549
- expect(8);
550
-
551
- var $div = $("#nothiddendiv");
552
- $div.height(30);
553
- equals($div.height(), 30, "Test set to 30 correctly");
554
- $div.height(-1); // handle negative numbers by ignoring #1599
555
- equals($div.height(), 30, "Test negative height ignored");
556
- $div.css("padding", "20px");
557
- equals($div.height(), 30, "Test padding specified with pixels");
558
- $div.css("border", "2px solid #fff");
559
- equals($div.height(), 30, "Test border specified with pixels");
560
- $div.css("padding", "2em");
561
- equals($div.height(), 30, "Test padding specified with ems");
562
- $div.css("border", "1em solid #fff");
563
- equals($div.height(), 30, "Test border specified with ems");
564
- $div.css("padding", "2%");
565
- equals($div.height(), 30, "Test padding specified with percent");
566
- $div.hide();
567
- equals($div.height(), 30, "Test hidden div");
568
-
569
- $div.css({ display: "", border: "", padding: "", height: "1px" });
554
+ expect(8);
555
+
556
+ var $div = $("#nothiddendiv");
557
+ $div.height(30);
558
+ equals($div.height(), 30, "Test set to 30 correctly");
559
+ $div.height(-1); // handle negative numbers by ignoring #1599
560
+ equals($div.height(), 30, "Test negative height ignored");
561
+ $div.css("padding", "20px");
562
+ equals($div.height(), 30, "Test padding specified with pixels");
563
+ $div.css("border", "2px solid #fff");
564
+ equals($div.height(), 30, "Test border specified with pixels");
565
+ $div.css("padding", "2em");
566
+ equals($div.height(), 30, "Test padding specified with ems");
567
+ $div.css("border", "1em solid #fff");
568
+ equals($div.height(), 30, "Test border specified with ems");
569
+ $div.css("padding", "2%");
570
+ equals($div.height(), 30, "Test padding specified with percent");
571
+ $div.hide();
572
+ equals($div.height(), 30, "Test hidden div");
573
+
574
+ $div.css({ display: "", border: "", padding: "", height: "1px" });
570
575
  });
571
576
 
572
577
  test("text()", function() {
573
- expect(1);
574
- var expected = "This link has class=\"blog\": Simon Willison's Weblog";
575
- ok( $('#sap').text() == expected, 'Check for merged text of more then one element.' );
578
+ expect(1);
579
+ var expected = "This link has class=\"blog\": Simon Willison's Weblog";
580
+ ok( $('#sap').text() == expected, 'Check for merged text of more then one element.' );
576
581
  });
577
582
 
578
583
  test("wrap(String|Element)", function() {
579
- expect(8);
580
- var defaultText = 'Try them out:'
581
- var result = $('#first').wrap('<div class="red"><span></span></div>').text();
582
- ok( defaultText == result, 'Check for wrapping of on-the-fly html' );
583
- ok( $('#first').parent().parent().is('.red'), 'Check if wrapper has class "red"' );
584
-
585
- reset();
586
- var defaultText = 'Try them out:'
587
- var result = $('#first').wrap(document.getElementById('empty')).parent();
588
- ok( result.is('ol'), 'Check for element wrapping' );
589
- ok( result.text() == defaultText, 'Check for element wrapping' );
590
-
591
- reset();
592
- $('#check1').click(function() {
593
- var checkbox = this;
594
- ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" );
595
- $(checkbox).wrap( '<div id="c1" style="display:none;"></div>' );
596
- ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" );
597
- }).click();
598
-
599
- // using contents will get comments regular, text, and comment nodes
600
- var j = $("#nonnodes").contents();
601
- j.wrap("<i></i>");
602
- equals( $("#nonnodes > i").length, 3, "Check node,textnode,comment wraps ok" );
603
- equals( $("#nonnodes > i").text(), j.text() + j[1].nodeValue, "Check node,textnode,comment wraps doesn't hurt text" );
584
+ expect(8);
585
+ var defaultText = 'Try them out:'
586
+ var result = $('#first').wrap('<div class="red"><span></span></div>').text();
587
+ ok( defaultText == result, 'Check for wrapping of on-the-fly html' );
588
+ ok( $('#first').parent().parent().is('.red'), 'Check if wrapper has class "red"' );
589
+
590
+ reset();
591
+ var defaultText = 'Try them out:'
592
+ var result = $('#first').wrap(document.getElementById('empty')).parent();
593
+ ok( result.is('ol'), 'Check for element wrapping' );
594
+ ok( result.text() == defaultText, 'Check for element wrapping' );
595
+
596
+ reset();
597
+ $('#check1').click(function() {
598
+ var checkbox = this;
599
+ ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" );
600
+ $(checkbox).wrap( '<div id="c1" style="display:none;"></div>' );
601
+ ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" );
602
+ }).click();
603
+
604
+ // using contents will get comments regular, text, and comment nodes
605
+ var j = $("#nonnodes").contents();
606
+ j.wrap("<i></i>");
607
+ equals( $("#nonnodes > i").length, 3, "Check node,textnode,comment wraps ok" );
608
+ equals( $("#nonnodes > i").text(), j.text() + j[1].nodeValue, "Check node,textnode,comment wraps doesn't hurt text" );
604
609
  });
605
610
 
606
611
  test("wrapAll(String|Element)", function() {
607
- expect(8);
608
- var prev = $("#first")[0].previousSibling;
609
- var p = $("#first")[0].parentNode;
610
- var result = $('#first,#firstp').wrapAll('<div class="red"><div id="tmp"></div></div>');
611
- equals( result.parent().length, 1, 'Check for wrapping of on-the-fly html' );
612
- ok( $('#first').parent().parent().is('.red'), 'Check if wrapper has class "red"' );
613
- ok( $('#firstp').parent().parent().is('.red'), 'Check if wrapper has class "red"' );
614
- equals( $("#first").parent().parent()[0].previousSibling, prev, "Correct Previous Sibling" );
615
- equals( $("#first").parent().parent()[0].parentNode, p, "Correct Parent" );
616
-
617
- reset();
618
- var prev = $("#first")[0].previousSibling;
619
- var p = $("#first")[0].parentNode;
620
- var result = $('#first,#firstp').wrapAll(document.getElementById('empty'));
621
- equals( $("#first").parent()[0], $("#firstp").parent()[0], "Same Parent" );
622
- equals( $("#first").parent()[0].previousSibling, prev, "Correct Previous Sibling" );
623
- equals( $("#first").parent()[0].parentNode, p, "Correct Parent" );
612
+ expect(8);
613
+ var prev = $("#first")[0].previousSibling;
614
+ var p = $("#first")[0].parentNode;
615
+ var result = $('#first,#firstp').wrapAll('<div class="red"><div id="tmp"></div></div>');
616
+ equals( result.parent().length, 1, 'Check for wrapping of on-the-fly html' );
617
+ ok( $('#first').parent().parent().is('.red'), 'Check if wrapper has class "red"' );
618
+ ok( $('#firstp').parent().parent().is('.red'), 'Check if wrapper has class "red"' );
619
+ equals( $("#first").parent().parent()[0].previousSibling, prev, "Correct Previous Sibling" );
620
+ equals( $("#first").parent().parent()[0].parentNode, p, "Correct Parent" );
621
+
622
+ reset();
623
+ var prev = $("#first")[0].previousSibling;
624
+ var p = $("#first")[0].parentNode;
625
+ var result = $('#first,#firstp').wrapAll(document.getElementById('empty'));
626
+ equals( $("#first").parent()[0], $("#firstp").parent()[0], "Same Parent" );
627
+ equals( $("#first").parent()[0].previousSibling, prev, "Correct Previous Sibling" );
628
+ equals( $("#first").parent()[0].parentNode, p, "Correct Parent" );
624
629
  });
625
630
 
626
631
  test("wrapInner(String|Element)", function() {
627
- expect(6);
628
- var num = $("#first").children().length;
629
- var result = $('#first').wrapInner('<div class="red"><div id="tmp"></div></div>');
630
- equals( $("#first").children().length, 1, "Only one child" );
631
- ok( $("#first").children().is(".red"), "Verify Right Element" );
632
- equals( $("#first").children().children().children().length, num, "Verify Elements Intact" );
632
+ expect(6);
633
+ var num = $("#first").children().length;
634
+ var result = $('#first').wrapInner('<div class="red"><div id="tmp"></div></div>');
635
+ equals( $("#first").children().length, 1, "Only one child" );
636
+ ok( $("#first").children().is(".red"), "Verify Right Element" );
637
+ equals( $("#first").children().children().children().length, num, "Verify Elements Intact" );
633
638
 
634
- reset();
635
- var num = $("#first").children().length;
636
- var result = $('#first').wrapInner(document.getElementById('empty'));
637
- equals( $("#first").children().length, 1, "Only one child" );
638
- ok( $("#first").children().is("#empty"), "Verify Right Element" );
639
- equals( $("#first").children().children().length, num, "Verify Elements Intact" );
639
+ reset();
640
+ var num = $("#first").children().length;
641
+ var result = $('#first').wrapInner(document.getElementById('empty'));
642
+ equals( $("#first").children().length, 1, "Only one child" );
643
+ ok( $("#first").children().is("#empty"), "Verify Right Element" );
644
+ equals( $("#first").children().children().length, num, "Verify Elements Intact" );
640
645
  });
641
646
 
642
647
  test("append(String|Element|Array&lt;Element&gt;|jQuery)", function() {
643
- expect(21);
644
- var defaultText = 'Try them out:'
645
- var result = $('#first').append('<b>buga</b>');
646
- ok( result.text() == defaultText + 'buga', 'Check if text appending works' );
647
- ok( $('#select3').append('<option value="appendTest">Append Test</option>').find('option:last-child').attr('value') == 'appendTest', 'Appending html options to select element');
648
-
649
- reset();
650
- var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
651
- $('#sap').append(document.getElementById('first'));
652
- ok( expected == $('#sap').text(), "Check for appending of element" );
653
-
654
- reset();
655
- expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
656
- $('#sap').append([document.getElementById('first'), document.getElementById('yahoo')]);
657
- ok( expected == $('#sap').text(), "Check for appending of array of elements" );
658
-
659
- reset();
660
- expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
661
- $('#sap').append($("#first, #yahoo"));
662
- ok( expected == $('#sap').text(), "Check for appending of jQuery object" );
663
-
664
- reset();
665
- $("#sap").append( 5 );
666
- ok( $("#sap")[0].innerHTML.match( /5$/ ), "Check for appending a number" );
667
-
668
- reset();
669
- $("#sap").append( " text with spaces " );
670
- ok( $("#sap")[0].innerHTML.match(/ text with spaces $/), "Check for appending text with spaces" );
671
-
672
- reset();
673
- ok( $("#sap").append([]), "Check for appending an empty array." );
674
- ok( $("#sap").append(""), "Check for appending an empty string." );
675
- ok( $("#sap").append(document.getElementsByTagName("foo")), "Check for appending an empty nodelist." );
676
-
677
- reset();
678
- $("#sap").append(document.getElementById('form'));
679
- ok( $("#sap>form").size() == 1, "Check for appending a form" ); // Bug #910
680
-
681
- reset();
682
- var pass = true;
683
- try {
684
- $( $("#iframe")[0].contentWindow.document.body ).append("<div>test</div>");
685
- } catch(e) {
686
- pass = false;
687
- }
688
-
689
- ok( pass, "Test for appending a DOM node to the contents of an IFrame" );
690
-
691
- reset();
692
- $('<fieldset/>').appendTo('#form').append('<legend id="legend">test</legend>');
693
- t( 'Append legend', '#legend', ['legend'] );
694
-
695
- reset();
696
- $('#select1').append('<OPTION>Test</OPTION>');
697
- ok( $('#select1 option:last').text() == "Test", "Appending &lt;OPTION&gt; (all caps)" );
698
-
699
- $('#table').append('<colgroup></colgroup>');
700
- ok( $('#table colgroup').length, "Append colgroup" );
701
-
702
- $('#table colgroup').append('<col/>');
703
- ok( $('#table colgroup col').length, "Append col" );
704
-
705
- reset();
706
- $('#table').append('<caption></caption>');
707
- ok( $('#table caption').length, "Append caption" );
708
-
709
- reset();
710
- $('form:last')
711
- .append('<select id="appendSelect1"></select>')
712
- .append('<select id="appendSelect2"><option>Test</option></select>');
713
-
714
- t( "Append Select", "#appendSelect1, #appendSelect2", ["appendSelect1", "appendSelect2"] );
715
-
716
- // using contents will get comments regular, text, and comment nodes
717
- var j = $("#nonnodes").contents();
718
- var d = $("<div/>").appendTo("#nonnodes").append(j);
719
- equals( $("#nonnodes").length, 1, "Check node,textnode,comment append moved leaving just the div" );
720
- ok( d.contents().length >= 2, "Check node,textnode,comment append works" );
721
- d.contents().appendTo("#nonnodes");
722
- d.remove();
723
- ok( $("#nonnodes").contents().length >= 2, "Check node,textnode,comment append cleanup worked" );
648
+ expect(21);
649
+ var defaultText = 'Try them out:'
650
+ var result = $('#first').append('<b>buga</b>');
651
+ ok( result.text() == defaultText + 'buga', 'Check if text appending works' );
652
+ ok( $('#select3').append('<option value="appendTest">Append Test</option>').find('option:last-child').attr('value') == 'appendTest', 'Appending html options to select element');
653
+
654
+ reset();
655
+ var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
656
+ $('#sap').append(document.getElementById('first'));
657
+ ok( expected == $('#sap').text(), "Check for appending of element" );
658
+
659
+ reset();
660
+ expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
661
+ $('#sap').append([document.getElementById('first'), document.getElementById('yahoo')]);
662
+ ok( expected == $('#sap').text(), "Check for appending of array of elements" );
663
+
664
+ reset();
665
+ expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
666
+ $('#sap').append($("#first, #yahoo"));
667
+ ok( expected == $('#sap').text(), "Check for appending of jQuery object" );
668
+
669
+ reset();
670
+ $("#sap").append( 5 );
671
+ ok( $("#sap")[0].innerHTML.match( /5$/ ), "Check for appending a number" );
672
+
673
+ reset();
674
+ $("#sap").append( " text with spaces " );
675
+ ok( $("#sap")[0].innerHTML.match(/ text with spaces $/), "Check for appending text with spaces" );
676
+
677
+ reset();
678
+ ok( $("#sap").append([]), "Check for appending an empty array." );
679
+ ok( $("#sap").append(""), "Check for appending an empty string." );
680
+ ok( $("#sap").append(document.getElementsByTagName("foo")), "Check for appending an empty nodelist." );
681
+
682
+ reset();
683
+ $("#sap").append(document.getElementById('form'));
684
+ ok( $("#sap>form").size() == 1, "Check for appending a form" ); // Bug #910
685
+
686
+ reset();
687
+ var pass = true;
688
+ try {
689
+ $( $("#iframe")[0].contentWindow.document.body ).append("<div>test</div>");
690
+ } catch(e) {
691
+ pass = false;
692
+ }
693
+
694
+ ok( pass, "Test for appending a DOM node to the contents of an IFrame" );
695
+
696
+ reset();
697
+ $('<fieldset/>').appendTo('#form').append('<legend id="legend">test</legend>');
698
+ t( 'Append legend', '#legend', ['legend'] );
699
+
700
+ reset();
701
+ $('#select1').append('<OPTION>Test</OPTION>');
702
+ ok( $('#select1 option:last').text() == "Test", "Appending &lt;OPTION&gt; (all caps)" );
703
+
704
+ $('#table').append('<colgroup></colgroup>');
705
+ ok( $('#table colgroup').length, "Append colgroup" );
706
+
707
+ $('#table colgroup').append('<col/>');
708
+ ok( $('#table colgroup col').length, "Append col" );
709
+
710
+ reset();
711
+ $('#table').append('<caption></caption>');
712
+ ok( $('#table caption').length, "Append caption" );
713
+
714
+ reset();
715
+ $('form:last')
716
+ .append('<select id="appendSelect1"></select>')
717
+ .append('<select id="appendSelect2"><option>Test</option></select>');
718
+
719
+ t( "Append Select", "#appendSelect1, #appendSelect2", ["appendSelect1", "appendSelect2"] );
720
+
721
+ // using contents will get comments regular, text, and comment nodes
722
+ var j = $("#nonnodes").contents();
723
+ var d = $("<div/>").appendTo("#nonnodes").append(j);
724
+ equals( $("#nonnodes").length, 1, "Check node,textnode,comment append moved leaving just the div" );
725
+ ok( d.contents().length >= 2, "Check node,textnode,comment append works" );
726
+ d.contents().appendTo("#nonnodes");
727
+ d.remove();
728
+ ok( $("#nonnodes").contents().length >= 2, "Check node,textnode,comment append cleanup worked" );
724
729
  });
725
730
 
726
731
  test("appendTo(String|Element|Array&lt;Element&gt;|jQuery)", function() {
727
- expect(6);
728
- var defaultText = 'Try them out:'
729
- $('<b>buga</b>').appendTo('#first');
730
- ok( $("#first").text() == defaultText + 'buga', 'Check if text appending works' );
731
- ok( $('<option value="appendTest">Append Test</option>').appendTo('#select3').parent().find('option:last-child').attr('value') == 'appendTest', 'Appending html options to select element');
732
-
733
- reset();
734
- var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
735
- $(document.getElementById('first')).appendTo('#sap');
736
- ok( expected == $('#sap').text(), "Check for appending of element" );
737
-
738
- reset();
739
- expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
740
- $([document.getElementById('first'), document.getElementById('yahoo')]).appendTo('#sap');
741
- ok( expected == $('#sap').text(), "Check for appending of array of elements" );
742
-
743
- reset();
744
- expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
745
- $("#first, #yahoo").appendTo('#sap');
746
- ok( expected == $('#sap').text(), "Check for appending of jQuery object" );
747
-
748
- reset();
749
- $('#select1').appendTo('#foo');
750
- t( 'Append select', '#foo select', ['select1'] );
732
+ expect(6);
733
+ var defaultText = 'Try them out:'
734
+ $('<b>buga</b>').appendTo('#first');
735
+ ok( $("#first").text() == defaultText + 'buga', 'Check if text appending works' );
736
+ ok( $('<option value="appendTest">Append Test</option>').appendTo('#select3').parent().find('option:last-child').attr('value') == 'appendTest', 'Appending html options to select element');
737
+
738
+ reset();
739
+ var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
740
+ $(document.getElementById('first')).appendTo('#sap');
741
+ ok( expected == $('#sap').text(), "Check for appending of element" );
742
+
743
+ reset();
744
+ expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
745
+ $([document.getElementById('first'), document.getElementById('yahoo')]).appendTo('#sap');
746
+ ok( expected == $('#sap').text(), "Check for appending of array of elements" );
747
+
748
+ reset();
749
+ expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
750
+ $("#first, #yahoo").appendTo('#sap');
751
+ ok( expected == $('#sap').text(), "Check for appending of jQuery object" );
752
+
753
+ reset();
754
+ $('#select1').appendTo('#foo');
755
+ t( 'Append select', '#foo select', ['select1'] );
751
756
  });
752
757
 
753
758
  test("prepend(String|Element|Array&lt;Element&gt;|jQuery)", function() {
754
- expect(5);
755
- var defaultText = 'Try them out:'
756
- var result = $('#first').prepend('<b>buga</b>');
757
- ok( result.text() == 'buga' + defaultText, 'Check if text prepending works' );
758
- ok( $('#select3').prepend('<option value="prependTest">Prepend Test</option>').find('option:first-child').attr('value') == 'prependTest', 'Prepending html options to select element');
759
-
760
- reset();
761
- var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
762
- $('#sap').prepend(document.getElementById('first'));
763
- ok( expected == $('#sap').text(), "Check for prepending of element" );
764
-
765
- reset();
766
- expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
767
- $('#sap').prepend([document.getElementById('first'), document.getElementById('yahoo')]);
768
- ok( expected == $('#sap').text(), "Check for prepending of array of elements" );
769
-
770
- reset();
771
- expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
772
- $('#sap').prepend($("#first, #yahoo"));
773
- ok( expected == $('#sap').text(), "Check for prepending of jQuery object" );
759
+ expect(5);
760
+ var defaultText = 'Try them out:'
761
+ var result = $('#first').prepend('<b>buga</b>');
762
+ ok( result.text() == 'buga' + defaultText, 'Check if text prepending works' );
763
+ ok( $('#select3').prepend('<option value="prependTest">Prepend Test</option>').find('option:first-child').attr('value') == 'prependTest', 'Prepending html options to select element');
764
+
765
+ reset();
766
+ var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
767
+ $('#sap').prepend(document.getElementById('first'));
768
+ ok( expected == $('#sap').text(), "Check for prepending of element" );
769
+
770
+ reset();
771
+ expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
772
+ $('#sap').prepend([document.getElementById('first'), document.getElementById('yahoo')]);
773
+ ok( expected == $('#sap').text(), "Check for prepending of array of elements" );
774
+
775
+ reset();
776
+ expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
777
+ $('#sap').prepend($("#first, #yahoo"));
778
+ ok( expected == $('#sap').text(), "Check for prepending of jQuery object" );
774
779
  });
775
780
 
776
781
  test("prependTo(String|Element|Array&lt;Element&gt;|jQuery)", function() {
777
- expect(6);
778
- var defaultText = 'Try them out:'
779
- $('<b>buga</b>').prependTo('#first');
780
- ok( $('#first').text() == 'buga' + defaultText, 'Check if text prepending works' );
781
- ok( $('<option value="prependTest">Prepend Test</option>').prependTo('#select3').parent().find('option:first-child').attr('value') == 'prependTest', 'Prepending html options to select element');
782
-
783
- reset();
784
- var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
785
- $(document.getElementById('first')).prependTo('#sap');
786
- ok( expected == $('#sap').text(), "Check for prepending of element" );
787
-
788
- reset();
789
- expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
790
- $([document.getElementById('yahoo'), document.getElementById('first')]).prependTo('#sap');
791
- ok( expected == $('#sap').text(), "Check for prepending of array of elements" );
792
-
793
- reset();
794
- expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
795
- $("#yahoo, #first").prependTo('#sap');
796
- ok( expected == $('#sap').text(), "Check for prepending of jQuery object" );
797
-
798
- reset();
799
- $('<select id="prependSelect1"></select>').prependTo('form:last');
800
- $('<select id="prependSelect2"><option>Test</option></select>').prependTo('form:last');
801
-
802
- t( "Prepend Select", "#prependSelect1, #prependSelect2", ["prependSelect1", "prependSelect2"] );
782
+ expect(6);
783
+ var defaultText = 'Try them out:'
784
+ $('<b>buga</b>').prependTo('#first');
785
+ ok( $('#first').text() == 'buga' + defaultText, 'Check if text prepending works' );
786
+ ok( $('<option value="prependTest">Prepend Test</option>').prependTo('#select3').parent().find('option:first-child').attr('value') == 'prependTest', 'Prepending html options to select element');
787
+
788
+ reset();
789
+ var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
790
+ $(document.getElementById('first')).prependTo('#sap');
791
+ ok( expected == $('#sap').text(), "Check for prepending of element" );
792
+
793
+ reset();
794
+ expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
795
+ $([document.getElementById('yahoo'), document.getElementById('first')]).prependTo('#sap');
796
+ ok( expected == $('#sap').text(), "Check for prepending of array of elements" );
797
+
798
+ reset();
799
+ expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
800
+ $("#yahoo, #first").prependTo('#sap');
801
+ ok( expected == $('#sap').text(), "Check for prepending of jQuery object" );
802
+
803
+ reset();
804
+ $('<select id="prependSelect1"></select>').prependTo('form:last');
805
+ $('<select id="prependSelect2"><option>Test</option></select>').prependTo('form:last');
806
+
807
+ t( "Prepend Select", "#prependSelect1, #prependSelect2", ["prependSelect1", "prependSelect2"] );
803
808
  });
804
809
 
805
810
  test("before(String|Element|Array&lt;Element&gt;|jQuery)", function() {
806
- expect(4);
807
- var expected = 'This is a normal link: bugaYahoo';
808
- $('#yahoo').before('<b>buga</b>');
809
- ok( expected == $('#en').text(), 'Insert String before' );
810
-
811
- reset();
812
- expected = "This is a normal link: Try them out:Yahoo";
813
- $('#yahoo').before(document.getElementById('first'));
814
- ok( expected == $('#en').text(), "Insert element before" );
815
-
816
- reset();
817
- expected = "This is a normal link: Try them out:diveintomarkYahoo";
818
- $('#yahoo').before([document.getElementById('first'), document.getElementById('mark')]);
819
- ok( expected == $('#en').text(), "Insert array of elements before" );
820
-
821
- reset();
822
- expected = "This is a normal link: Try them out:diveintomarkYahoo";
823
- $('#yahoo').before($("#first, #mark"));
824
- ok( expected == $('#en').text(), "Insert jQuery before" );
811
+ expect(4);
812
+ var expected = 'This is a normal link: bugaYahoo';
813
+ $('#yahoo').before('<b>buga</b>');
814
+ ok( expected == $('#en').text(), 'Insert String before' );
815
+
816
+ reset();
817
+ expected = "This is a normal link: Try them out:Yahoo";
818
+ $('#yahoo').before(document.getElementById('first'));
819
+ ok( expected == $('#en').text(), "Insert element before" );
820
+
821
+ reset();
822
+ expected = "This is a normal link: Try them out:diveintomarkYahoo";
823
+ $('#yahoo').before([document.getElementById('first'), document.getElementById('mark')]);
824
+ ok( expected == $('#en').text(), "Insert array of elements before" );
825
+
826
+ reset();
827
+ expected = "This is a normal link: Try them out:diveintomarkYahoo";
828
+ $('#yahoo').before($("#first, #mark"));
829
+ ok( expected == $('#en').text(), "Insert jQuery before" );
825
830
  });
826
831
 
827
832
  test("insertBefore(String|Element|Array&lt;Element&gt;|jQuery)", function() {
828
- expect(4);
829
- var expected = 'This is a normal link: bugaYahoo';
830
- $('<b>buga</b>').insertBefore('#yahoo');
831
- ok( expected == $('#en').text(), 'Insert String before' );
832
-
833
- reset();
834
- expected = "This is a normal link: Try them out:Yahoo";
835
- $(document.getElementById('first')).insertBefore('#yahoo');
836
- ok( expected == $('#en').text(), "Insert element before" );
837
-
838
- reset();
839
- expected = "This is a normal link: Try them out:diveintomarkYahoo";
840
- $([document.getElementById('first'), document.getElementById('mark')]).insertBefore('#yahoo');
841
- ok( expected == $('#en').text(), "Insert array of elements before" );
842
-
843
- reset();
844
- expected = "This is a normal link: Try them out:diveintomarkYahoo";
845
- $("#first, #mark").insertBefore('#yahoo');
846
- ok( expected == $('#en').text(), "Insert jQuery before" );
833
+ expect(4);
834
+ var expected = 'This is a normal link: bugaYahoo';
835
+ $('<b>buga</b>').insertBefore('#yahoo');
836
+ ok( expected == $('#en').text(), 'Insert String before' );
837
+
838
+ reset();
839
+ expected = "This is a normal link: Try them out:Yahoo";
840
+ $(document.getElementById('first')).insertBefore('#yahoo');
841
+ ok( expected == $('#en').text(), "Insert element before" );
842
+
843
+ reset();
844
+ expected = "This is a normal link: Try them out:diveintomarkYahoo";
845
+ $([document.getElementById('first'), document.getElementById('mark')]).insertBefore('#yahoo');
846
+ ok( expected == $('#en').text(), "Insert array of elements before" );
847
+
848
+ reset();
849
+ expected = "This is a normal link: Try them out:diveintomarkYahoo";
850
+ $("#first, #mark").insertBefore('#yahoo');
851
+ ok( expected == $('#en').text(), "Insert jQuery before" );
847
852
  });
848
853
 
849
854
  test("after(String|Element|Array&lt;Element&gt;|jQuery)", function() {
850
- expect(4);
851
- var expected = 'This is a normal link: Yahoobuga';
852
- $('#yahoo').after('<b>buga</b>');
853
- ok( expected == $('#en').text(), 'Insert String after' );
854
-
855
- reset();
856
- expected = "This is a normal link: YahooTry them out:";
857
- $('#yahoo').after(document.getElementById('first'));
858
- ok( expected == $('#en').text(), "Insert element after" );
859
-
860
- reset();
861
- expected = "This is a normal link: YahooTry them out:diveintomark";
862
- $('#yahoo').after([document.getElementById('first'), document.getElementById('mark')]);
863
- ok( expected == $('#en').text(), "Insert array of elements after" );
864
-
865
- reset();
866
- expected = "This is a normal link: YahooTry them out:diveintomark";
867
- $('#yahoo').after($("#first, #mark"));
868
- ok( expected == $('#en').text(), "Insert jQuery after" );
855
+ expect(4);
856
+ var expected = 'This is a normal link: Yahoobuga';
857
+ $('#yahoo').after('<b>buga</b>');
858
+ ok( expected == $('#en').text(), 'Insert String after' );
859
+
860
+ reset();
861
+ expected = "This is a normal link: YahooTry them out:";
862
+ $('#yahoo').after(document.getElementById('first'));
863
+ ok( expected == $('#en').text(), "Insert element after" );
864
+
865
+ reset();
866
+ expected = "This is a normal link: YahooTry them out:diveintomark";
867
+ $('#yahoo').after([document.getElementById('first'), document.getElementById('mark')]);
868
+ ok( expected == $('#en').text(), "Insert array of elements after" );
869
+
870
+ reset();
871
+ expected = "This is a normal link: YahooTry them out:diveintomark";
872
+ $('#yahoo').after($("#first, #mark"));
873
+ ok( expected == $('#en').text(), "Insert jQuery after" );
869
874
  });
870
875
 
871
876
  test("insertAfter(String|Element|Array&lt;Element&gt;|jQuery)", function() {
872
- expect(4);
873
- var expected = 'This is a normal link: Yahoobuga';
874
- $('<b>buga</b>').insertAfter('#yahoo');
875
- ok( expected == $('#en').text(), 'Insert String after' );
876
-
877
- reset();
878
- expected = "This is a normal link: YahooTry them out:";
879
- $(document.getElementById('first')).insertAfter('#yahoo');
880
- ok( expected == $('#en').text(), "Insert element after" );
881
-
882
- reset();
883
- expected = "This is a normal link: YahooTry them out:diveintomark";
884
- $([document.getElementById('mark'), document.getElementById('first')]).insertAfter('#yahoo');
885
- ok( expected == $('#en').text(), "Insert array of elements after" );
886
-
887
- reset();
888
- expected = "This is a normal link: YahooTry them out:diveintomark";
889
- $("#mark, #first").insertAfter('#yahoo');
890
- ok( expected == $('#en').text(), "Insert jQuery after" );
877
+ expect(4);
878
+ var expected = 'This is a normal link: Yahoobuga';
879
+ $('<b>buga</b>').insertAfter('#yahoo');
880
+ ok( expected == $('#en').text(), 'Insert String after' );
881
+
882
+ reset();
883
+ expected = "This is a normal link: YahooTry them out:";
884
+ $(document.getElementById('first')).insertAfter('#yahoo');
885
+ ok( expected == $('#en').text(), "Insert element after" );
886
+
887
+ reset();
888
+ expected = "This is a normal link: YahooTry them out:diveintomark";
889
+ $([document.getElementById('mark'), document.getElementById('first')]).insertAfter('#yahoo');
890
+ ok( expected == $('#en').text(), "Insert array of elements after" );
891
+
892
+ reset();
893
+ expected = "This is a normal link: YahooTry them out:diveintomark";
894
+ $("#mark, #first").insertAfter('#yahoo');
895
+ ok( expected == $('#en').text(), "Insert jQuery after" );
891
896
  });
892
897
 
893
898
  test("replaceWith(String|Element|Array&lt;Element&gt;|jQuery)", function() {
894
- expect(10);
895
- $('#yahoo').replaceWith('<b id="replace">buga</b>');
896
- ok( $("#replace")[0], 'Replace element with string' );
897
- ok( !$("#yahoo")[0], 'Verify that original element is gone, after string' );
898
-
899
- reset();
900
- $('#yahoo').replaceWith(document.getElementById('first'));
901
- ok( $("#first")[0], 'Replace element with element' );
902
- ok( !$("#yahoo")[0], 'Verify that original element is gone, after element' );
903
-
904
- reset();
905
- $('#yahoo').replaceWith([document.getElementById('first'), document.getElementById('mark')]);
906
- ok( $("#first")[0], 'Replace element with array of elements' );
907
- ok( $("#mark")[0], 'Replace element with array of elements' );
908
- ok( !$("#yahoo")[0], 'Verify that original element is gone, after array of elements' );
909
-
910
- reset();
911
- $('#yahoo').replaceWith($("#first, #mark"));
912
- ok( $("#first")[0], 'Replace element with set of elements' );
913
- ok( $("#mark")[0], 'Replace element with set of elements' );
914
- ok( !$("#yahoo")[0], 'Verify that original element is gone, after set of elements' );
899
+ expect(10);
900
+ $('#yahoo').replaceWith('<b id="replace">buga</b>');
901
+ ok( $("#replace")[0], 'Replace element with string' );
902
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after string' );
903
+
904
+ reset();
905
+ $('#yahoo').replaceWith(document.getElementById('first'));
906
+ ok( $("#first")[0], 'Replace element with element' );
907
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after element' );
908
+
909
+ reset();
910
+ $('#yahoo').replaceWith([document.getElementById('first'), document.getElementById('mark')]);
911
+ ok( $("#first")[0], 'Replace element with array of elements' );
912
+ ok( $("#mark")[0], 'Replace element with array of elements' );
913
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after array of elements' );
914
+
915
+ reset();
916
+ $('#yahoo').replaceWith($("#first, #mark"));
917
+ ok( $("#first")[0], 'Replace element with set of elements' );
918
+ ok( $("#mark")[0], 'Replace element with set of elements' );
919
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after set of elements' );
915
920
  });
916
921
 
917
922
  test("replaceAll(String|Element|Array&lt;Element&gt;|jQuery)", function() {
918
- expect(10);
919
- $('<b id="replace">buga</b>').replaceAll("#yahoo");
920
- ok( $("#replace")[0], 'Replace element with string' );
921
- ok( !$("#yahoo")[0], 'Verify that original element is gone, after string' );
922
-
923
- reset();
924
- $(document.getElementById('first')).replaceAll("#yahoo");
925
- ok( $("#first")[0], 'Replace element with element' );
926
- ok( !$("#yahoo")[0], 'Verify that original element is gone, after element' );
927
-
928
- reset();
929
- $([document.getElementById('first'), document.getElementById('mark')]).replaceAll("#yahoo");
930
- ok( $("#first")[0], 'Replace element with array of elements' );
931
- ok( $("#mark")[0], 'Replace element with array of elements' );
932
- ok( !$("#yahoo")[0], 'Verify that original element is gone, after array of elements' );
933
-
934
- reset();
935
- $("#first, #mark").replaceAll("#yahoo");
936
- ok( $("#first")[0], 'Replace element with set of elements' );
937
- ok( $("#mark")[0], 'Replace element with set of elements' );
938
- ok( !$("#yahoo")[0], 'Verify that original element is gone, after set of elements' );
923
+ expect(10);
924
+ $('<b id="replace">buga</b>').replaceAll("#yahoo");
925
+ ok( $("#replace")[0], 'Replace element with string' );
926
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after string' );
927
+
928
+ reset();
929
+ $(document.getElementById('first')).replaceAll("#yahoo");
930
+ ok( $("#first")[0], 'Replace element with element' );
931
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after element' );
932
+
933
+ reset();
934
+ $([document.getElementById('first'), document.getElementById('mark')]).replaceAll("#yahoo");
935
+ ok( $("#first")[0], 'Replace element with array of elements' );
936
+ ok( $("#mark")[0], 'Replace element with array of elements' );
937
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after array of elements' );
938
+
939
+ reset();
940
+ $("#first, #mark").replaceAll("#yahoo");
941
+ ok( $("#first")[0], 'Replace element with set of elements' );
942
+ ok( $("#mark")[0], 'Replace element with set of elements' );
943
+ ok( !$("#yahoo")[0], 'Verify that original element is gone, after set of elements' );
939
944
  });
940
945
 
941
946
  test("end()", function() {
942
- expect(3);
943
- ok( 'Yahoo' == $('#yahoo').parent().end().text(), 'Check for end' );
944
- ok( $('#yahoo').end(), 'Check for end with nothing to end' );
945
-
946
- var x = $('#yahoo');
947
- x.parent();
948
- ok( 'Yahoo' == $('#yahoo').text(), 'Check for non-destructive behaviour' );
947
+ expect(3);
948
+ ok( 'Yahoo' == $('#yahoo').parent().end().text(), 'Check for end' );
949
+ ok( $('#yahoo').end(), 'Check for end with nothing to end' );
950
+
951
+ var x = $('#yahoo');
952
+ x.parent();
953
+ ok( 'Yahoo' == $('#yahoo').text(), 'Check for non-destructive behaviour' );
949
954
  });
950
955
 
951
956
  test("find(String)", function() {
952
- expect(2);
953
- ok( 'Yahoo' == $('#foo').find('.blogTest').text(), 'Check for find' );
957
+ expect(2);
958
+ ok( 'Yahoo' == $('#foo').find('.blogTest').text(), 'Check for find' );
954
959
 
955
- // using contents will get comments regular, text, and comment nodes
956
- var j = $("#nonnodes").contents();
957
- equals( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" );
960
+ // using contents will get comments regular, text, and comment nodes
961
+ var j = $("#nonnodes").contents();
962
+ equals( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" );
958
963
  });
959
964
 
960
965
  test("clone()", function() {
961
- expect(20);
962
- ok( 'This is a normal link: Yahoo' == $('#en').text(), 'Assert text for #en' );
963
- var clone = $('#yahoo').clone();
964
- ok( 'Try them out:Yahoo' == $('#first').append(clone).text(), 'Check for clone' );
965
- ok( 'This is a normal link: Yahoo' == $('#en').text(), 'Reassert text for #en' );
966
-
967
- var cloneTags = [
968
- "<table/>", "<tr/>", "<td/>", "<div/>",
969
- "<button/>", "<ul/>", "<ol/>", "<li/>",
970
- "<input type='checkbox' />", "<select/>", "<option/>", "<textarea/>",
971
- "<tbody/>", "<thead/>", "<tfoot/>", "<iframe/>"
972
- ];
973
- for (var i = 0; i < cloneTags.length; i++) {
974
- var j = $(cloneTags[i]);
975
- equals( j[0].tagName, j.clone()[0].tagName, 'Clone a &lt;' + cloneTags[i].substring(1));
976
- }
977
-
978
- // using contents will get comments regular, text, and comment nodes
979
- var cl = $("#nonnodes").contents().clone();
980
- ok( cl.length >= 2, "Check node,textnode,comment clone works (some browsers delete comments on clone)" );
966
+ expect(20);
967
+ ok( 'This is a normal link: Yahoo' == $('#en').text(), 'Assert text for #en' );
968
+ var clone = $('#yahoo').clone();
969
+ ok( 'Try them out:Yahoo' == $('#first').append(clone).text(), 'Check for clone' );
970
+ ok( 'This is a normal link: Yahoo' == $('#en').text(), 'Reassert text for #en' );
971
+
972
+ var cloneTags = [
973
+ "<table/>", "<tr/>", "<td/>", "<div/>",
974
+ "<button/>", "<ul/>", "<ol/>", "<li/>",
975
+ "<input type='checkbox' />", "<select/>", "<option/>", "<textarea/>",
976
+ "<tbody/>", "<thead/>", "<tfoot/>", "<iframe/>"
977
+ ];
978
+ for (var i = 0; i < cloneTags.length; i++) {
979
+ var j = $(cloneTags[i]);
980
+ equals( j[0].tagName, j.clone()[0].tagName, 'Clone a &lt;' + cloneTags[i].substring(1));
981
+ }
982
+
983
+ // using contents will get comments regular, text, and comment nodes
984
+ var cl = $("#nonnodes").contents().clone();
985
+ ok( cl.length >= 2, "Check node,textnode,comment clone works (some browsers delete comments on clone)" );
981
986
  });
982
987
 
983
988
  if (!isLocal) {
984
989
  test("clone() on XML nodes", function() {
985
- expect(2);
986
- stop();
987
- $.get("data/dashboard.xml", function (xml) {
988
- var root = $(xml.documentElement).clone();
989
- $("tab:first", xml).text("origval");
990
- $("tab:first", root).text("cloneval");
991
- equals($("tab:first", xml).text(), "origval", "Check original XML node was correctly set");
992
- equals($("tab:first", root).text(), "cloneval", "Check cloned XML node was correctly set");
993
- start();
994
- });
990
+ expect(2);
991
+ stop();
992
+ $.get("data/dashboard.xml", function (xml) {
993
+ var root = $(xml.documentElement).clone();
994
+ $("tab:first", xml).text("origval");
995
+ $("tab:first", root).text("cloneval");
996
+ equals($("tab:first", xml).text(), "origval", "Check original XML node was correctly set");
997
+ equals($("tab:first", root).text(), "cloneval", "Check cloned XML node was correctly set");
998
+ start();
999
+ });
995
1000
  });
996
1001
  }
997
1002
 
998
1003
  test("is(String)", function() {
999
- expect(26);
1000
- ok( $('#form').is('form'), 'Check for element: A form must be a form' );
1001
- ok( !$('#form').is('div'), 'Check for element: A form is not a div' );
1002
- ok( $('#mark').is('.blog'), 'Check for class: Expected class "blog"' );
1003
- ok( !$('#mark').is('.link'), 'Check for class: Did not expect class "link"' );
1004
- ok( $('#simon').is('.blog.link'), 'Check for multiple classes: Expected classes "blog" and "link"' );
1005
- ok( !$('#simon').is('.blogTest'), 'Check for multiple classes: Expected classes "blog" and "link", but not "blogTest"' );
1006
- ok( $('#en').is('[lang="en"]'), 'Check for attribute: Expected attribute lang to be "en"' );
1007
- ok( !$('#en').is('[lang="de"]'), 'Check for attribute: Expected attribute lang to be "en", not "de"' );
1008
- ok( $('#text1').is('[type="text"]'), 'Check for attribute: Expected attribute type to be "text"' );
1009
- ok( !$('#text1').is('[type="radio"]'), 'Check for attribute: Expected attribute type to be "text", not "radio"' );
1010
- ok( $('#text2').is(':disabled'), 'Check for pseudoclass: Expected to be disabled' );
1011
- ok( !$('#text1').is(':disabled'), 'Check for pseudoclass: Expected not disabled' );
1012
- ok( $('#radio2').is(':checked'), 'Check for pseudoclass: Expected to be checked' );
1013
- ok( !$('#radio1').is(':checked'), 'Check for pseudoclass: Expected not checked' );
1014
- ok( $('#foo').is(':has(p)'), 'Check for child: Expected a child "p" element' );
1015
- ok( !$('#foo').is(':has(ul)'), 'Check for child: Did not expect "ul" element' );
1016
- ok( $('#foo').is(':has(p):has(a):has(code)'), 'Check for childs: Expected "p", "a" and "code" child elements' );
1017
- ok( !$('#foo').is(':has(p):has(a):has(code):has(ol)'), 'Check for childs: Expected "p", "a" and "code" child elements, but no "ol"' );
1018
- ok( !$('#foo').is(0), 'Expected false for an invalid expression - 0' );
1019
- ok( !$('#foo').is(null), 'Expected false for an invalid expression - null' );
1020
- ok( !$('#foo').is(''), 'Expected false for an invalid expression - ""' );
1021
- ok( !$('#foo').is(undefined), 'Expected false for an invalid expression - undefined' );
1022
-
1023
- // test is() with comma-seperated expressions
1024
- ok( $('#en').is('[lang="en"],[lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
1025
- ok( $('#en').is('[lang="de"],[lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
1026
- ok( $('#en').is('[lang="en"] , [lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
1027
- ok( $('#en').is('[lang="de"] , [lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
1004
+ expect(26);
1005
+ ok( $('#form').is('form'), 'Check for element: A form must be a form' );
1006
+ ok( !$('#form').is('div'), 'Check for element: A form is not a div' );
1007
+ ok( $('#mark').is('.blog'), 'Check for class: Expected class "blog"' );
1008
+ ok( !$('#mark').is('.link'), 'Check for class: Did not expect class "link"' );
1009
+ ok( $('#simon').is('.blog.link'), 'Check for multiple classes: Expected classes "blog" and "link"' );
1010
+ ok( !$('#simon').is('.blogTest'), 'Check for multiple classes: Expected classes "blog" and "link", but not "blogTest"' );
1011
+ ok( $('#en').is('[lang="en"]'), 'Check for attribute: Expected attribute lang to be "en"' );
1012
+ ok( !$('#en').is('[lang="de"]'), 'Check for attribute: Expected attribute lang to be "en", not "de"' );
1013
+ ok( $('#text1').is('[type="text"]'), 'Check for attribute: Expected attribute type to be "text"' );
1014
+ ok( !$('#text1').is('[type="radio"]'), 'Check for attribute: Expected attribute type to be "text", not "radio"' );
1015
+ ok( $('#text2').is(':disabled'), 'Check for pseudoclass: Expected to be disabled' );
1016
+ ok( !$('#text1').is(':disabled'), 'Check for pseudoclass: Expected not disabled' );
1017
+ ok( $('#radio2').is(':checked'), 'Check for pseudoclass: Expected to be checked' );
1018
+ ok( !$('#radio1').is(':checked'), 'Check for pseudoclass: Expected not checked' );
1019
+ ok( $('#foo').is(':has(p)'), 'Check for child: Expected a child "p" element' );
1020
+ ok( !$('#foo').is(':has(ul)'), 'Check for child: Did not expect "ul" element' );
1021
+ ok( $('#foo').is(':has(p):has(a):has(code)'), 'Check for childs: Expected "p", "a" and "code" child elements' );
1022
+ ok( !$('#foo').is(':has(p):has(a):has(code):has(ol)'), 'Check for childs: Expected "p", "a" and "code" child elements, but no "ol"' );
1023
+ ok( !$('#foo').is(0), 'Expected false for an invalid expression - 0' );
1024
+ ok( !$('#foo').is(null), 'Expected false for an invalid expression - null' );
1025
+ ok( !$('#foo').is(''), 'Expected false for an invalid expression - ""' );
1026
+ ok( !$('#foo').is(undefined), 'Expected false for an invalid expression - undefined' );
1027
+
1028
+ // test is() with comma-seperated expressions
1029
+ ok( $('#en').is('[lang="en"],[lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
1030
+ ok( $('#en').is('[lang="de"],[lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
1031
+ ok( $('#en').is('[lang="en"] , [lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
1032
+ ok( $('#en').is('[lang="de"] , [lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
1028
1033
  });
1029
1034
 
1030
1035
  test("$.extend(Object, Object)", function() {
1031
- expect(17);
1032
-
1033
- var settings = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
1034
- options = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
1035
- optionsCopy = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
1036
- merged = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "x", xxx: "newstring" },
1037
- deep1 = { foo: { bar: true } },
1038
- deep1copy = { foo: { bar: true } },
1039
- deep2 = { foo: { baz: true }, foo2: document },
1040
- deep2copy = { foo: { baz: true }, foo2: document },
1041
- deepmerged = { foo: { bar: true, baz: true }, foo2: document };
1042
-
1043
- jQuery.extend(settings, options);
1044
- isObj( settings, merged, "Check if extended: settings must be extended" );
1045
- isObj( options, optionsCopy, "Check if not modified: options must not be modified" );
1046
-
1047
- jQuery.extend(settings, null, options);
1048
- isObj( settings, merged, "Check if extended: settings must be extended" );
1049
- isObj( options, optionsCopy, "Check if not modified: options must not be modified" );
1050
-
1051
- jQuery.extend(true, deep1, deep2);
1052
- isObj( deep1.foo, deepmerged.foo, "Check if foo: settings must be extended" );
1053
- isObj( deep2.foo, deep2copy.foo, "Check if not deep2: options must not be modified" );
1054
- equals( deep1.foo2, document, "Make sure that a deep clone was not attempted on the document" );
1055
-
1056
- var target = {};
1057
- var recursive = { foo:target, bar:5 };
1058
- jQuery.extend(true, target, recursive);
1059
- isObj( target, { bar:5 }, "Check to make sure a recursive obj doesn't go never-ending loop by not copying it over" );
1060
-
1061
- var ret = jQuery.extend(true, { foo: [] }, { foo: [0] } ); // 1907
1062
- ok( ret.foo.length == 1, "Check to make sure a value with coersion 'false' copies over when necessary to fix #1907" );
1063
-
1064
- var ret = jQuery.extend(true, { foo: "1,2,3" }, { foo: [1, 2, 3] } );
1065
- ok( typeof ret.foo != "string", "Check to make sure values equal with coersion (but not actually equal) overwrite correctly" );
1066
-
1067
- var ret = jQuery.extend(true, { foo:"bar" }, { foo:null } );
1068
- ok( typeof ret.foo !== 'undefined', "Make sure a null value doesn't crash with deep extend, for #1908" );
1069
-
1070
- var obj = { foo:null };
1071
- jQuery.extend(true, obj, { foo:"notnull" } );
1072
- equals( obj.foo, "notnull", "Make sure a null value can be overwritten" );
1073
-
1074
- function func() {}
1075
- jQuery.extend(func, { key: "value" } );
1076
- equals( func.key, "value", "Verify a function can be extended" );
1077
-
1078
- var defaults = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
1079
- defaultsCopy = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
1080
- options1 = { xnumber2: 1, xstring2: "x" },
1081
- options1Copy = { xnumber2: 1, xstring2: "x" },
1082
- options2 = { xstring2: "xx", xxx: "newstringx" },
1083
- options2Copy = { xstring2: "xx", xxx: "newstringx" },
1084
- merged2 = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "xx", xxx: "newstringx" };
1085
-
1086
- var settings = jQuery.extend({}, defaults, options1, options2);
1087
- isObj( settings, merged2, "Check if extended: settings must be extended" );
1088
- isObj( defaults, defaultsCopy, "Check if not modified: options1 must not be modified" );
1089
- isObj( options1, options1Copy, "Check if not modified: options1 must not be modified" );
1090
- isObj( options2, options2Copy, "Check if not modified: options2 must not be modified" );
1036
+ expect(17);
1037
+
1038
+ var settings = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
1039
+ options = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
1040
+ optionsCopy = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
1041
+ merged = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "x", xxx: "newstring" },
1042
+ deep1 = { foo: { bar: true } },
1043
+ deep1copy = { foo: { bar: true } },
1044
+ deep2 = { foo: { baz: true }, foo2: document },
1045
+ deep2copy = { foo: { baz: true }, foo2: document },
1046
+ deepmerged = { foo: { bar: true, baz: true }, foo2: document };
1047
+
1048
+ jQuery.extend(settings, options);
1049
+ isObj( settings, merged, "Check if extended: settings must be extended" );
1050
+ isObj( options, optionsCopy, "Check if not modified: options must not be modified" );
1051
+
1052
+ jQuery.extend(settings, null, options);
1053
+ isObj( settings, merged, "Check if extended: settings must be extended" );
1054
+ isObj( options, optionsCopy, "Check if not modified: options must not be modified" );
1055
+
1056
+ jQuery.extend(true, deep1, deep2);
1057
+ isObj( deep1.foo, deepmerged.foo, "Check if foo: settings must be extended" );
1058
+ isObj( deep2.foo, deep2copy.foo, "Check if not deep2: options must not be modified" );
1059
+ equals( deep1.foo2, document, "Make sure that a deep clone was not attempted on the document" );
1060
+
1061
+ var target = {};
1062
+ var recursive = { foo:target, bar:5 };
1063
+ jQuery.extend(true, target, recursive);
1064
+ isObj( target, { bar:5 }, "Check to make sure a recursive obj doesn't go never-ending loop by not copying it over" );
1065
+
1066
+ var ret = jQuery.extend(true, { foo: [] }, { foo: [0] } ); // 1907
1067
+ ok( ret.foo.length == 1, "Check to make sure a value with coersion 'false' copies over when necessary to fix #1907" );
1068
+
1069
+ var ret = jQuery.extend(true, { foo: "1,2,3" }, { foo: [1, 2, 3] } );
1070
+ ok( typeof ret.foo != "string", "Check to make sure values equal with coersion (but not actually equal) overwrite correctly" );
1071
+
1072
+ var ret = jQuery.extend(true, { foo:"bar" }, { foo:null } );
1073
+ ok( typeof ret.foo !== 'undefined', "Make sure a null value doesn't crash with deep extend, for #1908" );
1074
+
1075
+ var obj = { foo:null };
1076
+ jQuery.extend(true, obj, { foo:"notnull" } );
1077
+ equals( obj.foo, "notnull", "Make sure a null value can be overwritten" );
1078
+
1079
+ function func() {}
1080
+ jQuery.extend(func, { key: "value" } );
1081
+ equals( func.key, "value", "Verify a function can be extended" );
1082
+
1083
+ var defaults = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
1084
+ defaultsCopy = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
1085
+ options1 = { xnumber2: 1, xstring2: "x" },
1086
+ options1Copy = { xnumber2: 1, xstring2: "x" },
1087
+ options2 = { xstring2: "xx", xxx: "newstringx" },
1088
+ options2Copy = { xstring2: "xx", xxx: "newstringx" },
1089
+ merged2 = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "xx", xxx: "newstringx" };
1090
+
1091
+ var settings = jQuery.extend({}, defaults, options1, options2);
1092
+ isObj( settings, merged2, "Check if extended: settings must be extended" );
1093
+ isObj( defaults, defaultsCopy, "Check if not modified: options1 must not be modified" );
1094
+ isObj( options1, options1Copy, "Check if not modified: options1 must not be modified" );
1095
+ isObj( options2, options2Copy, "Check if not modified: options2 must not be modified" );
1091
1096
  });
1092
1097
 
1093
1098
  test("val()", function() {
1094
- expect(4);
1095
- ok( $("#text1").val() == "Test", "Check for value of input element" );
1096
- ok( !$("#text1").val() == "", "Check for value of input element" );
1097
- // ticket #1714 this caused a JS error in IE
1098
- ok( $("#first").val() == "", "Check a paragraph element to see if it has a value" );
1099
- ok( $([]).val() === undefined, "Check an empty jQuery object will return undefined from val" );
1099
+ expect(4);
1100
+ ok( $("#text1").val() == "Test", "Check for value of input element" );
1101
+ ok( !$("#text1").val() == "", "Check for value of input element" );
1102
+ // ticket #1714 this caused a JS error in IE
1103
+ ok( $("#first").val() == "", "Check a paragraph element to see if it has a value" );
1104
+ ok( $([]).val() === undefined, "Check an empty jQuery object will return undefined from val" );
1100
1105
  });
1101
1106
 
1102
1107
  // test("val(String)", function() {
@@ -1119,238 +1124,238 @@ test("val()", function() {
1119
1124
  var scriptorder = 0;
1120
1125
 
1121
1126
  test("html(String)", function() {
1122
- expect(11);
1123
- var div = $("#main > div");
1124
- div.html("<b>test</b>");
1125
- var pass = true;
1126
- for ( var i = 0; i < div.size(); i++ ) {
1127
- if ( div.get(i).childNodes.length != 1 ) pass = false;
1128
- }
1129
- ok( pass, "Set HTML" );
1127
+ expect(11);
1128
+ var div = $("#main > div");
1129
+ div.html("<b>test</b>");
1130
+ var pass = true;
1131
+ for ( var i = 0; i < div.size(); i++ ) {
1132
+ if ( div.get(i).childNodes.length != 1 ) pass = false;
1133
+ }
1134
+ ok( pass, "Set HTML" );
1130
1135
 
1131
- reset();
1132
- // using contents will get comments regular, text, and comment nodes
1133
- var j = $("#nonnodes").contents();
1134
- j.html("<b>bold</b>");
1135
- equals( j.html().toLowerCase(), "<b>bold</b>", "Check node,textnode,comment with html()" );
1136
+ reset();
1137
+ // using contents will get comments regular, text, and comment nodes
1138
+ var j = $("#nonnodes").contents();
1139
+ j.html("<b>bold</b>");
1140
+ equals( j.html().toLowerCase(), "<b>bold</b>", "Check node,textnode,comment with html()" );
1136
1141
 
1137
- $("#main").html("<select/>");
1138
- $("#main select").html("<option>O1</option><option selected='selected'>O2</option><option>O3</option>");
1139
- equals( $("#main select").val(), "O2", "Selected option correct" );
1142
+ $("#main").html("<select/>");
1143
+ $("#main select").html("<option>O1</option><option selected='selected'>O2</option><option>O3</option>");
1144
+ equals( $("#main select").val(), "O2", "Selected option correct" );
1140
1145
 
1141
- stop();
1146
+ stop();
1142
1147
 
1143
- $("#main").html('<script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script>');
1148
+ $("#main").html('<script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script>');
1144
1149
 
1145
- $("#main").html('foo <form><script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script></form>');
1150
+ $("#main").html('foo <form><script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script></form>');
1146
1151
 
1147
- // it was decided that waiting to execute ALL scripts makes sense since nested ones have to wait anyway so this test case is changed, see #1959
1148
- $("#main").html("<script>ok(scriptorder++ == 0, 'Script is executed in order');ok($('#scriptorder').length == 1,'Execute after html (even though appears before)')<\/script><span id='scriptorder'><script>ok(scriptorder++ == 1, 'Script (nested) is executed in order');ok($('#scriptorder').length == 1,'Execute after html')<\/script></span><script>ok(scriptorder++ == 2, 'Script (unnested) is executed in order');ok($('#scriptorder').length == 1,'Execute after html')<\/script>");
1152
+ // it was decided that waiting to execute ALL scripts makes sense since nested ones have to wait anyway so this test case is changed, see #1959
1153
+ $("#main").html("<script>ok(scriptorder++ == 0, 'Script is executed in order');ok($('#scriptorder').length == 1,'Execute after html (even though appears before)')<\/script><span id='scriptorder'><script>ok(scriptorder++ == 1, 'Script (nested) is executed in order');ok($('#scriptorder').length == 1,'Execute after html')<\/script></span><script>ok(scriptorder++ == 2, 'Script (unnested) is executed in order');ok($('#scriptorder').length == 1,'Execute after html')<\/script>");
1149
1154
 
1150
- setTimeout( start, 100 );
1155
+ setTimeout( start, 100 );
1151
1156
  });
1152
1157
 
1153
1158
  test("filter()", function() {
1154
- expect(6);
1155
- isSet( $("#form input").filter(":checked").get(), q("radio2", "check1"), "filter(String)" );
1156
- isSet( $("p").filter("#ap, #sndp").get(), q("ap", "sndp"), "filter('String, String')" );
1157
- isSet( $("p").filter("#ap,#sndp").get(), q("ap", "sndp"), "filter('String,String')" );
1158
- isSet( $("p").filter(function() { return !$("a", this).length }).get(), q("sndp", "first"), "filter(Function)" );
1159
+ expect(6);
1160
+ isSet( $("#form input").filter(":checked").get(), q("radio2", "check1"), "filter(String)" );
1161
+ isSet( $("p").filter("#ap, #sndp").get(), q("ap", "sndp"), "filter('String, String')" );
1162
+ isSet( $("p").filter("#ap,#sndp").get(), q("ap", "sndp"), "filter('String,String')" );
1163
+ isSet( $("p").filter(function() { return !$("a", this).length }).get(), q("sndp", "first"), "filter(Function)" );
1159
1164
 
1160
- // using contents will get comments regular, text, and comment nodes
1161
- var j = $("#nonnodes").contents();
1162
- equals( j.filter("span").length, 1, "Check node,textnode,comment to filter the one span" );
1163
- equals( j.filter("[name]").length, 0, "Check node,textnode,comment to filter the one span" );
1165
+ // using contents will get comments regular, text, and comment nodes
1166
+ var j = $("#nonnodes").contents();
1167
+ equals( j.filter("span").length, 1, "Check node,textnode,comment to filter the one span" );
1168
+ equals( j.filter("[name]").length, 0, "Check node,textnode,comment to filter the one span" );
1164
1169
  });
1165
1170
 
1166
1171
  test("not()", function() {
1167
- expect(8);
1168
- ok( $("#main > p#ap > a").not("#google").length == 2, "not('selector')" );
1169
- ok( $("#main > p#ap > a").not(document.getElementById("google")).length == 2, "not(DOMElement)" );
1170
- isSet( $("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );
1171
- isSet( $("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" );
1172
- isSet( $("p").not($("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" );
1173
- ok( $("p").not(document.getElementsByTagName("p")).length == 0, "not(Array-like DOM collection)" );
1174
- isSet( $("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d" ), "not('complex selector')");
1175
-
1176
- var selects = $("#form select");
1177
- isSet( selects.not( selects[1] ), q("select1", "select3"), "filter out DOM element");
1172
+ expect(8);
1173
+ ok( $("#main > p#ap > a").not("#google").length == 2, "not('selector')" );
1174
+ ok( $("#main > p#ap > a").not(document.getElementById("google")).length == 2, "not(DOMElement)" );
1175
+ isSet( $("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );
1176
+ isSet( $("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" );
1177
+ isSet( $("p").not($("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" );
1178
+ ok( $("p").not(document.getElementsByTagName("p")).length == 0, "not(Array-like DOM collection)" );
1179
+ isSet( $("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d" ), "not('complex selector')");
1180
+
1181
+ var selects = $("#form select");
1182
+ isSet( selects.not( selects[1] ), q("select1", "select3"), "filter out DOM element");
1178
1183
  });
1179
1184
 
1180
1185
  test("andSelf()", function() {
1181
- expect(4);
1182
- isSet( $("#en").siblings().andSelf().get(), q("sndp", "sap","en"), "Check for siblings and self" );
1183
- isSet( $("#foo").children().andSelf().get(), q("sndp", "en", "sap", "foo"), "Check for children and self" );
1184
- isSet( $("#en, #sndp").parent().andSelf().get(), q("foo","en","sndp"), "Check for parent and self" );
1185
- isSet( $("#groups").parents("p, div").andSelf().get(), q("ap", "main", "groups"), "Check for parents and self" );
1186
+ expect(4);
1187
+ isSet( $("#en").siblings().andSelf().get(), q("sndp", "sap","en"), "Check for siblings and self" );
1188
+ isSet( $("#foo").children().andSelf().get(), q("sndp", "en", "sap", "foo"), "Check for children and self" );
1189
+ isSet( $("#en, #sndp").parent().andSelf().get(), q("foo","en","sndp"), "Check for parent and self" );
1190
+ isSet( $("#groups").parents("p, div").andSelf().get(), q("ap", "main", "groups"), "Check for parents and self" );
1186
1191
  });
1187
1192
 
1188
1193
  test("siblings([String])", function() {
1189
- expect(5);
1190
- isSet( $("#en").siblings().get(), q("sndp", "sap"), "Check for siblings" );
1191
- isSet( $("#sndp").siblings(":has(code)").get(), q("sap"), "Check for filtered siblings (has code child element)" );
1192
- isSet( $("#sndp").siblings(":has(a)").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
1193
- isSet( $("#foo").siblings("form, b").get(), q("form", "lengthtest", "testForm", "floatTest"), "Check for multiple filters" );
1194
- isSet( $("#en, #sndp").siblings().get(), q("sndp", "sap", "en"), "Check for unique results from siblings" );
1194
+ expect(5);
1195
+ isSet( $("#en").siblings().get(), q("sndp", "sap"), "Check for siblings" );
1196
+ isSet( $("#sndp").siblings(":has(code)").get(), q("sap"), "Check for filtered siblings (has code child element)" );
1197
+ isSet( $("#sndp").siblings(":has(a)").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
1198
+ isSet( $("#foo").siblings("form, b").get(), q("form", "lengthtest", "testForm", "floatTest"), "Check for multiple filters" );
1199
+ isSet( $("#en, #sndp").siblings().get(), q("sndp", "sap", "en"), "Check for unique results from siblings" );
1195
1200
  });
1196
1201
 
1197
1202
  test("children([String])", function() {
1198
- expect(3);
1199
- isSet( $("#foo").children().get(), q("sndp", "en", "sap"), "Check for children" );
1200
- isSet( $("#foo").children(":has(code)").get(), q("sndp", "sap"), "Check for filtered children" );
1201
- isSet( $("#foo").children("#en, #sap").get(), q("en", "sap"), "Check for multiple filters" );
1203
+ expect(3);
1204
+ isSet( $("#foo").children().get(), q("sndp", "en", "sap"), "Check for children" );
1205
+ isSet( $("#foo").children(":has(code)").get(), q("sndp", "sap"), "Check for filtered children" );
1206
+ isSet( $("#foo").children("#en, #sap").get(), q("en", "sap"), "Check for multiple filters" );
1202
1207
  });
1203
1208
 
1204
1209
  test("parent([String])", function() {
1205
- expect(5);
1206
- ok( $("#groups").parent()[0].id == "ap", "Simple parent check" );
1207
- ok( $("#groups").parent("p")[0].id == "ap", "Filtered parent check" );
1208
- ok( $("#groups").parent("div").length == 0, "Filtered parent check, no match" );
1209
- ok( $("#groups").parent("div, p")[0].id == "ap", "Check for multiple filters" );
1210
- isSet( $("#en, #sndp").parent().get(), q("foo"), "Check for unique results from parent" );
1211
- });
1212
-
1210
+ expect(5);
1211
+ ok( $("#groups").parent()[0].id == "ap", "Simple parent check" );
1212
+ ok( $("#groups").parent("p")[0].id == "ap", "Filtered parent check" );
1213
+ ok( $("#groups").parent("div").length == 0, "Filtered parent check, no match" );
1214
+ ok( $("#groups").parent("div, p")[0].id == "ap", "Check for multiple filters" );
1215
+ isSet( $("#en, #sndp").parent().get(), q("foo"), "Check for unique results from parent" );
1216
+ });
1217
+
1213
1218
  test("parents([String])", function() {
1214
- expect(5);
1215
- ok( $("#groups").parents()[0].id == "ap", "Simple parents check" );
1216
- ok( $("#groups").parents("p")[0].id == "ap", "Filtered parents check" );
1217
- ok( $("#groups").parents("div")[0].id == "main", "Filtered parents check2" );
1218
- isSet( $("#groups").parents("p, div").get(), q("ap", "main"), "Check for multiple filters" );
1219
- isSet( $("#en, #sndp").parents().get(), q("foo", "main", "dl", "body", "html"), "Check for unique results from parents" );
1219
+ expect(5);
1220
+ ok( $("#groups").parents()[0].id == "ap", "Simple parents check" );
1221
+ ok( $("#groups").parents("p")[0].id == "ap", "Filtered parents check" );
1222
+ ok( $("#groups").parents("div")[0].id == "main", "Filtered parents check2" );
1223
+ isSet( $("#groups").parents("p, div").get(), q("ap", "main"), "Check for multiple filters" );
1224
+ isSet( $("#en, #sndp").parents().get(), q("foo", "main", "dl", "body", "html"), "Check for unique results from parents" );
1220
1225
  });
1221
1226
 
1222
1227
  test("next([String])", function() {
1223
- expect(4);
1224
- ok( $("#ap").next()[0].id == "foo", "Simple next check" );
1225
- ok( $("#ap").next("div")[0].id == "foo", "Filtered next check" );
1226
- ok( $("#ap").next("p").length == 0, "Filtered next check, no match" );
1227
- ok( $("#ap").next("div, p")[0].id == "foo", "Multiple filters" );
1228
+ expect(4);
1229
+ ok( $("#ap").next()[0].id == "foo", "Simple next check" );
1230
+ ok( $("#ap").next("div")[0].id == "foo", "Filtered next check" );
1231
+ ok( $("#ap").next("p").length == 0, "Filtered next check, no match" );
1232
+ ok( $("#ap").next("div, p")[0].id == "foo", "Multiple filters" );
1228
1233
  });
1229
-
1234
+
1230
1235
  test("prev([String])", function() {
1231
- expect(4);
1232
- ok( $("#foo").prev()[0].id == "ap", "Simple prev check" );
1233
- ok( $("#foo").prev("p")[0].id == "ap", "Filtered prev check" );
1234
- ok( $("#foo").prev("div").length == 0, "Filtered prev check, no match" );
1235
- ok( $("#foo").prev("p, div")[0].id == "ap", "Multiple filters" );
1236
+ expect(4);
1237
+ ok( $("#foo").prev()[0].id == "ap", "Simple prev check" );
1238
+ ok( $("#foo").prev("p")[0].id == "ap", "Filtered prev check" );
1239
+ ok( $("#foo").prev("div").length == 0, "Filtered prev check, no match" );
1240
+ ok( $("#foo").prev("p, div")[0].id == "ap", "Multiple filters" );
1236
1241
  });
1237
1242
 
1238
1243
  test("show()", function() {
1239
- expect(15);
1240
- var pass = true, div = $("div");
1241
- div.show().each(function(){
1242
- if ( this.style.display == "none" ) pass = false;
1243
- });
1244
- ok( pass, "Show" );
1245
-
1246
- $("#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>');
1247
- var test = {
1248
- "div" : "block",
1249
- "p" : "block",
1250
- "a" : "inline",
1251
- "code" : "inline",
1252
- "pre" : "block",
1253
- "span" : "inline",
1254
- "table" : $.browser.msie ? "block" : "table",
1255
- "thead" : $.browser.msie ? "block" : "table-header-group",
1256
- "tbody" : $.browser.msie ? "block" : "table-row-group",
1257
- "tr" : $.browser.msie ? "block" : "table-row",
1258
- "th" : $.browser.msie ? "block" : "table-cell",
1259
- "td" : $.browser.msie ? "block" : "table-cell",
1260
- "ul" : "block",
1261
- "li" : $.browser.msie ? "block" : "list-item"
1262
- };
1263
-
1264
- $.each(test, function(selector, expected) {
1265
- var elem = $(selector, "#show-tests").show();
1266
- equals( elem.css("display"), expected, "Show using correct display type for " + selector );
1267
- });
1244
+ expect(15);
1245
+ var pass = true, div = $("div");
1246
+ div.show().each(function(){
1247
+ if ( this.style.display == "none" ) pass = false;
1248
+ });
1249
+ ok( pass, "Show" );
1250
+
1251
+ $("#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>');
1252
+ var test = {
1253
+ "div" : "block",
1254
+ "p" : "block",
1255
+ "a" : "inline",
1256
+ "code" : "inline",
1257
+ "pre" : "block",
1258
+ "span" : "inline",
1259
+ "table" : $.browser.msie ? "block" : "table",
1260
+ "thead" : $.browser.msie ? "block" : "table-header-group",
1261
+ "tbody" : $.browser.msie ? "block" : "table-row-group",
1262
+ "tr" : $.browser.msie ? "block" : "table-row",
1263
+ "th" : $.browser.msie ? "block" : "table-cell",
1264
+ "td" : $.browser.msie ? "block" : "table-cell",
1265
+ "ul" : "block",
1266
+ "li" : $.browser.msie ? "block" : "list-item"
1267
+ };
1268
+
1269
+ $.each(test, function(selector, expected) {
1270
+ var elem = $(selector, "#show-tests").show();
1271
+ equals( elem.css("display"), expected, "Show using correct display type for " + selector );
1272
+ });
1268
1273
  });
1269
1274
 
1270
1275
  test("addClass(String)", function() {
1271
- expect(2);
1272
- var div = $("div");
1273
- div.addClass("test");
1274
- var pass = true;
1275
- for ( var i = 0; i < div.size(); i++ ) {
1276
- if ( div.get(i).className.indexOf("test") == -1 ) pass = false;
1277
- }
1278
- ok( pass, "Add Class" );
1276
+ expect(2);
1277
+ var div = $("div");
1278
+ div.addClass("test");
1279
+ var pass = true;
1280
+ for ( var i = 0; i < div.size(); i++ ) {
1281
+ if ( div.get(i).className.indexOf("test") == -1 ) pass = false;
1282
+ }
1283
+ ok( pass, "Add Class" );
1279
1284
 
1280
- // using contents will get regular, text, and comment nodes
1281
- var j = $("#nonnodes").contents();
1282
- j.addClass("asdf");
1283
- ok( j.hasClass("asdf"), "Check node,textnode,comment for addClass" );
1285
+ // using contents will get regular, text, and comment nodes
1286
+ var j = $("#nonnodes").contents();
1287
+ j.addClass("asdf");
1288
+ ok( j.hasClass("asdf"), "Check node,textnode,comment for addClass" );
1284
1289
  });
1285
1290
 
1286
1291
  test("removeClass(String) - simple", function() {
1287
- expect(4);
1288
- var div = $("div").addClass("test").removeClass("test"),
1289
- pass = true;
1290
- for ( var i = 0; i < div.size(); i++ ) {
1291
- if ( div.get(i).className.indexOf("test") != -1 ) pass = false;
1292
- }
1293
- ok( pass, "Remove Class" );
1294
-
1295
- reset();
1296
- var div = $("div").addClass("test").addClass("foo").addClass("bar");
1297
- div.removeClass("test").removeClass("bar").removeClass("foo");
1298
- var pass = true;
1299
- for ( var i = 0; i < div.size(); i++ ) {
1300
- if ( div.get(i).className.match(/test|bar|foo/) ) pass = false;
1301
- }
1302
- ok( pass, "Remove multiple classes" );
1303
-
1304
- reset();
1305
- var div = $("div:eq(0)").addClass("test").removeClass("");
1306
- ok( div.is('.test'), "Empty string passed to removeClass" );
1307
-
1308
- // using contents will get regular, text, and comment nodes
1309
- var j = $("#nonnodes").contents();
1310
- j.removeClass("asdf");
1311
- ok( !j.hasClass("asdf"), "Check node,textnode,comment for removeClass" );
1292
+ expect(4);
1293
+ var div = $("div").addClass("test").removeClass("test"),
1294
+ pass = true;
1295
+ for ( var i = 0; i < div.size(); i++ ) {
1296
+ if ( div.get(i).className.indexOf("test") != -1 ) pass = false;
1297
+ }
1298
+ ok( pass, "Remove Class" );
1299
+
1300
+ reset();
1301
+ var div = $("div").addClass("test").addClass("foo").addClass("bar");
1302
+ div.removeClass("test").removeClass("bar").removeClass("foo");
1303
+ var pass = true;
1304
+ for ( var i = 0; i < div.size(); i++ ) {
1305
+ if ( div.get(i).className.match(/test|bar|foo/) ) pass = false;
1306
+ }
1307
+ ok( pass, "Remove multiple classes" );
1308
+
1309
+ reset();
1310
+ var div = $("div:eq(0)").addClass("test").removeClass("");
1311
+ ok( div.is('.test'), "Empty string passed to removeClass" );
1312
+
1313
+ // using contents will get regular, text, and comment nodes
1314
+ var j = $("#nonnodes").contents();
1315
+ j.removeClass("asdf");
1316
+ ok( !j.hasClass("asdf"), "Check node,textnode,comment for removeClass" );
1312
1317
  });
1313
1318
 
1314
1319
  test("toggleClass(String)", function() {
1315
- expect(3);
1316
- var e = $("#firstp");
1317
- ok( !e.is(".test"), "Assert class not present" );
1318
- e.toggleClass("test");
1319
- ok( e.is(".test"), "Assert class present" );
1320
- e.toggleClass("test");
1321
- ok( !e.is(".test"), "Assert class not present" );
1320
+ expect(3);
1321
+ var e = $("#firstp");
1322
+ ok( !e.is(".test"), "Assert class not present" );
1323
+ e.toggleClass("test");
1324
+ ok( e.is(".test"), "Assert class present" );
1325
+ e.toggleClass("test");
1326
+ ok( !e.is(".test"), "Assert class not present" );
1322
1327
  });
1323
1328
 
1324
1329
  test("removeAttr(String", function() {
1325
- expect(1);
1326
- ok( $('#mark').removeAttr("class")[0].className == "", "remove class" );
1330
+ expect(1);
1331
+ ok( $('#mark').removeAttr("class")[0].className == "", "remove class" );
1327
1332
  });
1328
1333
 
1329
1334
  test("text(String)", function() {
1330
- expect(4);
1331
- ok( $("#foo").text("<div><b>Hello</b> cruel world!</div>")[0].innerHTML == "&lt;div&gt;&lt;b&gt;Hello&lt;/b&gt; cruel world!&lt;/div&gt;", "Check escaped text" );
1335
+ expect(4);
1336
+ ok( $("#foo").text("<div><b>Hello</b> cruel world!</div>")[0].innerHTML == "&lt;div&gt;&lt;b&gt;Hello&lt;/b&gt; cruel world!&lt;/div&gt;", "Check escaped text" );
1332
1337
 
1333
- // using contents will get comments regular, text, and comment nodes
1334
- var j = $("#nonnodes").contents();
1335
- j.text("hi!");
1336
- equals( $(j[0]).text(), "hi!", "Check node,textnode,comment with text()" );
1337
- equals( j[1].nodeValue, " there ", "Check node,textnode,comment with text()" );
1338
- equals( j[2].nodeType, 8, "Check node,textnode,comment with text()" );
1338
+ // using contents will get comments regular, text, and comment nodes
1339
+ var j = $("#nonnodes").contents();
1340
+ j.text("hi!");
1341
+ equals( $(j[0]).text(), "hi!", "Check node,textnode,comment with text()" );
1342
+ equals( j[1].nodeValue, " there ", "Check node,textnode,comment with text()" );
1343
+ equals( j[2].nodeType, 8, "Check node,textnode,comment with text()" );
1339
1344
  });
1340
1345
 
1341
1346
  test("$.each(Object,Function)", function() {
1342
- expect(12);
1343
- $.each( [0,1,2], function(i, n){
1344
- ok( i == n, "Check array iteration" );
1345
- });
1346
-
1347
- $.each( [5,6,7], function(i, n){
1348
- ok( i == n - 5, "Check array iteration" );
1349
- });
1350
-
1351
- $.each( { name: "name", lang: "lang" }, function(i, n){
1352
- ok( i == n, "Check object iteration" );
1353
- });
1347
+ expect(12);
1348
+ $.each( [0,1,2], function(i, n){
1349
+ ok( i == n, "Check array iteration" );
1350
+ });
1351
+
1352
+ $.each( [5,6,7], function(i, n){
1353
+ ok( i == n - 5, "Check array iteration" );
1354
+ });
1355
+
1356
+ $.each( { name: "name", lang: "lang" }, function(i, n){
1357
+ ok( i == n, "Check object iteration" );
1358
+ });
1354
1359
 
1355
1360
  var total = 0;
1356
1361
  jQuery.each([1,2,3], function(i,v){ total += v; });
@@ -1367,200 +1372,200 @@ test("$.each(Object,Function)", function() {
1367
1372
  });
1368
1373
 
1369
1374
  test("$.prop", function() {
1370
- expect(2);
1371
- var handle = function() { return this.id };
1372
- ok( $.prop($("#ap")[0], handle) == "ap", "Check with Function argument" );
1373
- ok( $.prop($("#ap")[0], "value") == "value", "Check with value argument" );
1375
+ expect(2);
1376
+ var handle = function() { return this.id };
1377
+ ok( $.prop($("#ap")[0], handle) == "ap", "Check with Function argument" );
1378
+ ok( $.prop($("#ap")[0], "value") == "value", "Check with value argument" );
1374
1379
  });
1375
1380
 
1376
1381
  test("$.className", function() {
1377
- expect(6);
1378
- var x = $("<p>Hi</p>")[0];
1379
- var c = $.className;
1380
- c.add(x, "hi");
1381
- ok( x.className == "hi", "Check single added class" );
1382
- c.add(x, "foo bar");
1383
- ok( x.className == "hi foo bar", "Check more added classes" );
1384
- c.remove(x);
1385
- ok( x.className == "", "Remove all classes" );
1386
- c.add(x, "hi foo bar");
1387
- c.remove(x, "foo");
1388
- ok( x.className == "hi bar", "Check removal of one class" );
1389
- ok( c.has(x, "hi"), "Check has1" );
1390
- ok( c.has(x, "bar"), "Check has2" );
1382
+ expect(6);
1383
+ var x = $("<p>Hi</p>")[0];
1384
+ var c = $.className;
1385
+ c.add(x, "hi");
1386
+ ok( x.className == "hi", "Check single added class" );
1387
+ c.add(x, "foo bar");
1388
+ ok( x.className == "hi foo bar", "Check more added classes" );
1389
+ c.remove(x);
1390
+ ok( x.className == "", "Remove all classes" );
1391
+ c.add(x, "hi foo bar");
1392
+ c.remove(x, "foo");
1393
+ ok( x.className == "hi bar", "Check removal of one class" );
1394
+ ok( c.has(x, "hi"), "Check has1" );
1395
+ ok( c.has(x, "bar"), "Check has2" );
1391
1396
  });
1392
1397
 
1393
1398
  test("$.data", function() {
1394
- expect(3);
1395
- var div = $("#foo")[0];
1396
- ok( jQuery.data(div, "test") == undefined, "Check for no data exists" );
1397
- jQuery.data(div, "test", "success");
1398
- ok( jQuery.data(div, "test") == "success", "Check for added data" );
1399
- jQuery.data(div, "test", "overwritten");
1400
- ok( jQuery.data(div, "test") == "overwritten", "Check for overwritten data" );
1399
+ expect(3);
1400
+ var div = $("#foo")[0];
1401
+ ok( jQuery.data(div, "test") == undefined, "Check for no data exists" );
1402
+ jQuery.data(div, "test", "success");
1403
+ ok( jQuery.data(div, "test") == "success", "Check for added data" );
1404
+ jQuery.data(div, "test", "overwritten");
1405
+ ok( jQuery.data(div, "test") == "overwritten", "Check for overwritten data" );
1401
1406
  });
1402
1407
 
1403
1408
  test(".data()", function() {
1404
- expect(16);
1405
- var div = $("#foo");
1406
- ok( div.data("test") == undefined, "Check for no data exists" );
1407
- div.data("test", "success");
1408
- ok( div.data("test") == "success", "Check for added data" );
1409
- div.data("test", "overwritten");
1410
- ok( div.data("test") == "overwritten", "Check for overwritten data" );
1411
-
1412
- var hits = {test:0}, gets = {test:0};
1413
-
1414
- div
1415
- .bind("setData",function(e,key,value){ hits[key] += value; })
1416
- .bind("setData.foo",function(e,key,value){ hits[key] += value; })
1417
- .bind("getData",function(e,key){ gets[key] += 1; })
1418
- .bind("getData.foo",function(e,key){ gets[key] += 3; });
1419
-
1420
- div.data("test.foo", 2);
1421
- ok( div.data("test") == "overwritten", "Check for original data" );
1422
- ok( div.data("test.foo") == 2, "Check for namespaced data" );
1423
- ok( div.data("test.bar") == "overwritten", "Check for unmatched namespace" );
1424
- equals( hits.test, 2, "Check triggered setter functions" );
1425
- equals( gets.test, 5, "Check triggered getter functions" );
1426
-
1427
- hits.test = 0;
1428
- gets.test = 0;
1429
-
1430
- div.data("test", 1);
1431
- ok( div.data("test") == 1, "Check for original data" );
1432
- ok( div.data("test.foo") == 2, "Check for namespaced data" );
1433
- ok( div.data("test.bar") == 1, "Check for unmatched namespace" );
1434
- equals( hits.test, 1, "Check triggered setter functions" );
1435
- equals( gets.test, 5, "Check triggered getter functions" );
1436
-
1437
- hits.test = 0;
1438
- gets.test = 0;
1439
-
1440
- div
1441
- .bind("getData",function(e,key){ return key + "root"; })
1442
- .bind("getData.foo",function(e,key){ return key + "foo"; });
1443
-
1444
- ok( div.data("test") == "testroot", "Check for original data" );
1445
- ok( div.data("test.foo") == "testfoo", "Check for namespaced data" );
1446
- ok( div.data("test.bar") == "testroot", "Check for unmatched namespace" );
1409
+ expect(16);
1410
+ var div = $("#foo");
1411
+ ok( div.data("test") == undefined, "Check for no data exists" );
1412
+ div.data("test", "success");
1413
+ ok( div.data("test") == "success", "Check for added data" );
1414
+ div.data("test", "overwritten");
1415
+ ok( div.data("test") == "overwritten", "Check for overwritten data" );
1416
+
1417
+ var hits = {test:0}, gets = {test:0};
1418
+
1419
+ div
1420
+ .bind("setData",function(e,key,value){ hits[key] += value; })
1421
+ .bind("setData.foo",function(e,key,value){ hits[key] += value; })
1422
+ .bind("getData",function(e,key){ gets[key] += 1; })
1423
+ .bind("getData.foo",function(e,key){ gets[key] += 3; });
1424
+
1425
+ div.data("test.foo", 2);
1426
+ ok( div.data("test") == "overwritten", "Check for original data" );
1427
+ ok( div.data("test.foo") == 2, "Check for namespaced data" );
1428
+ ok( div.data("test.bar") == "overwritten", "Check for unmatched namespace" );
1429
+ equals( hits.test, 2, "Check triggered setter functions" );
1430
+ equals( gets.test, 5, "Check triggered getter functions" );
1431
+
1432
+ hits.test = 0;
1433
+ gets.test = 0;
1434
+
1435
+ div.data("test", 1);
1436
+ ok( div.data("test") == 1, "Check for original data" );
1437
+ ok( div.data("test.foo") == 2, "Check for namespaced data" );
1438
+ ok( div.data("test.bar") == 1, "Check for unmatched namespace" );
1439
+ equals( hits.test, 1, "Check triggered setter functions" );
1440
+ equals( gets.test, 5, "Check triggered getter functions" );
1441
+
1442
+ hits.test = 0;
1443
+ gets.test = 0;
1444
+
1445
+ div
1446
+ .bind("getData",function(e,key){ return key + "root"; })
1447
+ .bind("getData.foo",function(e,key){ return key + "foo"; });
1448
+
1449
+ ok( div.data("test") == "testroot", "Check for original data" );
1450
+ ok( div.data("test.foo") == "testfoo", "Check for namespaced data" );
1451
+ ok( div.data("test.bar") == "testroot", "Check for unmatched namespace" );
1447
1452
  });
1448
1453
 
1449
1454
  test("$.removeData", function() {
1450
- expect(1);
1451
- var div = $("#foo")[0];
1452
- jQuery.data(div, "test", "testing");
1453
- jQuery.removeData(div, "test");
1454
- ok( jQuery.data(div, "test") == undefined, "Check removal of data" );
1455
+ expect(1);
1456
+ var div = $("#foo")[0];
1457
+ jQuery.data(div, "test", "testing");
1458
+ jQuery.removeData(div, "test");
1459
+ ok( jQuery.data(div, "test") == undefined, "Check removal of data" );
1455
1460
  });
1456
1461
 
1457
1462
  test(".removeData()", function() {
1458
- expect(6);
1459
- var div = $("#foo");
1460
- div.data("test", "testing");
1461
- div.removeData("test");
1462
- ok( div.data("test") == undefined, "Check removal of data" );
1463
+ expect(6);
1464
+ var div = $("#foo");
1465
+ div.data("test", "testing");
1466
+ div.removeData("test");
1467
+ ok( div.data("test") == undefined, "Check removal of data" );
1463
1468
 
1464
- div.data("test", "testing");
1465
- div.data("test.foo", "testing2");
1466
- div.removeData("test.bar");
1467
- ok( div.data("test.foo") == "testing2", "Make sure data is intact" );
1468
- ok( div.data("test") == "testing", "Make sure data is intact" );
1469
+ div.data("test", "testing");
1470
+ div.data("test.foo", "testing2");
1471
+ div.removeData("test.bar");
1472
+ ok( div.data("test.foo") == "testing2", "Make sure data is intact" );
1473
+ ok( div.data("test") == "testing", "Make sure data is intact" );
1469
1474
 
1470
- div.removeData("test");
1471
- ok( div.data("test.foo") == "testing2", "Make sure data is intact" );
1472
- ok( div.data("test") == undefined, "Make sure data is intact" );
1475
+ div.removeData("test");
1476
+ ok( div.data("test.foo") == "testing2", "Make sure data is intact" );
1477
+ ok( div.data("test") == undefined, "Make sure data is intact" );
1473
1478
 
1474
- div.removeData("test.foo");
1475
- ok( div.data("test.foo") == undefined, "Make sure data is intact" );
1479
+ div.removeData("test.foo");
1480
+ ok( div.data("test.foo") == undefined, "Make sure data is intact" );
1476
1481
  });
1477
1482
 
1478
1483
  test("remove()", function() {
1479
- expect(6);
1480
- $("#ap").children().remove();
1481
- ok( $("#ap").text().length > 10, "Check text is not removed" );
1482
- ok( $("#ap").children().length == 0, "Check remove" );
1483
-
1484
- reset();
1485
- $("#ap").children().remove("a");
1486
- ok( $("#ap").text().length > 10, "Check text is not removed" );
1487
- ok( $("#ap").children().length == 1, "Check filtered remove" );
1488
-
1489
- // using contents will get comments regular, text, and comment nodes
1490
- equals( $("#nonnodes").contents().length, 3, "Check node,textnode,comment remove works" );
1491
- $("#nonnodes").contents().remove();
1492
- equals( $("#nonnodes").contents().length, 0, "Check node,textnode,comment remove works" );
1484
+ expect(6);
1485
+ $("#ap").children().remove();
1486
+ ok( $("#ap").text().length > 10, "Check text is not removed" );
1487
+ ok( $("#ap").children().length == 0, "Check remove" );
1488
+
1489
+ reset();
1490
+ $("#ap").children().remove("a");
1491
+ ok( $("#ap").text().length > 10, "Check text is not removed" );
1492
+ ok( $("#ap").children().length == 1, "Check filtered remove" );
1493
+
1494
+ // using contents will get comments regular, text, and comment nodes
1495
+ equals( $("#nonnodes").contents().length, 3, "Check node,textnode,comment remove works" );
1496
+ $("#nonnodes").contents().remove();
1497
+ equals( $("#nonnodes").contents().length, 0, "Check node,textnode,comment remove works" );
1493
1498
  });
1494
1499
 
1495
1500
  test("empty()", function() {
1496
- expect(3);
1497
- ok( $("#ap").children().empty().text().length == 0, "Check text is removed" );
1498
- ok( $("#ap").children().length == 4, "Check elements are not removed" );
1501
+ expect(3);
1502
+ ok( $("#ap").children().empty().text().length == 0, "Check text is removed" );
1503
+ ok( $("#ap").children().length == 4, "Check elements are not removed" );
1499
1504
 
1500
- // using contents will get comments regular, text, and comment nodes
1501
- var j = $("#nonnodes").contents();
1502
- j.empty();
1503
- equals( j.html(), "", "Check node,textnode,comment empty works" );
1505
+ // using contents will get comments regular, text, and comment nodes
1506
+ var j = $("#nonnodes").contents();
1507
+ j.empty();
1508
+ equals( j.html(), "", "Check node,textnode,comment empty works" );
1504
1509
  });
1505
1510
 
1506
1511
  test("slice()", function() {
1507
- expect(5);
1508
- isSet( $("#ap a").slice(1,2), q("groups"), "slice(1,2)" );
1509
- isSet( $("#ap a").slice(1), q("groups", "anchor1", "mark"), "slice(1)" );
1510
- isSet( $("#ap a").slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" );
1511
- isSet( $("#ap a").slice(-1), q("mark"), "slice(-1)" );
1512
+ expect(5);
1513
+ isSet( $("#ap a").slice(1,2), q("groups"), "slice(1,2)" );
1514
+ isSet( $("#ap a").slice(1), q("groups", "anchor1", "mark"), "slice(1)" );
1515
+ isSet( $("#ap a").slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" );
1516
+ isSet( $("#ap a").slice(-1), q("mark"), "slice(-1)" );
1512
1517
 
1513
- isSet( $("#ap a").eq(1), q("groups"), "eq(1)" );
1518
+ isSet( $("#ap a").eq(1), q("groups"), "eq(1)" );
1514
1519
  });
1515
1520
 
1516
1521
  test("map()", function() {
1517
- expect(2);
1522
+ expect(2);
1518
1523
 
1519
- isSet(
1520
- $("#ap").map(function(){
1521
- return $(this).find("a").get();
1522
- }),
1523
- q("google", "groups", "anchor1", "mark"),
1524
- "Array Map"
1525
- );
1524
+ isSet(
1525
+ $("#ap").map(function(){
1526
+ return $(this).find("a").get();
1527
+ }),
1528
+ q("google", "groups", "anchor1", "mark"),
1529
+ "Array Map"
1530
+ );
1526
1531
 
1527
- isSet(
1528
- $("#ap > a").map(function(){
1529
- return this.parentNode;
1530
- }),
1531
- q("ap","ap","ap"),
1532
- "Single Map"
1533
- );
1532
+ isSet(
1533
+ $("#ap > a").map(function(){
1534
+ return this.parentNode;
1535
+ }),
1536
+ q("ap","ap","ap"),
1537
+ "Single Map"
1538
+ );
1534
1539
  });
1535
1540
 
1536
1541
  test("contents()", function() {
1537
- expect(12);
1538
- equals( $("#ap").contents().length, 9, "Check element contents" );
1539
- ok( $("#iframe").contents()[0], "Check existance of IFrame document" );
1540
- var ibody = $("#loadediframe").contents()[0].body;
1541
- ok( ibody, "Check existance of IFrame body" );
1542
+ expect(12);
1543
+ equals( $("#ap").contents().length, 9, "Check element contents" );
1544
+ ok( $("#iframe").contents()[0], "Check existance of IFrame document" );
1545
+ var ibody = $("#loadediframe").contents()[0].body;
1546
+ ok( ibody, "Check existance of IFrame body" );
1542
1547
 
1543
- equals( $("span", ibody).text(), "span text", "Find span in IFrame and check its text" );
1548
+ equals( $("span", ibody).text(), "span text", "Find span in IFrame and check its text" );
1544
1549
 
1545
- $(ibody).append("<div>init text</div>");
1546
- equals( $("div", ibody).length, 2, "Check the original div and the new div are in IFrame" );
1550
+ $(ibody).append("<div>init text</div>");
1551
+ equals( $("div", ibody).length, 2, "Check the original div and the new div are in IFrame" );
1547
1552
 
1548
- equals( $("div:last", ibody).text(), "init text", "Add text to div in IFrame" );
1553
+ equals( $("div:last", ibody).text(), "init text", "Add text to div in IFrame" );
1549
1554
 
1550
- $("div:last", ibody).text("div text");
1551
- equals( $("div:last", ibody).text(), "div text", "Add text to div in IFrame" );
1555
+ $("div:last", ibody).text("div text");
1556
+ equals( $("div:last", ibody).text(), "div text", "Add text to div in IFrame" );
1552
1557
 
1553
- $("div:last", ibody).remove();
1554
- equals( $("div", ibody).length, 1, "Delete the div and check only one div left in IFrame" );
1558
+ $("div:last", ibody).remove();
1559
+ equals( $("div", ibody).length, 1, "Delete the div and check only one div left in IFrame" );
1555
1560
 
1556
- equals( $("div", ibody).text(), "span text", "Make sure the correct div is still left after deletion in IFrame" );
1561
+ equals( $("div", ibody).text(), "span text", "Make sure the correct div is still left after deletion in IFrame" );
1557
1562
 
1558
- $("<table/>", ibody).append("<tr><td>cell</td></tr>").appendTo(ibody);
1559
- $("table", ibody).remove();
1560
- equals( $("div", ibody).length, 1, "Check for JS error on add and delete of a table in IFrame" );
1563
+ $("<table/>", ibody).append("<tr><td>cell</td></tr>").appendTo(ibody);
1564
+ $("table", ibody).remove();
1565
+ equals( $("div", ibody).length, 1, "Check for JS error on add and delete of a table in IFrame" );
1561
1566
 
1562
- // using contents will get comments regular, text, and comment nodes
1563
- var c = $("#nonnodes").contents().contents();
1564
- equals( c.length, 1, "Check node,textnode,comment contents is just one" );
1565
- equals( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" );
1567
+ // using contents will get comments regular, text, and comment nodes
1568
+ var c = $("#nonnodes").contents().contents();
1569
+ equals( c.length, 1, "Check node,textnode,comment contents is just one" );
1570
+ equals( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" );
1566
1571
  });