Commit 3e0cc815 authored by Colin Snover's avatar Colin Snover

Clean trailing whitespace from all files.

parent 429b078d
......@@ -85,7 +85,7 @@ ${JQ}: ${MODULES} ${DIST_DIR}
@@cat ${MODULES} | \
sed 's/.function..jQuery...{//' | \
sed 's/}...jQuery..;//' | \
sed 's/Date:./&'"${DATE}"'/' | \
sed 's/@DATE/'"${DATE}"'/' | \
${VER} > ${JQ};
${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js
......
......@@ -31,7 +31,7 @@ rhino = "java -jar #{build_dir}/js.jar"
minfier = "java -jar #{build_dir}/google-compiler-20100917.jar"
# Turn off output other than needed from `sh` and file commands
verbose(false)
verbose(false)
# Tasks
task :default => "all"
......@@ -51,7 +51,7 @@ task :min => jq_min
task :init => [sizzle, qunit] do
sizzle_git = File.join(sizzle_dir, '.git')
qunit_git = File.join(qunit_dir, '.git')
puts "Updating SizzleJS with latest..."
sh "git --git-dir=#{sizzle_git} pull -q origin master"
......@@ -61,7 +61,7 @@ end
desc "Removes dist folder, selector.js, and Sizzle/QUnit"
task :clean do
puts "Removing Distribution directory: #{dist_dir}..."
puts "Removing Distribution directory: #{dist_dir}..."
rm_rf dist_dir
puts "Removing built copy of Sizzle..."
......@@ -87,9 +87,9 @@ directory dist_dir
file jq => [dist_dir, base_files].flatten do
puts "Building jquery.js..."
File.open(jq, 'w') do |f|
f.write cat(base_files).gsub(/(Date:.)/, "\\1#{date}" ).gsub(/@VERSION/, version)
f.write cat(base_files).gsub(/@DATE/, date).gsub(/@VERSION/, version)
end
end
......@@ -97,9 +97,9 @@ file jq_min => jq do
puts "Building jquery.min.js..."
sh "#{minfier} --js #{jq} --warning_level QUIET --js_output_file #{jq_min}"
min = File.read( jq_min )
# Equivilent of "head"
File.open(jq_min, 'w') do |f|
f.write File.readlines(jq)[0..14].join()
......@@ -107,12 +107,12 @@ file jq_min => jq do
end
end
file selector => [sizzle, :init] do
file selector => [sizzle, :init] do
puts "Building selector code from Sizzle..."
File.open(selector, 'w') do |f|
f.write File.read(sizzle).gsub(
/^.+EXPOSE$\n/,
f.write File.read(sizzle).gsub(
/^.+EXPOSE$\n/,
'\0' + File.read( File.join( src_dir, 'sizzle-jquery.js' ))
).gsub(
/^window.Sizzle.+$\n/, ''
......
......@@ -77,7 +77,7 @@
<arg line="log -1 --pretty=format:%ad" />
</exec>
<replaceregexp match="(\(\s*function\s*\(\s*jQuery\s*\)\s*\{)|(\}\s*\)\s*\(\s*jQuery\s*\)\s*;)" flags="g" replace="" file="${JQ}" />
<replaceregexp match="Date: " replace="Date: ${date}" file="${JQ}" />
<replaceregexp match="@DATE" replace="${date}" file="${JQ}" />
<echo message="${JQ} built." />
</target>
......
(function( jQuery ) {
var rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
......@@ -43,9 +43,9 @@ jQuery.fn.extend({
type = "POST";
}
}
var self = this;
// Request the remote document
jQuery.ajax({
url: url,
......@@ -171,7 +171,7 @@ jQuery.extend({
text: "Text",
json: "JSON"
},
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
......@@ -179,13 +179,13 @@ jQuery.extend({
json: "application/json, text/javascript",
"*": "*/*"
},
autoDataType: {
xml: /xml/,
html: /html/,
json: /json/
},
// Prefilters
// 1) They are useful to introduce custom dataTypes (see transport/jsonp for an example)
// 2) These are called:
......@@ -193,27 +193,27 @@ jQuery.extend({
// * AFTER param serialization (s.data is a string if s.processData is true)
// 3) They MUST be order agnostic
prefilters: [],
// Transports bindings
// 1) key is the dataType
// 2) the catchall symbol "*" can be used
// 3) selection will start with transport dataType and THEN go to "*" if needed
transports: {
},
// Checkers
// 1) key is dataType
// 2) they are called to control successful response
// 3) error throws is used as error data
dataCheckers: {
// Check if data is a string
"text": function(data) {
if ( typeof data != "string" ) {
jQuery.error("typeerror");
}
},
// Check if xml has been properly parsed
"xml": function(data) {
var documentElement = data ? data.documentElement : data;
......@@ -225,25 +225,25 @@ jQuery.extend({
}
}
},
// List of data converters
// 1) key format is "source_type => destination_type" (spaces required)
// 2) the catchall symbol "*" can be used for source_type
dataConverters: {
// Convert anything to text
"* => text": function(data) {
return "" + data;
},
// Text to html (no transformation)
"text => html": function(data) {
return data;
},
// Evaluate text as a json expression
"text => json": jQuery.parseJSON,
// Parse text as xml
"text => xml": function(data) {
var xml, parser;
......@@ -262,14 +262,14 @@ jQuery.extend({
// Main method
ajax: function( url , s ) {
if ( arguments.length === 1 ) {
s = url;
url = s ? s.url : undefined;
}
return jQuery.xhr().open( s ? s.type : undefined , url ).send( undefined , s );
},
// Serialize an array of form elements or a set of
......@@ -281,19 +281,19 @@ jQuery.extend({
value = jQuery.isFunction(value) ? value() : value;
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray(a) || a.jquery ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
......@@ -326,7 +326,7 @@ function buildParams( prefix, obj, traditional, add ) {
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && obj != null && typeof obj === "object" ) {
// If we see an array here, it is empty and should be treated as an empty
// object
......@@ -339,7 +339,7 @@ function buildParams( prefix, obj, traditional, add ) {
buildParams( prefix + "[" + k + "]", v, traditional, add );
});
}
} else {
// Serialize scalar item.
add( prefix, obj );
......@@ -373,7 +373,7 @@ if ( window.ActiveXObject ) {
return new window.XMLHttpRequest();
} catch( xhrError ) {}
}
try {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch( activeError ) {}
......
......@@ -182,7 +182,7 @@ jQuery.fn.extend({
var option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
// Get the specific value for the option
......
......@@ -56,10 +56,10 @@ var jQuery = function( selector, context ) {
// For matching the engine and version of the browser
browserMatch,
// Has the ready events already been bound?
readyBound = false,
// The functions to execute on DOM ready
readyList = [],
......@@ -73,7 +73,7 @@ var jQuery = function( selector, context ) {
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
// [[Class]] -> type pairs
class2type = {};
......@@ -92,7 +92,7 @@ jQuery.fn = jQuery.prototype = {
this.length = 1;
return this;
}
// The body element only exists once, optimize finding it
if ( selector === "body" && !context && document.body ) {
this.context = document;
......@@ -131,9 +131,9 @@ jQuery.fn = jQuery.prototype = {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
}
return jQuery.merge( this, selector );
// HANDLE: $("#id")
} else {
elem = document.getElementById( match[2] );
......@@ -226,7 +226,7 @@ jQuery.fn = jQuery.prototype = {
if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems );
} else {
jQuery.merge( ret, elems );
}
......@@ -252,7 +252,7 @@ jQuery.fn = jQuery.prototype = {
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Attach the listeners
jQuery.bindReady();
......@@ -270,7 +270,7 @@ jQuery.fn = jQuery.prototype = {
return this;
},
eq: function( i ) {
return i === -1 ?
this.slice( i ) :
......@@ -295,7 +295,7 @@ jQuery.fn = jQuery.prototype = {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || jQuery(null);
},
......@@ -384,14 +384,14 @@ jQuery.extend({
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Handle when the DOM is ready
ready: function( wait ) {
// A third-party is pushing the ready event forwards
......@@ -435,7 +435,7 @@ jQuery.extend({
}
}
},
bindReady: function() {
if ( readyBound ) {
return;
......@@ -454,7 +454,7 @@ jQuery.extend({
if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
......@@ -463,7 +463,7 @@ jQuery.extend({
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent("onreadystatechange", DOMContentLoaded);
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
......@@ -514,20 +514,20 @@ jQuery.extend({
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call(obj, "constructor") &&
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
},
......@@ -537,11 +537,11 @@ jQuery.extend({
}
return true;
},
error: function( msg ) {
throw msg;
},
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
......@@ -549,7 +549,7 @@ jQuery.extend({
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test(data.replace(rvalidescape, "@")
......@@ -691,7 +691,7 @@ jQuery.extend({
for ( var l = second.length; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
......@@ -772,7 +772,7 @@ jQuery.extend({
// The value/s can be optionally by executed if its a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
// Setting many attributes
if ( typeof key === "object" ) {
for ( var k in key ) {
......@@ -780,19 +780,19 @@ jQuery.extend({
}
return elems;
}
// Setting one attribute
if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = !pass && exec && jQuery.isFunction(value);
for ( var i = 0; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
return elems;
}
// Getting an attribute
return length ? fn( elems[0], key ) : undefined;
},
......
......@@ -25,7 +25,7 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
if ( !elem ) {
return size == null ? null : this;
}
if ( jQuery.isFunction( size ) ) {
return this.each(function( i ) {
var self = jQuery( this );
......
......@@ -61,7 +61,7 @@ jQuery.fn.extend({
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
var display = jQuery.css( this[i], "display" );
if ( display !== "none" && !jQuery.data( this[i], "olddisplay" ) ) {
jQuery.data( this[i], "olddisplay", display );
}
......
......@@ -11,7 +11,7 @@
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date:
* Date: @DATE
*/
(function( window, undefined ) {
......
......@@ -7,7 +7,7 @@ if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.fn.offset = function( options ) {
var elem = this[0], box;
if ( options ) {
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
......@@ -49,7 +49,7 @@ if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.fn.offset = function( options ) {
var elem = this[0];
if ( options ) {
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
......@@ -168,7 +168,7 @@ jQuery.offset = {
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
......@@ -202,7 +202,7 @@ jQuery.offset = {
if (options.left != null) {
props.left = (options.left - curOffset.left) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
......@@ -262,7 +262,7 @@ jQuery.each( ["Left", "Top"], function( i, name ) {
jQuery.fn[ method ] = function(val) {
var elem = this[0], win;
if ( !elem ) {
return null;
}
......
......@@ -51,7 +51,7 @@ jQuery.fn.extend({
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && jQuery.filter( selector, this ).length > 0;
},
......@@ -69,7 +69,7 @@ jQuery.fn.extend({
selector = selectors[i];
if ( !matches[selector] ) {
matches[selector] = jQuery.expr.match.POS.test( selector ) ?
matches[selector] = jQuery.expr.match.POS.test( selector ) ?
jQuery( selector, context || this.context ) :
selector;
}
......@@ -92,7 +92,7 @@ jQuery.fn.extend({
return ret;
}
var pos = POS.test( selectors ) ?
var pos = POS.test( selectors ) ?
jQuery( selectors, context || this.context ) : null;
for ( i = 0, l = this.length; i < l; i++ ) {
......@@ -113,10 +113,10 @@ jQuery.fn.extend({
}
ret = ret.length > 1 ? jQuery.unique(ret) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
......@@ -197,7 +197,7 @@ jQuery.each({
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
......@@ -226,7 +226,7 @@ jQuery.extend({
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
......
This diff is collapsed.
......@@ -4,16 +4,16 @@ header( "Sample-Header: Hello World" );
$headers = array();
foreach( $_SERVER as $key => $value ) {
if ( substr( $key , 0 , 5 ) == "HTTP_" ) {
foreach( $_SERVER as $key => $value ) {
if ( substr( $key , 0 , 5 ) == "HTTP_" ) {
$key = str_replace( "_" , "-" , substr( $key , 5) );
$headers[ $key ] = $value;
}
}
}
foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
echo "$key: " . $headers[ strtoupper( $key ) ] . "\n";
......
<div id="post">
<?php
<?php
foreach( $_POST as $key=>$value )
echo "<b id='$key'>$value</b>";
?>
?>
</div>
<div id="get">
<?php
foreach( $_GET as $key=>$value )
echo "<b id='$key'>$value</b>";
?>
?>
</div>
\ No newline at end of file
......@@ -206,7 +206,7 @@
$(document).bind("focusin", function() {
jQuery("#boundFocus").blink();
});
$(document).bind("focusout", function() {
jQuery("#boundBlur").blink();
});
......@@ -229,14 +229,14 @@
$(document).bind("change", function(){
jQuery("#boundChange").blink();
});
$("#text_submit").addSubmitTest("#textSubmit", true);
$("#password_submit").addSubmitTest("#passwordSubmit", true);
$("#submit_submit").addSubmitTest("#submitSubmit", true);
$(document).bind("submit", function(){
jQuery("#boundSubmit").blink();
});
</script>
</body>
</html>
......@@ -15,7 +15,7 @@
$suite = file_get_contents('index.html');
echo str_replace( '<!-- Includes -->', $includes, $suite );
exit;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
......@@ -43,7 +43,7 @@
<h1 id="header">jQuery Test Suite</h1>
<h2 id="banner" class="fail"></h2>
<h2 id="userAgent">Choose other libraries to include</h2>
<form class="otherlibs" action="" method="post">
<?php
$libs = scandir('otherlibs');
......
This diff is collapsed.
......@@ -4,13 +4,13 @@ var bareObj = function(value) { return value; };
var functionReturningObj = function(value) { return (function() { return value; }); };
test("jQuery.props: itegrity test", function() {
expect(1);
// This must be maintained and equal jQuery.props
// Ensure that accidental or erroneous property
// Ensure that accidental or erroneous property
// overwrites don't occur
// This is simply for better code coverage and future proofing.
// This is simply for better code coverage and future proofing.
var propsShouldBe = {
"for": "htmlFor",
"class": "className",
......@@ -23,7 +23,7 @@ test("jQuery.props: itegrity test", function() {
usemap: "useMap",
frameborder: "frameBorder"
};
same(propsShouldBe, jQuery.props, "jQuery.props passes integrity check");
});
......@@ -33,7 +33,7 @@ test("attr(String)", function() {
// This one sometimes fails randomly ?!
equals( jQuery('#text1').attr('value'), "Test", 'Check for value attribute' );
equals( jQuery('#text1').attr('value', "Test2").attr('defaultValue'), "Test", 'Check for defaultValue attribute' );
equals( jQuery('#text1').attr('type'), "text", 'Check for type attribute' );
equals( jQuery('#radio1').attr('type'), "radio", 'Check for type attribute' );
......@@ -255,30 +255,30 @@ test("attr(String, Object)", function() {
test("attr(jquery_method)", function(){
expect(7);
var $elem = jQuery("<div />"),
elem = $elem[0];
// one at a time
// one at a time
$elem.attr({'html': 'foo'}, true);
equals( elem.innerHTML, 'foo', 'attr(html)');
$elem.attr({'text': 'bar'}, true);
equals( elem.innerHTML, 'bar', 'attr(text)');
$elem.attr({'css': {color:'red'}}, true);
ok( /^(#ff0000|red)$/i.test(elem.style.color), 'attr(css)');
$elem.attr({'height': 10}, true);
equals( elem.style.height, '10px', 'attr(height)');
// Multiple attributes
$elem.attr({
width:10,
css:{ paddingLeft:1, paddingRight:1 }
}, true);
equals( elem.style.width, '10px', 'attr({...})');
equals( elem.style.paddingLeft, '1px', 'attr({...})');
equals( elem.style.paddingRight, '1px', 'attr({...})');
......@@ -491,7 +491,7 @@ test( "val(Array of Numbers) (Bug #7123)", function() {
ok( elements[1].checked, "Second element was checked" );
ok( !elements[2].checked, "Third element was unchecked" );
ok( !elements[3].checked, "Fourth element remained unchecked" );
elements.remove();
});
......@@ -672,7 +672,7 @@ test("removeClass(Function) with incoming value", function() {
ok( !$divs.is('.test'), "Remove Class" );
QUnit.reset();
QUnit.reset();
});
var testToggleClass = function(valueObj) {
......@@ -740,21 +740,21 @@ test("toggleClass(Fucntion[, boolean]) with incoming value", function() {
var e = jQuery("#firstp"), old = e.attr("class");
ok( !e.is(".test"), "Assert class not present" );
e.toggleClass(function(i, val) {
equals( val, old, "Make sure the incoming value is correct." );
return "test";
});
ok( e.is(".test"), "Assert class present" );
old = e.attr("class");
e.toggleClass(function(i, val) {
equals( val, old, "Make sure the incoming value is correct." );
return "test";
});
ok( !e.is(".test"), "Assert class not present" );
old = e.attr("class");
// class name with a boolean
......@@ -764,18 +764,18 @@ test("toggleClass(Fucntion[, boolean]) with incoming value", function() {
return "test";
}, false );
ok( !e.is(".test"), "Assert class not present" );
old = e.attr("class");
e.toggleClass(function(i, val, state) {
equals( val, old, "Make sure the incoming value is correct." );
equals( state, true, "Make sure that the state is passed in." );
return "test";
}, true );
ok( e.is(".test"), "Assert class present" );
old = e.attr("class");
e.toggleClass(function(i, val, state) {
equals( val, old, "Make sure the incoming value is correct." );
equals( state, false, "Make sure that the state is passed in." );
......@@ -790,25 +790,25 @@ test("toggleClass(Fucntion[, boolean]) with incoming value", function() {
test("addClass, removeClass, hasClass", function() {
expect(17);
var jq = jQuery("<p>Hi</p>"), x = jq[0];
jq.addClass("hi");
equals( x.className, "hi", "Check single added class" );
jq.addClass("foo bar");
equals( x.className, "hi foo bar", "Check more added classes" );
jq.removeClass();
equals( x.className, "", "Remove all classes" );
jq.addClass("hi foo bar");
jq.removeClass("foo");
equals( x.className, "hi bar", "Check removal of one class" );
ok( jq.hasClass("hi"), "Check has1" );
ok( jq.hasClass("bar"), "Check has2" );
var jq = jQuery("<p class='class1\nclass2\tcla.ss3\n\rclass4'></p>");
ok( jq.hasClass("class1"), "Check hasClass with line feed" );
ok( jq.is(".class1"), "Check is with line feed" );
......@@ -817,7 +817,7 @@ test("addClass, removeClass, hasClass", function() {
ok( jq.hasClass("cla.ss3"), "Check hasClass with dot" );
ok( jq.hasClass("class4"), "Check hasClass with carriage return" );
ok( jq.is(".class4"), "Check is with carriage return" );
jq.removeClass("class2");
ok( jq.hasClass("class2")==false, "Check the class has been properly removed" );
jq.removeClass("cla");
......
......@@ -178,24 +178,24 @@ if ( !jQuery.support.opacity ) {
test("css(String, Function)", function() {
expect(3);
var sizes = ["10px", "20px", "30px"];
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" +
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" +
"<div class='cssFunction'></div></div>")
.appendTo("body");
var index = 0;
jQuery("#cssFunctionTest div").css("font-size", function() {
var size = sizes[index];
index++;
return size;
});
index = 0;
jQuery("#cssFunctionTest div").each(function() {
var computedSize = jQuery(this).css("font-size")
var expectedSize = sizes[index]
......@@ -208,24 +208,24 @@ test("css(String, Function)", function() {
test("css(String, Function) with incoming value", function() {
expect(3);
var sizes = ["10px", "20px", "30px"];
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" +
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" +
"<div class='cssFunction'></div></div>")
.appendTo("body");
var index = 0;
jQuery("#cssFunctionTest div").css("font-size", function() {
var size = sizes[index];
index++;
return size;
});
index = 0;
jQuery("#cssFunctionTest div").css("font-size", function(i, computedSize) {
var expectedSize = sizes[index]
equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
......@@ -238,61 +238,61 @@ test("css(String, Function) with incoming value", function() {
test("css(Object) where values are Functions", function() {
expect(3);
var sizes = ["10px", "20px", "30px"];
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" +
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" +
"<div class='cssFunction'></div></div>")
.appendTo("body");
var index = 0;
jQuery("#cssFunctionTest div").css({fontSize: function() {
var size = sizes[index];
index++;
return size;
}});
index = 0;
jQuery("#cssFunctionTest div").each(function() {
var computedSize = jQuery(this).css("font-size")
var expectedSize = sizes[index]
equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
index++;
});
jQuery("#cssFunctionTest").remove();
});
test("css(Object) where values are Functions with incoming values", function() {
expect(3);
var sizes = ["10px", "20px", "30px"];
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" +
jQuery("<div id='cssFunctionTest'><div class='cssFunction'></div>" +
"<div class='cssFunction'></div>" +
"<div class='cssFunction'></div></div>")
.appendTo("body");
var index = 0;
jQuery("#cssFunctionTest div").css({fontSize: function() {
var size = sizes[index];
index++;
return size;
}});
index = 0;
jQuery("#cssFunctionTest div").css({"font-size": function(i, computedSize) {
var expectedSize = sizes[index]
equals( computedSize, expectedSize, "Div #" + index + " should be " + expectedSize );
index++;
return computedSize;
}});
jQuery("#cssFunctionTest").remove();
});
......
......@@ -45,13 +45,13 @@ test("width() with function", function() {
test("width() with function args", function() {
expect( 2 );
var $div = jQuery("#nothiddendiv");
$div.width( 30 ).width(function(i, width) {
equals( width, 30, "Make sure previous value is corrrect." );
return width + 1;
});
equals( $div.width(), 31, "Make sure value was modified correctly." );
});
......@@ -92,13 +92,13 @@ test("height() with function", function() {
test("height() with function args", function() {
expect( 2 );
var $div = jQuery("#nothiddendiv");
$div.height( 30 ).height(function(i, height) {
equals( height, 30, "Make sure previous value is corrrect." );
return height + 1;
});
equals( $div.height(), 31, "Make sure value was modified correctly." );
});
......@@ -112,13 +112,13 @@ test("innerWidth()", function() {
border: "2px solid #fff",
width: 30
});
equals($div.innerWidth(), 30, "Test with margin and border");
$div.css("padding", "20px");
equals($div.innerWidth(), 70, "Test with margin, border and padding");
$div.hide();
equals($div.innerWidth(), 70, "Test hidden div");
// reset styles
$div.css({ display: "", border: "", padding: "", width: "", height: "" });
......@@ -130,7 +130,7 @@ test("innerWidth()", function() {
test("innerHeight()", function() {
expect(4);
var $div = jQuery("#nothiddendiv");
// set styles
$div.css({
......@@ -138,13 +138,13 @@ test("innerHeight()", function() {
border: "2px solid #fff",
height: 30
});
equals($div.innerHeight(), 30, "Test with margin and border");
$div.css("padding", "20px");
equals($div.innerHeight(), 70, "Test with margin, border and padding");
$div.hide();
equals($div.innerHeight(), 70, "Test hidden div");
// reset styles
$div.css({ display: "", border: "", padding: "", width: "", height: "" });
......@@ -156,10 +156,10 @@ test("innerHeight()", function() {
test("outerWidth()", function() {
expect(7);
var $div = jQuery("#nothiddendiv");
$div.css("width", 30);
equals($div.outerWidth(), 30, "Test with only width set");
$div.css("padding", "20px");
equals($div.outerWidth(), 70, "Test with padding");
......@@ -171,7 +171,7 @@ test("outerWidth()", function() {
equals($div.outerWidth(true), 94, "Test with padding, border and margin with margin option");
$div.hide();
equals($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option");
// reset styles
$div.css({ position: "", display: "", border: "", padding: "", width: "", height: "" });
......@@ -183,10 +183,10 @@ test("outerWidth()", function() {
test("outerHeight()", function() {
expect(7);
var $div = jQuery("#nothiddendiv");
$div.css("height", 30);
equals($div.outerHeight(), 30, "Test with only width set");
$div.css("padding", "20px");
equals($div.outerHeight(), 70, "Test with padding");
......@@ -197,7 +197,7 @@ test("outerHeight()", function() {
equals($div.outerHeight(true), 94, "Test with padding, border and margin with margin option");
$div.hide();
equals($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option");
// reset styles
$div.css({ display: "", border: "", padding: "", width: "", height: "" });
......
......@@ -64,7 +64,7 @@ test("show()", function() {
// #show-tests * is set display: none in CSS
jQuery("#main").append('<div id="show-tests"><div><p><a href="#"></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id="test-table"></table>');
var old = jQuery("#test-table").show().css("display") !== "table";
jQuery("#test-table").remove();
......@@ -140,15 +140,15 @@ test("Persist correct display value", function() {
// #show-tests * is set display: none in CSS
jQuery("#main").append('<div id="show-tests"><span style="position:absolute;">foo</span></div>');
var $span = jQuery("#show-tests span"),
var $span = jQuery("#show-tests span"),
displayNone = $span.css("display"),
display = '', num = 0;
$span.show();
display = $span.css("display");
$span.hide();
$span.fadeIn(100, function() {
......@@ -156,13 +156,13 @@ test("Persist correct display value", function() {
equals($span.css("display"), display, "Expecting display: " + display);
$span.fadeOut(100, function () {
equals($span.css("display"), displayNone, "Expecting display: " + displayNone);
$span.fadeIn(100, function() {
equals($span.css("display"), display, "Expecting display: " + display);
start();
});
});
......@@ -194,7 +194,7 @@ test("animate block as inline width/height", function() {
var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
expected = span.css("display");
span.remove();
if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
......@@ -220,7 +220,7 @@ test("animate native inline width/height", function() {
var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
expected = span.css("display");
span.remove();
if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
......@@ -889,7 +889,7 @@ test("hide hidden elements, with animation (bug #7141)", function() {
expect(3);
QUnit.reset();
stop();
var div = jQuery("<div style='display:none'></div>").appendTo("#main");
equals( div.css("display"), "none", "Element is hidden by default" );
div.hide(1, function () {
......
This diff is collapsed.
This diff is collapsed.
......@@ -3,9 +3,9 @@ module("queue");
test("queue() with other types",function() {
expect(9);
var counter = 0;
var $div = jQuery({});
$div
.queue('foo',function(){
equals( ++counter, 1, "Dequeuing" );
......@@ -21,26 +21,26 @@ test("queue() with other types",function() {
.queue('foo',function(){
equals( ++counter, 4, "Dequeuing" );
});
equals( $div.queue('foo').length, 4, "Testing queue length" );
$div.dequeue('foo');
equals( counter, 3, "Testing previous call to dequeue" );
equals( $div.queue('foo').length, 1, "Testing queue length" );
$div.dequeue('foo');
equals( counter, 4, "Testing previous call to dequeue" );
equals( $div.queue('foo').length, 0, "Testing queue length" );
});
test("queue(name) passes in the next item in the queue as a parameter", function() {
expect(2);
var div = jQuery({});
var counter = 0;
div.queue("foo", function(next) {
equals(++counter, 1, "Dequeueing");
next();
......@@ -50,16 +50,16 @@ test("queue(name) passes in the next item in the queue as a parameter", function
}).queue("bar", function() {
equals(++counter, 3, "Other queues are not triggered by next()")
});
div.dequeue("foo");
});
test("queue(name) passes in the next item in the queue as a parameter", function() {
expect(2);
var div = jQuery({});
var counter = 0;
div.queue("foo", function(next) {
equals(++counter, 1, "Dequeueing");
next();
......@@ -69,17 +69,17 @@ test("queue(name) passes in the next item in the queue as a parameter", function
}).queue("bar", function() {
equals(++counter, 3, "Other queues are not triggered by next()")
});
div.dequeue("foo");
});
test("queue() passes in the next item in the queue as a parameter to fx queues", function() {
expect(2);
stop();
var div = jQuery({});
var counter = 0;
div.queue(function(next) {
equals(++counter, 1, "Dequeueing");
var self = this;
......@@ -111,10 +111,10 @@ test("delay()", function() {
test("clearQueue(name) clears the queue", function() {
expect(1);
var div = jQuery({});
var counter = 0;
div.queue("foo", function(next) {
counter++;
jQuery(this).clearQueue("foo");
......@@ -122,18 +122,18 @@ test("clearQueue(name) clears the queue", function() {
}).queue("foo", function(next) {
counter++;
});
div.dequeue("foo");
equals(counter, 1, "the queue was cleared");
});
test("clearQueue() clears the fx queue", function() {
expect(1);
var div = jQuery({});
var counter = 0;
div.queue(function(next) {
counter++;
var self = this;
......@@ -141,8 +141,8 @@ test("clearQueue() clears the fx queue", function() {
}).queue(function(next) {
counter++;
});
equals(counter, 1, "the queue was cleared");
div.removeData();
});
......@@ -22,7 +22,7 @@ test("element", function() {
same( jQuery("div").find("p").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
same( jQuery("#form").find("select").get(), q("select1","select2","select3","select4","select5"), "Finding selects with a context." );
ok( jQuery("#length").length, '&lt;input name="length"&gt; cannot be found under IE, see #945' );
ok( jQuery("#lengthtest input").length, '&lt;input name="length"&gt; cannot be found under IE, see #945' );
......@@ -68,7 +68,7 @@ test("broken", function() {
name + ": " + selector );
}
}
broken( "Broken Selector", "[", [] );
broken( "Broken Selector", "(", [] );
broken( "Broken Selector", "{", [] );
......@@ -90,28 +90,28 @@ test("id", function() {
t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", ["台北Táiběi","台北"] );
t( "Descendant ID selector using UTF8", "div #台北", ["台北"] );
t( "Child ID selector using UTF8", "form > #台北", ["台北"] );
t( "Escaped ID", "#foo\\:bar", ["foo:bar"] );
t( "Escaped ID", "#test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
t( "Descendant escaped ID", "div #foo\\:bar", ["foo:bar"] );
t( "Descendant escaped ID", "div #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
t( "Child escaped ID", "form > #foo\\:bar", ["foo:bar"] );
t( "Child escaped ID", "form > #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] ); // bug #267
t( "ID Selector, not an ancestor ID", "#form #first", [] );
t( "ID Selector, not a child ID", "#form > #option1a", [] );
t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] );
t( "All Children of ID with no children", "#firstUL > *", [] );
var a = jQuery('<div><a name="tName1">tName1 A</a><a name="tName2">tName2 A</a><div id="tName1">tName1 Div</div></div>').appendTo('#main');
equals( jQuery("#tName1")[0].id, 'tName1', "ID selector with same value for a name attribute" );
equals( jQuery("#tName2").length, 0, "ID selector non-existing but name attribute on an A tag" );
a.remove();
t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", ["lengthtest"] );
t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
same( jQuery("body").find("div#form").get(), [], "ID selector within the context of another element" );
......@@ -134,7 +134,7 @@ test("class", function() {
same( jQuery(".blog", "p").get(), q("mark", "simon"), "Finding elements with a context." );
same( jQuery(".blog", jQuery("p")).get(), q("mark", "simon"), "Finding elements with a context." );
same( jQuery("p").find(".blog").get(), q("mark", "simon"), "Finding elements with a context." );
t( "Class selector using UTF8", ".台北Táiběi", ["utf8class1"] );
//t( "Class selector using UTF8", ".台北", ["utf8class1","utf8class2"] );
t( "Class selector using UTF8", ".台北Táiběi.台北", ["utf8class1"] );
......@@ -194,7 +194,7 @@ test("name", function() {
test("multiple", function() {
expect(4);
t( "Comma Support", "h2, p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"]);
t( "Comma Support", "h2 , p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"]);
t( "Comma Support", "h2 , p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"]);
......@@ -242,7 +242,7 @@ test("attributes", function() {
t( "Attribute Exists", "*[title]", ["google"] );
t( "Attribute Exists", "[title]", ["google"] );
t( "Attribute Exists", "a[ title ]", ["google"] );
t( "Attribute Equals", "a[rel='bookmark']", ["simon1"] );
t( "Attribute Equals", 'a[rel="bookmark"]', ["simon1"] );
t( "Attribute Equals", "a[rel=bookmark]", ["simon1"] );
......@@ -263,13 +263,13 @@ test("attributes", function() {
t( "Attribute containing []", "input[name$='[bar]']", ["hidden2"] );
t( "Attribute containing []", "input[name$='foo[bar]']", ["hidden2"] );
t( "Attribute containing []", "input[name*='foo[bar]']", ["hidden2"] );
t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type='hidden']", ["radio1", "radio2", "hidden1"] );
t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=\"hidden\"]", ["radio1", "radio2", "hidden1"] );
t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=hidden]", ["radio1", "radio2", "hidden1"] );
t( "Attribute selector using UTF8", "span[lang=中文]", ["台北"] );
t( "Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"] );
t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] );
t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] );
......@@ -288,11 +288,11 @@ test("attributes", function() {
t("Empty values", "#select1 option[value='']", ["option1a"]);
t("Empty values", "#select1 option[value!='']", ["option1b","option1c","option1d"]);
t("Select options via :selected", "#select1 option:selected", ["option1a"] );
t("Select options via :selected", "#select2 option:selected", ["option2d"] );
t("Select options via :selected", "#select3 option:selected", ["option3b", "option3c"] );
t( "Grouped Form Elements", "input[name='foo[bar]']", ["hidden2"] );
});
......@@ -315,10 +315,10 @@ test("pseudo - child", function() {
t( "First Child", "p:first-child", [] );
QUnit.reset();
t( "Last Child", "p:last-child", ["sap"] );
t( "Last Child", "#main a:last-child", ["simon1","anchor1","mark","yahoo","anchor2","simon","liveLink1","liveLink2"] );
t( "Nth-child", "#main form#form > *:nth-child(2)", ["text1"] );
t( "Nth-child", "#main form#form > :nth-child(2)", ["text1"] );
......@@ -347,7 +347,7 @@ test("pseudo - misc", function() {
t( "Headers", ":header", ["qunit-header", "qunit-banner", "qunit-userAgent"] );
t( "Has Children - :has()", "p:has(a)", ["firstp","ap","en","sap"] );
var select = document.getElementById("select1");
ok( (window.Sizzle || window.jQuery.find).matchesSelector( select, ":has(option)" ), "Has Option Matches" );
......@@ -393,7 +393,7 @@ test("pseudo - :not", function() {
t( ":not() Multiple Class", "#foo a:not(.blog.link)", ["yahoo","anchor2"] );
});
test("pseudo - position", function() {
test("pseudo - position", function() {
expect(25);
t( "nth Element", "p:nth(1)", ["ap"] );
t( "First Element", "p:first", ["firstp"] );
......
......@@ -138,7 +138,7 @@ test("closest()", function() {
same( jq.closest("html", document.body).get(), [], "Context limited." );
same( jq.closest("body", document.body).get(), [], "Context limited." );
same( jq.closest("#nothiddendiv", document.body).get(), q("nothiddendiv"), "Context not reached." );
//Test that .closest() returns unique'd set
equals( jQuery('#main p').closest('#main').length, 1, "Closest should return a unique set" );
......@@ -275,9 +275,9 @@ test("parents([String])", function() {
test("parentsUntil([String])", function() {
expect(9);
var parents = jQuery("#groups").parents();
same( jQuery("#groups").parentsUntil().get(), parents.get(), "parentsUntil with no selector (nextAll)" );
same( jQuery("#groups").parentsUntil(".foo").get(), parents.get(), "parentsUntil with invalid selector (nextAll)" );
same( jQuery("#groups").parentsUntil("#html").get(), parents.not(':last').get(), "Simple parentsUntil check" );
......@@ -307,9 +307,9 @@ test("prev([String])", function() {
test("nextAll([String])", function() {
expect(4);
var elems = jQuery('#form').children();
same( jQuery("#label-for").nextAll().get(), elems.not(':first').get(), "Simple nextAll check" );
same( jQuery("#label-for").nextAll('input').get(), elems.not(':first').filter('input').get(), "Filtered nextAll check" );
same( jQuery("#label-for").nextAll('input,select').get(), elems.not(':first').filter('input,select').get(), "Multiple-filtered nextAll check" );
......@@ -318,9 +318,9 @@ test("nextAll([String])", function() {
test("prevAll([String])", function() {
expect(4);
var elems = jQuery( jQuery('#form').children().slice(0, 12).get().reverse() );
same( jQuery("#area1").prevAll().get(), elems.get(), "Simple prevAll check" );
same( jQuery("#area1").prevAll('input').get(), elems.filter('input').get(), "Filtered prevAll check" );
same( jQuery("#area1").prevAll('input,select').get(), elems.filter('input,select').get(), "Multiple-filtered prevAll check" );
......@@ -329,9 +329,9 @@ test("prevAll([String])", function() {
test("nextUntil([String])", function() {
expect(11);
var elems = jQuery('#form').children().slice( 2, 12 );
same( jQuery("#text1").nextUntil().get(), jQuery("#text1").nextAll().get(), "nextUntil with no selector (nextAll)" );
same( jQuery("#text1").nextUntil(".foo").get(), jQuery("#text1").nextAll().get(), "nextUntil with invalid selector (nextAll)" );
same( jQuery("#text1").nextUntil("#area1").get(), elems.get(), "Simple nextUntil check" );
......@@ -342,15 +342,15 @@ test("nextUntil([String])", function() {
same( jQuery("#text1").nextUntil("#area1", "button,input").get(), elems.get(), "Multiple-filtered nextUntil check" );
equals( jQuery("#text1").nextUntil("#area1", "div").length, 0, "Filtered nextUntil check, no match" );
same( jQuery("#text1, #hidden1").nextUntil("#area1", "button,input").get(), elems.get(), "Multi-source, multiple-filtered nextUntil check" );
same( jQuery("#text1").nextUntil("[class=foo]").get(), jQuery("#text1").nextAll().get(), "Non-element nodes must be skipped, since they have no attributes" );
});
test("prevUntil([String])", function() {
expect(10);
var elems = jQuery("#area1").prevAll();
same( jQuery("#area1").prevUntil().get(), elems.get(), "prevUntil with no selector (prevAll)" );
same( jQuery("#area1").prevUntil(".foo").get(), elems.get(), "prevUntil with invalid selector (prevAll)" );
same( jQuery("#area1").prevUntil("label").get(), elems.not(':last').get(), "Simple prevUntil check" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment