Commit ef819c91 authored by Mark Gibson's avatar Mark Gibson Committed by John Resig

Fixing endlines.

parent 0bb3998a
var expando = "jQuery" + now(), uuid = 0, windowData = {}; var expando = "jQuery" + now(), uuid = 0, windowData = {};
var emptyObject = {}; var emptyObject = {};
jQuery.extend({ jQuery.extend({
cache: {}, cache: {},
expando:expando, expando:expando,
data: function( elem, name, data ) { data: function( elem, name, data ) {
elem = elem == window ? elem = elem == window ?
windowData : windowData :
elem; elem;
var id = elem[ expando ], cache = jQuery.cache, thisCache; var id = elem[ expando ], cache = jQuery.cache, thisCache;
// Handle the case where there's no name immediately // Handle the case where there's no name immediately
if ( !name && !id ) { if ( !name && !id ) {
return null; return null;
} }
// Compute a unique ID for the element // Compute a unique ID for the element
if ( !id ) { if ( !id ) {
id = ++uuid; id = ++uuid;
} }
// Avoid generating a new cache unless none exists and we // Avoid generating a new cache unless none exists and we
// want to manipulate it. // want to manipulate it.
if ( cache[ id ] ) { if ( cache[ id ] ) {
thisCache = cache[ id ]; thisCache = cache[ id ];
} else if ( typeof data === "undefined" ) { } else if ( typeof data === "undefined" ) {
thisCache = emptyObject; thisCache = emptyObject;
} else { } else {
thisCache = cache[ id ] = {}; thisCache = cache[ id ] = {};
} }
// Prevent overriding the named cache with undefined values // Prevent overriding the named cache with undefined values
if ( data !== undefined ) { if ( data !== undefined ) {
elem[ expando ] = id; elem[ expando ] = id;
thisCache[ name ] = data; thisCache[ name ] = data;
} }
return name ? thisCache[ name ] : thisCache; return name ? thisCache[ name ] : thisCache;
}, },
removeData: function( elem, name ) { removeData: function( elem, name ) {
elem = elem == window ? elem = elem == window ?
windowData : windowData :
elem; elem;
var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ];
// If we want to remove a specific section of the element's data // If we want to remove a specific section of the element's data
if ( name ) { if ( name ) {
if ( thisCache ) { if ( thisCache ) {
// Remove the section of cache data // Remove the section of cache data
delete thisCache[ name ]; delete thisCache[ name ];
// If we've removed all the data, remove the element's cache // If we've removed all the data, remove the element's cache
if ( jQuery.isEmptyObject(thisCache) ) { if ( jQuery.isEmptyObject(thisCache) ) {
jQuery.removeData( elem ); jQuery.removeData( elem );
} }
} }
// Otherwise, we want to remove all of the element's data // Otherwise, we want to remove all of the element's data
} else { } else {
// Clean up the element expando // Clean up the element expando
try { try {
delete elem[ expando ]; delete elem[ expando ];
} catch( e ) { } catch( e ) {
// IE has trouble directly removing the expando // IE has trouble directly removing the expando
// but it's ok with using removeAttribute // but it's ok with using removeAttribute
if ( elem.removeAttribute ) { if ( elem.removeAttribute ) {
elem.removeAttribute( expando ); elem.removeAttribute( expando );
} }
} }
// Completely remove the data cache // Completely remove the data cache
delete cache[ id ]; delete cache[ id ];
} }
}, },
queue: function( elem, type, data ) { queue: function( elem, type, data ) {
if( !elem ) return; if( !elem ) return;
type = (type || "fx") + "queue"; type = (type || "fx") + "queue";
var q = jQuery.data( elem, type ); var q = jQuery.data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup // Speed up dequeue by getting out quickly if this is just a lookup
if( !data ) return q || []; if( !data ) return q || [];
if ( !q || jQuery.isArray(data) ) if ( !q || jQuery.isArray(data) )
q = jQuery.data( elem, type, jQuery.makeArray(data) ); q = jQuery.data( elem, type, jQuery.makeArray(data) );
else else
q.push( data ); q.push( data );
return q; return q;
}, },
dequeue: function( elem, type ){ dequeue: function( elem, type ){
type = type || "fx"; type = type || "fx";
var queue = jQuery.queue( elem, type ), fn = queue.shift(); var queue = jQuery.queue( elem, type ), fn = queue.shift();
// If the fx queue is dequeued, always remove the progress sentinel // If the fx queue is dequeued, always remove the progress sentinel
if( fn === "inprogress" ) fn = queue.shift(); if( fn === "inprogress" ) fn = queue.shift();
if( fn ) { if( fn ) {
// Add a progress sentinel to prevent the fx queue from being // Add a progress sentinel to prevent the fx queue from being
// automatically dequeued // automatically dequeued
if( type == "fx" ) queue.unshift("inprogress"); if( type == "fx" ) queue.unshift("inprogress");
fn.call(elem, function() { jQuery.dequeue(elem, type); }); fn.call(elem, function() { jQuery.dequeue(elem, type); });
} }
} }
}); });
jQuery.fn.extend({ jQuery.fn.extend({
data: function( key, value ){ data: function( key, value ){
if ( typeof key === "undefined" && this.length ) { if ( typeof key === "undefined" && this.length ) {
return jQuery.data( this[0] ); return jQuery.data( this[0] );
} }
var parts = key.split("."); var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : ""; parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) { if ( value === undefined ) {
var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
if ( data === undefined && this.length ) if ( data === undefined && this.length )
data = jQuery.data( this[0], key ); data = jQuery.data( this[0], key );
return data === undefined && parts[1] ? return data === undefined && parts[1] ?
this.data( parts[0] ) : this.data( parts[0] ) :
data; data;
} else } else
return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
jQuery.data( this, key, value ); jQuery.data( this, key, value );
}); });
}, },
removeData: function( key ){ removeData: function( key ){
return this.each(function(){ return this.each(function(){
jQuery.removeData( this, key ); jQuery.removeData( this, key );
}); });
}, },
queue: function(type, data){ queue: function(type, data){
if ( typeof type !== "string" ) { if ( typeof type !== "string" ) {
data = type; data = type;
type = "fx"; type = "fx";
} }
if ( data === undefined ) if ( data === undefined )
return jQuery.queue( this[0], type ); return jQuery.queue( this[0], type );
return this.each(function(i, elem){ return this.each(function(i, elem){
var queue = jQuery.queue( this, type, data ); var queue = jQuery.queue( this, type, data );
if( type == "fx" && queue[0] !== "inprogress" ) if( type == "fx" && queue[0] !== "inprogress" )
jQuery.dequeue( this, type ) jQuery.dequeue( this, type )
}); });
}, },
dequeue: function(type){ dequeue: function(type){
return this.each(function(){ return this.each(function(){
jQuery.dequeue( this, type ); jQuery.dequeue( this, type );
}); });
}, },
clearQueue: function(type){ clearQueue: function(type){
return this.queue( type || "fx", [] ); return this.queue( type || "fx", [] );
} }
}); });
<?php <?php
error_reporting(0); error_reporting(0);
$json = $_REQUEST['json']; $json = $_REQUEST['json'];
if($json) { if($json) {
echo '[ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ]'; echo '[ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ]';
} else { } else {
echo '{ "data": {"lang": "en", "length": 25} }'; echo '{ "data": {"lang": "en", "length": 25} }';
} }
?> ?>
\ No newline at end of file
<?php <?php
error_reporting(0); error_reporting(0);
$callback = $_REQUEST['callback']; $callback = $_REQUEST['callback'];
$json = $_REQUEST['json']; $json = $_REQUEST['json'];
if($json) { if($json) {
echo $callback . '([ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ])'; echo $callback . '([ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ])';
} else { } else {
echo $callback . '({ "data": {"lang": "en", "length": 25} })'; echo $callback . '({ "data": {"lang": "en", "length": 25} })';
} }
?> ?>
<?php <?php
error_reporting(0); error_reporting(0);
$wait = $_REQUEST['wait']; $wait = $_REQUEST['wait'];
if($wait) { if($wait) {
sleep($wait); sleep($wait);
} }
$xml = $_REQUEST['xml']; $xml = $_REQUEST['xml'];
if($xml) { if($xml) {
header("Content-type: text/xml"); header("Content-type: text/xml");
$result = ($xml == "5-2") ? "3" : "?"; $result = ($xml == "5-2") ? "3" : "?";
echo "<math><calculation>$xml</calculation><result>$result</result></math>"; echo "<math><calculation>$xml</calculation><result>$result</result></math>";
die(); die();
} }
$name = $_REQUEST['name']; $name = $_REQUEST['name'];
if($name == 'foo') { if($name == 'foo') {
echo "bar"; echo "bar";
die(); die();
} else if($name == 'peter') { } else if($name == 'peter') {
echo "pan"; echo "pan";
die(); die();
} }
$request = apache_request_headers(); $request = apache_request_headers();
$request = $request['X-Custom-Header']; $request = $request['X-Custom-Header'];
if(strlen($request) > 0) { if(strlen($request) > 0) {
echo $request; echo $request;
die(); die();
} }
echo 'ERROR <script type="text/javascript">ok( true, "name.php executed" );</script>'; echo 'ERROR <script type="text/javascript">ok( true, "name.php executed" );</script>';
?> ?>
\ No newline at end of file
<div id="post"> <div id="post">
<?php <?php
foreach( $_POST as $key=>$value ) foreach( $_POST as $key=>$value )
echo "<b id='$key'>$value</b>"; echo "<b id='$key'>$value</b>";
?> ?>
</div> </div>
<div id="get"> <div id="get">
<?php <?php
foreach( $_GET as $key=>$value ) foreach( $_GET as $key=>$value )
echo "<b id='$key'>$value</b>"; echo "<b id='$key'>$value</b>";
?> ?>
</div> </div>
\ No newline at end of file
var foobar = "bar"; var foobar = "bar";
jQuery('#ap').html('bar'); jQuery('#ap').html('bar');
ok( true, "test.js executed"); ok( true, "test.js executed");
<?php <?php
if( count($_POST) ){ // second call if( count($_POST) ){ // second call
$includes = array(); $includes = array();
foreach( $_POST as $lib=>$ver ){ foreach( $_POST as $lib=>$ver ){
if( !$ver ) if( !$ver )
continue; continue;
$include = "<script type='text/javascript' src='otherlibs/$lib/$ver/$lib.js'></script>\n"; $include = "<script type='text/javascript' src='otherlibs/$lib/$ver/$lib.js'></script>\n";
if( $lib == 'prototype' ) // prototype must be included first if( $lib == 'prototype' ) // prototype must be included first
array_unshift( $includes, $include ); array_unshift( $includes, $include );
else else
array_push( $includes, $include ); array_push( $includes, $include );
} }
$includes = implode( "\n", $includes ); $includes = implode( "\n", $includes );
$suite = file_get_contents('index.html'); $suite = file_get_contents('index.html');
echo str_replace( '<!-- Includes -->', $includes, $suite ); echo str_replace( '<!-- Includes -->', $includes, $suite );
exit; exit;
} }
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Test Suite</title> <title>jQuery Test Suite</title>
<link rel="Stylesheet" media="screen" href="qunit/testsuite.css" /> <link rel="Stylesheet" media="screen" href="qunit/testsuite.css" />
<link rel="Stylesheet" media="screen" href="data/otherlibs.css" /> <link rel="Stylesheet" media="screen" href="data/otherlibs.css" />
<style type="text/css"> <style type="text/css">
form.otherlibs{ form.otherlibs{
margin: 20px 0 0 30px; margin: 20px 0 0 30px;
} }
form.otherlibs label{ form.otherlibs label{
display:block; display:block;
margin: 5px 0 5px 30px; margin: 5px 0 5px 30px;
} }
form.otherlibs input.submit{ form.otherlibs input.submit{
margin:30px 0 0 0; margin:30px 0 0 0;
} }
</style> </style>
</head> </head>
<body id="body"> <body id="body">
<h1 id="header">jQuery Test Suite</h1> <h1 id="header">jQuery Test Suite</h1>
<h2 id="banner" class="fail"></h2> <h2 id="banner" class="fail"></h2>
<h2 id="userAgent">Choose other libraries to include</h2> <h2 id="userAgent">Choose other libraries to include</h2>
<form class="otherlibs" action="" method="post"> <form class="otherlibs" action="" method="post">
<?php <?php
$libs = scandir('otherlibs'); $libs = scandir('otherlibs');
foreach( $libs as $lib ){ foreach( $libs as $lib ){
if( $lib[0] == '.' ) if( $lib[0] == '.' )
continue; continue;
echo "<h3>$lib</h3>"; echo "<h3>$lib</h3>";
$vers = scandir( "otherlibs/$lib"); $vers = scandir( "otherlibs/$lib");
foreach( $vers as $ver ){ foreach( $vers as $ver ){
if( $ver[0] != '.' ) if( $ver[0] != '.' )
echo "<label><input type='checkbox' name='$lib' value='$ver'>$ver</label>"; echo "<label><input type='checkbox' name='$lib' value='$ver'>$ver</label>";
} }
} }
?> ?>
<input type="submit" value="Run" class="submit" /> <input type="submit" value="Run" class="submit" />
</form> </form>
</body> </body>
</html> </html>
This diff is collapsed.
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