1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

merge from dev

This commit is contained in:
Luke Pulverenti 2016-01-14 12:04:42 -05:00
parent d96250df7f
commit bcfee41a57
318 changed files with 54424 additions and 6419 deletions

View file

@ -0,0 +1,56 @@
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"immed": true,
"noarg": true,
"quotmark": "double",
"undef": true,
"unused": true,
"es3": true,
"evil": true,
"sub": true,
"browser": true,
"devel": true,
"wsh": true,
"globals": {
"require": false,
"define": false,
"DOMParser": false,
"JSON": false,
"Promise": false,
"Symbol": false,
"QUnit": false,
"ajaxTest": false,
"testIframe": false,
"testIframeWithCallback": false,
"iframeCallback": true,
"createDashboardXML": false,
"createXMLFragment": false,
"moduleTeardown": false,
"testFoo": false,
"url": false,
"t": false,
"q": false,
"jQuery": true,
"sinon": true,
"amdDefined": true,
"fireNative": true,
"Globals": true,
"hasPHP": true,
"isLocal": true,
"supportjQuery": true,
"originaljQuery": true,
"$": true,
"original$": true,
"baseURL": true,
"externalHost": true
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

View file

@ -0,0 +1,5 @@
<?php
$type = $_REQUEST['content-type'];
header("Content-type: $type");
echo $_REQUEST['response']
?>

View file

@ -0,0 +1 @@
ok( "<?php echo $_SERVER['REQUEST_METHOD'] ?>" === "GET", "request method is <?php echo $_SERVER['REQUEST_METHOD'] ?>" );

View file

@ -0,0 +1 @@
<?php echo $_SERVER['REQUEST_METHOD'] ?>

View file

@ -0,0 +1,30 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>onunload ajax requests (#14379)</title>
<script src="../../jquery.js"></script>
</head>
<body>
<form id="navigate" action="../iframe.html"></form>
<script>
jQuery( window ).on( "unload", function() {
var ajaxStatus;
jQuery.ajax({
url: "../name.html",
async: false,
complete: function( xhr, status ) {
ajaxStatus = status;
}
});
parent.iframeCallback( ajaxStatus );
});
jQuery(function() {
setTimeout(function() {
document.getElementById( "navigate" ).submit();
}, 0 );
});
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Attempt to block tests because of dangling XHR requests (IE)</title>
<script src="../../jquery.js"></script>
<script type="text/javascript">
window.onunload = function() {};
jQuery(function() {
setTimeout(function() {
var parent = window.parent;
document.write("");
parent.iframeCallback();
}, 200 );
var number = 50;
while( number-- ) {
jQuery.ajax("../name.php?wait=10");
}
});
</script>
</head>
<body>
<!-- empty body -->
</body>
</html>

View file

@ -0,0 +1,4 @@
<?php header("Content-type: atom+xml") ?>
<root>
<element />
</root>

View file

@ -0,0 +1 @@
undefined();

View file

@ -0,0 +1 @@
{bad: toTheBone;}

View file

@ -0,0 +1,10 @@
<script>
<!--
ok( true, "script within html comments executed" );
-->
</script>
<script>
<![CDATA[
ok( true, "script within CDATA executed" );
]]>
</script>

View file

@ -0,0 +1,24 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>alias-masked DOM properties (#14074)</title>
<script>
var errors = [];
window.onerror = function( errorMessage, filePath, lineNumber ) {
errors.push( errorMessage );
};
</script>
<script src="../../jquery.js"></script>
</head>
<body>
<form>
<input type="text" id="nodeName"/>
</form>
<script>
jQuery(function() {
window.parent.iframeCallback( errors );
});
</script>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script>
var cc_on = false,
errors = [];
/*@cc_on
cc_on = true;
@*/
window.onerror = function( errorMessage, filePath, lineNumber ) {
errors.push( errorMessage );
};
</script>
<script src="../../jquery.js"></script>
</head>
<body>
<script>
window.parent.iframeCallback( cc_on, errors, jQuery );
</script>
</body>
</html>

View file

@ -0,0 +1,3 @@
<?php
sleep(30);
?>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../jquery.js"></script>
<script>var $j = jQuery.noConflict();</script>
</head>
<body>
<iframe id="dont_return" src="dont_return.php"></iframe>
<script>
var timeoutId, $,
timeoutFired = false;
setTimeout(function () {
// Load another jQuery copy using the first one.
$j.getScript( "../../../dist/jquery.js", function () {
$j( "#dont_return" ).attr( "src", "about:blank" );
// document ready handled by the just-loaded jQuery copy.
$(function () {
clearTimeout( timeoutId );
if ( !timeoutFired ) {
window.parent.iframeCallback( true );
}
});
});
timeoutId = setTimeout(function () {
timeoutFired = true;
window.parent.iframeCallback( false );
}, 10000);
});
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>alias-masked DOM properties (#14074)</title>
<script>
var error = false;
window.onready = function() { error = "Called window.onready"; };
</script>
<script src="../../jquery.js"></script>
</head>
<body>
<form>
<input type="text" id="nodeName"/>
</form>
<script>
jQuery(function() {
setTimeout( function() {
window.parent.iframeCallback( error );
});
});
</script>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
#test {
-webkit-box-sizing: border-box;
box-sizing: border-box;
width: 100px;
height: 100px;
padding: 10px;
}
</style>
</head>
<body>
<div id="test"></div>
<script src="../../jquery.js"></script>
<script>
window.parent.iframeCallback( jQuery( "#test" ).css( 'width' ) );
</script>
</body>
</html>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<dashboard>
<locations class="foo">
<location for="bar" checked="different">
<infowindowtab>
<tab title="Location"><![CDATA[blabla]]></tab>
<tab title="Users"><![CDATA[blublu]]></tab>
</infowindowtab>
</location>
</locations>
</dashboard>

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IE11 onpageshow strangeness (#14894)</title>
<script src="../../jquery.js"></script>
<script>
$(function(){
window.parent.iframeCallback( $( "body" ).data().result );
});
</script>
</head>
<body x-what="test" data-result="ok" onload="x=1" onpageshow="x=1">
Test for #14894
</body>
</html>

View file

@ -0,0 +1,17 @@
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body {
width: 1000px;
height: 1000px;
}
</style>
</head>
<body>
<div>
<script src="../../jquery.js"></script>
</div>
</body>
</html>

View file

@ -0,0 +1 @@
<?php echo file_get_contents('php://input'); ?>

View file

@ -0,0 +1 @@
<?php echo $_SERVER['QUERY_STRING']; ?>

View file

@ -0,0 +1,6 @@
<?php
header("HTTP/1.0 400 Bad Request");
header("Content-Type: application/json");
echo '{ "code": 40, "message": "Bad Request" }';

View file

@ -0,0 +1,5 @@
<?php
header("HTTP/1.0 400 Bad Request");
echo "plain text message";

View file

@ -0,0 +1,24 @@
<?php
error_reporting(0);
$ts = $_REQUEST['ts'];
$etag = md5($ts);
$ifNoneMatch = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : "";
preg_match('/"([^"]+)"/', $ifNoneMatch, $matches);
$ifNoneMatch = isset($matches[1]) ? $matches[1] : false;
if ($ifNoneMatch == $etag) {
header('HTTP/1.0 304 Not Modified');
die; // stop processing
}
header("Etag: W/\"" . $etag . "\"");
if ( $ifNoneMatch ) {
echo "OK: " . $etag;
} else {
echo "FAIL";
}
?>

View file

@ -0,0 +1,16 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>.focus() (activeElement access #13393)</title>
<script src="../../jquery.js"></script>
</head>
<body>
<a href="#" id="frame-link"></a>
<script>
jQuery( "#frame-link" ).trigger( "focus" );
window.parent.iframeCallback( true );
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>focusin event cross-frame (#14180)</title>
<script src="../../jquery.js"></script>
</head>
<body>
<input type="text" id="frame-input" />
<script>
// Call parent when this frame is fully loaded, it will mess with #frame-input
jQuery( window ).one( "load", function() {
window.parent.iframeCallback( document );
});
</script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test case for gh-2100</title>
<script src="../../jquery.js"></script>
</head>
<body>
<script type="text/javascript">
jQuery( document ).ready(function () {
window.parent.iframeCallback( jQuery("#container").length === 1 );
});
</script>
<!-- external resources that come before elements trick
oldIE into thinking the dom is ready, but it's not...
leaving this check here for future trailblazers to attempt
fixing this...-->
<script type="text/javascript" src="../longLoadScript.php?sleep=1"></script>
<div id="container" style="height: 300px"></div>
</body>
</html>

View file

@ -0,0 +1,4 @@
<?php
sleep((int)$_GET['sleep']);
header('Content-type: text/javascript');
?>

View file

@ -0,0 +1,20 @@
<!doctype html>
<html>
<script src="../../jquery.js"></script>
<script>
function report( event ) {
var payload = {
event: event.type
};
return parent.postMessage( JSON.stringify(payload), "*" );
}
jQuery( window ).on( "beforeunload", function( event ) {
report( event );
}).on( "load", function( event ) {
setTimeout(function() {
window.location.reload();
}, 50);
});
</script>
</html>

View file

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test case for jQuery ticket #11470</title>
<script src="../../jquery.js"></script>
<script type="text/javascript">
jQuery.when( jQuery.ready ).done(function() {
jQuery("body").append("<div>modifying DOM</div>");
window.parent.iframeCallback( $("div").text() === "modifying DOM" );
});
</script>
</head>
<body>
<!-- empty body -->
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test case for jQuery ticket #10067</title>
<script src="../../jquery.js"></script>
</head>
<body>
<script type="text/javascript">
jQuery( document ).ready(function () {
window.parent.iframeCallback( jQuery('#container').length === 1 );
});
</script>
<!-- external resources that come before elements trick
oldIE into thinking the dom is ready, but it's not...
leaving this check here for future trailblazers to attempt
fixing this...-->
<script type="text/javascript" src="longLoadScript.php?sleep=1"></script>
<div id="container" style="height: 300px"></div>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!doctype html>
<html>
<script src="../../jquery.js"></script>
<script>
var called = false,
error = false;
window.onerror = function() { error = true; };
jQuery( window ).on( "beforeunload", function( event ) {
called = true;
return "maybe";
}).on( "load", function( event ) {
$( window ).triggerHandler( "beforeunload" );
window.parent.iframeCallback( called && !error );
});
</script>
</html>

View file

@ -0,0 +1,23 @@
<?php
header( "Sample-Header: Hello World" );
header( "Empty-Header: " );
header( "Sample-Header2: Hello World 2" );
$headers = array();
foreach( $_SERVER as $key => $value ) {
$key = str_replace( "_" , "-" , substr( $key , 0 , 5 ) == "HTTP_" ? substr( $key , 5 ) : $key );
$headers[ $key ] = $value;
}
foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
// Only echo if key exists in the header
if ( isset( $headers[ strtoupper( $key ) ] ) ) {
echo "$key: " . @$headers[ strtoupper( $key ) ] . "\n";
}
}

View file

@ -0,0 +1,20 @@
<?php
error_reporting(0);
$ts = $_REQUEST['ts'];
$ifModifiedSince = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false;
if ($ifModifiedSince == $ts) {
header('HTTP/1.0 304 Not Modified');
die; // stop processing
}
header("Last-Modified: " . $ts);
if ( $ifModifiedSince ) {
echo "OK: " . $ts;
} else {
echo "FAIL";
}
?>

View file

@ -0,0 +1,8 @@
<html>
<head>
<title>iframe</title>
</head>
<body>
<div><span>span text</span></div>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
<?php
error_reporting(0);
if ( $_REQUEST['header'] ) {
header("Content-type: application/json");
}
$json = $_REQUEST['json'];
if($json) {
echo '[ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ]';
} else {
echo '{ "data": {"lang": "en", "length": 25} }';
}
?>

View file

@ -0,0 +1 @@
{ "data": {"lang": "en", "length": 25} }

View file

@ -0,0 +1,14 @@
<?php
error_reporting(0);
$callback = $_REQUEST['callback'];
if ( ! $callback ) {
$callback = explode("?",end(explode("/",$_SERVER['REQUEST_URI'])));
$callback = $callback[0];
}
$json = $_REQUEST['json'];
if($json) {
echo $callback . '([ {"name": "John", "age": 21}, {"name": "Peter", "age": 25 } ])';
} else {
echo $callback . '({ "data": {"lang": "en", "length": 25} })';
}
?>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>body</title>
</head>
<body>
<div id="qunit-fixture"></div>
<script src="../../jquery.js"></script>
<script>
var script = document.getElementsByTagName( "script" )[ 0 ],
div = document.createElement( "div" ),
src = "http://" + window.parent.externalHost,
success = true,
error = "";
script.parentNode.appendChild( div );
div.innerHTML = "<iframe name=\"test\" src=\"" + src + "\">";
jQuery(function() {
try {
jQuery( "<div>hello<div>world</div>!</div>" ).appendTo( "#qunit-fixture" );
} catch( e ) {
success = false;
error = e;
}
window.parent.iframeCallback({
status: success,
description: "buildFragment sets the context without throwing an exception" +
( error ? ": " + error : "" )
});
});
</script>
</body>
</html>

View file

@ -0,0 +1 @@
ERROR <script type="text/javascript">ok( true, "name.html retrieved" );</script>

View file

@ -0,0 +1,24 @@
<?php
error_reporting(0);
$wait = $_REQUEST['wait'];
if($wait) {
sleep($wait);
}
$xml = $_REQUEST['xml'];
if($xml) {
header("Content-type: text/xml");
$result = ($xml == "5-2") ? "3" : "?";
echo "<math><calculation>$xml</calculation><result>$result</result></math>";
die();
}
$name = $_REQUEST['name'];
if($name == 'foo') {
echo "bar";
die();
} else if($name == 'peter') {
echo "pan";
die();
}
echo 'ERROR <script type="text/javascript">ok( true, "name.php executed" );</script>';
?>

View file

@ -0,0 +1,5 @@
<?php
header('HTTP/1.0 204 No Content');
?>

View file

@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>absolute</title>
<style type="text/css" media="screen">
body { margin: 1px; padding: 5px; }
div.absolute { position: absolute; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; }
#absolute-1 { top: 0; left: 0; }
#absolute-1-1 { top: 1px; left: 1px; }
#absolute-1-1-1 { top: 1px; left: 1px; }
#absolute-2 { top: 19px; left: 19px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
p.instructions { position: absolute; bottom: 0; }
#positionTest { position: absolute; }
</style>
<script src="../../jquery.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$(".absolute").click(function() {
$("#marker").css( $(this).offset() );
var pos = $(this).position();
$(this).css({ top: pos.top, left: pos.left });
return false;
});
});
</script>
</head>
<body>
<div id="absolute-1" class="absolute">absolute-1
<div id="absolute-1-1" class="absolute">absolute-1-1
<div id="absolute-1-1-1" class="absolute">absolute-1-1-1</div>
</div>
</div>
<div id="absolute-2" class="absolute">absolute-2</div>
<div id="positionTest">Has absolute position but no values set for the location ('auto').</div>
<div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p>
</body>
</html>

View file

@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>body</title>
<style type="text/css" media="screen">
body { margin: 1px; padding: 5px; position: relative }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
#firstElement { width: 50px; height: 50px; background: green; }
</style>
<script src="../../jquery.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$("body").click(function() {
$("marker").css( $(this).offset() );
return false;
});
});
</script>
</head>
<body>
<div id="firstElement"></div>
<div id="marker"></div>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>fixed</title>
<style type="text/css" media="screen">
body { margin: 1px; padding: 5px; }
div.fixed { position: fixed; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
#fixed-1 { top: 0; left: 0; }
#fixed-2 { top: 20px; left: 20px; }
#forceScroll { width: 5000px; height: 5000px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../jquery.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
window.scrollTo(1000,1000);
$(".fixed").click(function() {
$("#marker").css( $(this).offset() );
return false;
});
});
</script>
</head>
<body>
<div id="fixed-1" class="fixed"></div>
<div id="fixed-2" class="fixed"></div>
<div id="fixed-no-top-left" class="fixed"></div>
<div id="forceScroll"></div>
<div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it.</p>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>relative</title>
<style type="text/css" media="screen">
body { margin: 1px; padding: 5px; }
div.relative { position: relative; top: 0; left: 0; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
#relative-2 { top: 20px; left: 20px; }
#relative-2-1 { margin: auto; width: 50px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../jquery.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$(".relative").click(function() {
$("#marker").css( $(this).offset() );
var pos = $(this).position();
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
return false;
});
});
</script>
</head>
<body>
<div id="relative-1" class="relative"><div id="relative-1-1" class="relative"><div id="relative-1-1-1" class="relative"></div></div></div>
<div id="relative-2" class="relative"><div id="relative-2-1" class="relative"></div></div>
<div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p>
</body>
</html>

View file

@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>scroll</title>
<style type="text/css" media="screen">
body { margin: 1px; padding: 5px; }
div.scroll { position: relative; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: auto; }
#scroll-1 { top: 0; left: 0; }
#scroll-1-1 { top: 1px; left: 1px; }
#scroll-1-1-1 { top: 1px; left: 1px; }
#forceScroll { width: 5000px; height: 5000px; }
#hidden { display: none; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../jquery.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
window.scrollTo(1000,1000);
$("#scroll-1")[0].scrollLeft = 5;
$("#scroll-1")[0].scrollTop = 5;
$(".scroll").click(function() {
$("#marker").css( $(this).offset() );
return false;
});
});
</script>
</head>
<body>
<div id="scroll-1" class="scroll">
<div id="scroll-1-1" class="scroll">
<div id="scroll-1-1-1" class="scroll"></div>
</div>
</div>
<div id="hidden"></div>
<div id="forceScroll"></div>
<div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it.</p>
</body>
</html>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>static</title>
<style type="text/css" media="screen">
body { margin: 1px; padding: 5px; }
div.static { position: static; top: 0; left: 0; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
#static-2 { top: 20px; left: 20px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../jquery.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$(".static").click(function() {
$("#marker").css( $(this).offset() );
var pos = $(this).position();
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
return false;
});
});
</script>
</head>
<body>
<div id="static-1" class="static"><div id="static-1-1" class="static"><div id="static-1-1-1" class="static"></div></div></div>
<div id="static-2" class="static"></div>
<div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p>
</body>
</html>

View file

@ -0,0 +1,43 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>table</title>
<style type="text/css" media="screen">
body { margin: 1px; padding: 5px; }
table { border: 2px solid #000; }
th, td { border: 1px solid #000; width: 100px; height: 100px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../jquery.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$("table, th, td").click(function() {
$("#marker").css( $(this).offset() );
return false;
});
});
</script>
</head>
<body>
<table id="table-1">
<thead>
<tr valign="top">
<th id="th-1">th-1</th>
<th id="th-2">th-2</th>
<th id="th-3">th-3</th>
</tr>
</thead>
<tbody>
<tr valign="top">
<td id="td-1">td-1</td>
<td id="td-2">td-2</td>
<td id="td-3">td-3</td>
</tr>
</tbody>
</table>
<div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it.</p>
</body>
</html>

View file

@ -0,0 +1,12 @@
<div id="post">
<?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>

View file

@ -0,0 +1 @@
var delayedMessage = "It worked!";

View file

@ -0,0 +1,25 @@
// Simple script loader that uses jQuery.readyWait via jQuery.holdReady()
//Hold on jQuery!
jQuery.holdReady( true );
var readyRegExp = /^(complete|loaded)$/;
function assetLoaded( evt ) {
var node = evt.currentTarget || evt.srcElement;
if ( evt.type === "load" || readyRegExp.test( node.readyState ) ) {
jQuery.holdReady( false );
}
}
setTimeout( function() {
var script = document.createElement( "script" );
script.type = "text/javascript";
if ( script.addEventListener ) {
script.addEventListener( "load", assetLoaded, false );
} else {
script.attachEvent( "onreadystatechange", assetLoaded );
}
script.src = "data/readywaitasset.js";
document.getElementsByTagName( "head" )[ 0 ].appendChild( script );
}, 2000 );

View file

@ -0,0 +1,11 @@
<?php
error_reporting(0);
if ( $_REQUEST['header'] ) {
if ( $_REQUEST['header'] == "ecma" ) {
header("Content-type: application/ecmascript");
} else {
header("Content-type: text/javascript");
}
}
?>
ok( true, "Script executed correctly." );

View file

@ -0,0 +1,114 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>jQuery selector - attributes</title>
<script src="../../jquery.js"></script>
<script id="script1"
defer
async></script>
<script type="text/javascript">
document.createElement('video');
document.createElement('audio');
document.createElement('article');
document.createElement('details');
</script>
</head>
<body>
<img id="img1"
ismap>
<hr id="hr1"
noshade>
<form id="form1"
name="formName"
novalidate
formnovalidate>
<input type="text" id="text1"
tabindex="1"
name="name"
required
autofocus
readonly>
<textarea id="textarea1"
noresize></textarea>
</form>
<table>
<tr><td id="td1"
nowrap></td></tr>
</table>
<iframe id="iframe1"
src="iframe.html"
seamless></iframe>
<style id="style1"
scoped></style>
<ol id="ol1"
reversed></ol>
<article id="article1"
pubdate></article>
<details id="details1"
open></details>
<div id="div1"
nowrap
hidden
itemscope
draggable="true"
contenteditable="true"
aria-disabled="true">
<p>My name is <span id="span1"
spellcheck="true"
itemprop="name">Elizabeth</span>.</p>
</div>
<audio id="audio1"
muted></audio>
<video id="video1"
loop
controls
autoplay
autobuffer></video>
<map id="map1">
<area id="area1"
nohref
shape="default">
</map>
<input id="check1"
type="checkbox"
disabled
checked>
<select id="select1"
multiple>
<option id="option1"
selected
value="blar">blar</option>
</select>
<dl id="dl"
compact>
<dt>Term</dt><dd>This is the first definition in compact format.</dd>
<dt>Term</dt><dd>This is the second definition in compact format.</dd>
</dl>
<object id="object1"
declare></object>
<marquee id="marquee1"
direction="up"
truespeed>Scrolling text (non-standard)</marquee>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>jQuery selector - sizzle cache</title>
<script src="../../jquery.js"></script>
<script>
document.write(
"<script>var $cached = jQuery.noConflict(true);<\x2Fscript>" +
"<script src='" + document.getElementById("jquery-js").src + "?overwrite'><\x2Fscript>"
);
</script>
</head>
<body>
<div class="test">
<a href="#" id="collision">Worlds collide</a>
</div>
</body>
</html>

View file

@ -0,0 +1,5 @@
<?php
header( "HTTP/1.0 $_GET[status] $_GET[text]" );
?>

View file

@ -0,0 +1,28 @@
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body {
background: #000000;
}
div {
padding: 15px;
border: 1px solid #999;
display: inline;
margin:8px;
}
</style>
</head>
<body>
<div>
<script src="../../jquery.js"></script>
<script src="getComputedSupport.js"></script>
</div>
<script>
window.parent.iframeCallback( jQuery( "body" ).css( "backgroundColor" ),
getComputedSupport( jQuery.support ) );
</script>
</body>
</html>

View file

@ -0,0 +1,3 @@
<?php
file_put_contents("csp.log", "", LOCK_EX);
?>

View file

@ -0,0 +1,3 @@
<?php
file_put_contents("csp.log", "error", LOCK_EX);
?>

View file

@ -0,0 +1,3 @@
jQuery( function() {
parent.iframeCallback( getComputedSupport( jQuery.support ) );
} );

View file

@ -0,0 +1,18 @@
<?php
# This test page checks CSP only for browsers with "Content-Security-Policy" header support
# i.e. no old WebKit or old Firefox
header("Content-Security-Policy: default-src 'self'; report-uri csp-log.php");
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSP Test Page</title>
<script src="../../jquery.js"></script>
<script src="csp.js"></script>
<script src="getComputedSupport.js"></script>
</head>
<body>
<p>CSP Test Page</p>
</body>
</html>

View file

@ -0,0 +1,14 @@
function getComputedSupport( support ) {
var prop,
result = {};
for ( prop in support ) {
if ( typeof support[ prop ] === "function" ) {
result[ prop ] = support[ prop ]();
} else {
result[ prop ] = support[ prop ];
}
}
return result;
}

View file

@ -0,0 +1,7 @@
html text<br/>
<script type="text/javascript">/* <![CDATA[ */
testFoo = "foo"; jQuery('#foo').html('foo');
ok( true, "test.html executed" );
/* ]]> */</script>
<script src="data/testbar.php"></script>
blabla

View file

@ -0,0 +1,7 @@
html text<br/>
<script type="text/javascript">/* <![CDATA[ */
testFoo = "foo"; jQuery('#foo').html('foo');
ok( true, "test.php executed" );
/* ]]> */</script>
<script src="data/testbar.php?<?php srand(); echo time() . '' . rand(); ?>"></script>
blabla

View file

@ -0,0 +1,5 @@
<script type="text/javascript">
var testFoo = "foo";
jQuery('#foo').html('foo');
ok( true, "test2.html executed" );
</script>

View file

@ -0,0 +1,4 @@
<div class="user">This is a user</div>
<div class="user">This is a user</div>
<div class="teacher">This is a teacher</div>
<div id="superuser">This is a superuser</div>

View file

@ -0,0 +1,3 @@
this.testBar = "bar";
jQuery("#ap").html("bar");
ok( true, "testbar.php executed");

View file

@ -0,0 +1,347 @@
/*jshint multistr:true, quotmark:false */
var fireNative, originaljQuery, original$,
baseURL = "",
supportjQuery = this.jQuery,
// see RFC 2606
externalHost = "example.com";
this.hasPHP = true;
this.isLocal = window.location.protocol === "file:";
// Setup global variables before loading jQuery for testing .noConflict()
supportjQuery.noConflict( true );
originaljQuery = this.jQuery = undefined;
original$ = this.$ = "replaced";
/**
* Returns an array of elements with the given IDs
* @example q( "main", "foo", "bar" )
* @result [<div id="main">, <span id="foo">, <input id="bar">]
*/
this.q = function() {
var r = [],
i = 0;
for ( ; i < arguments.length; i++ ) {
r.push( document.getElementById( arguments[ i ] ) );
}
return r;
};
/**
* Asserts that a select matches the given IDs
* @param {String} a - Assertion name
* @param {String} b - Sizzle selector
* @param {String} c - Array of ids to construct what is expected
* @example t("Check for something", "//[a]", ["foo", "bar"]);
* @result returns true if "//[a]" return two elements with the IDs 'foo' and 'bar'
*/
QUnit.assert.t = function( a, b, c ) {
var f = jQuery( b ).get(),
s = "",
i = 0;
for ( ; i < f.length; i++ ) {
s += ( s && "," ) + '"' + f[ i ].id + '"';
}
this.deepEqual( f, q.apply( q, c ), a + " (" + b + ")" );
};
this.createDashboardXML = function() {
var string = '<?xml version="1.0" encoding="UTF-8"?> \
<dashboard> \
<locations class="foo"> \
<location for="bar" checked="different"> \
<infowindowtab normal="ab" mixedCase="yes"> \
<tab title="Location"><![CDATA[blabla]]></tab> \
<tab title="Users"><![CDATA[blublu]]></tab> \
</infowindowtab> \
</location> \
</locations> \
</dashboard>';
return jQuery.parseXML( string );
};
this.createWithFriesXML = function() {
var string = '<?xml version="1.0" encoding="UTF-8"?> \
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" \
xmlns:xsd="http://www.w3.org/2001/XMLSchema" \
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> \
<soap:Body> \
<jsconf xmlns="http://{{ externalHost }}/ns1"> \
<response xmlns:ab="http://{{ externalHost }}/ns2"> \
<meta> \
<component id="seite1" class="component"> \
<properties xmlns:cd="http://{{ externalHost }}/ns3"> \
<property name="prop1"> \
<thing /> \
<value>1</value> \
</property> \
<property name="prop2"> \
<thing att="something" /> \
</property> \
<foo_bar>foo</foo_bar> \
</properties> \
</component> \
</meta> \
</response> \
</jsconf> \
</soap:Body> \
</soap:Envelope>';
return jQuery.parseXML( string.replace( /\{\{\s*externalHost\s*\}\}/g, externalHost ) );
};
this.createXMLFragment = function() {
var xml, frag;
if ( window.ActiveXObject ) {
xml = new ActiveXObject( "msxml2.domdocument" );
} else {
xml = document.implementation.createDocument( "", "", null );
}
if ( xml ) {
frag = xml.createElement( "data" );
}
return frag;
};
fireNative = document.createEvent ?
function( node, type ) {
var event = document.createEvent( "HTMLEvents" );
event.initEvent( type, true, true );
node.dispatchEvent( event );
} :
function( node, type ) {
node.fireEvent( "on" + type, document.createEventObject() );
};
/**
* Add random number to url to stop caching
*
* @example url("data/test.html")
* @result "data/test.html?10538358428943"
*
* @example url("data/test.php?foo=bar")
* @result "data/test.php?foo=bar&10538358345554"
*/
function url( value ) {
return baseURL + value + ( /\?/.test( value ) ? "&" : "?" ) +
new Date().getTime() + "" + parseInt( Math.random() * 100000, 10 );
}
// Ajax testing helper
this.ajaxTest = function( title, expect, options ) {
QUnit.test( title, expect, function( assert ) {
var requestOptions;
if ( jQuery.isFunction( options ) ) {
options = options( assert );
}
options = options || [];
requestOptions = options.requests || options.request || options;
if ( !jQuery.isArray( requestOptions ) ) {
requestOptions = [ requestOptions ];
}
var done = assert.async();
if ( options.setup ) {
options.setup();
}
var completed = false,
remaining = requestOptions.length,
complete = function() {
if ( !completed && --remaining === 0 ) {
completed = true;
delete ajaxTest.abort;
if ( options.teardown ) {
options.teardown();
}
// Make sure all events will be called before done()
setTimeout( done );
}
},
requests = jQuery.map( requestOptions, function( options ) {
var request = ( options.create || jQuery.ajax )( options ),
callIfDefined = function( deferType, optionType ) {
var handler = options[ deferType ] || !!options[ optionType ];
return function( _, status ) {
if ( !completed ) {
if ( !handler ) {
assert.ok( false, "unexpected " + status );
} else if ( jQuery.isFunction( handler ) ) {
handler.apply( this, arguments );
}
}
};
};
if ( options.afterSend ) {
options.afterSend( request, assert );
}
return request
.done( callIfDefined( "done", "success" ) )
.fail( callIfDefined( "fail", "error" ) )
.always( complete );
} );
ajaxTest.abort = function( reason ) {
if ( !completed ) {
completed = true;
delete ajaxTest.abort;
assert.ok( false, "aborted " + reason );
jQuery.each( requests, function( i, request ) {
request.abort();
} );
}
};
} );
};
this.testIframe = function( fileName, name, fn ) {
QUnit.test( name, function( assert ) {
var done = assert.async();
// load fixture in iframe
var iframe = loadFixture(),
win = iframe.contentWindow,
interval = setInterval( function() {
if ( win && win.jQuery && win.jQuery.isReady ) {
clearInterval( interval );
// call actual tests passing the correct jQuery instance to use
fn.call( this, win.jQuery, win, win.document, assert );
done();
document.body.removeChild( iframe );
iframe = null;
}
}, 15 );
} );
function loadFixture() {
var src = url( "./data/" + fileName + ".html" ),
iframe = jQuery( "<iframe />" ).appendTo( "body" )[ 0 ];
iframe.style.cssText = "width: 500px; height: 500px; position: absolute; " +
"top: -600px; left: -600px; visibility: hidden;";
iframe.contentWindow.location = src;
return iframe;
}
};
this.testIframeWithCallback = function( title, fileName, func ) {
QUnit.test( title, 1, function( assert ) {
var iframe;
var done = assert.async();
window.iframeCallback = function() {
var args = Array.prototype.slice.call( arguments );
args.push( assert );
setTimeout( function() {
this.iframeCallback = undefined;
func.apply( this, args );
func = function() {};
iframe.remove();
done();
} );
};
iframe = jQuery( "<div/>" ).css( { position: "absolute", width: "500px", left: "-600px" } )
.append( jQuery( "<iframe/>" ).attr( "src", url( "./data/" + fileName ) ) )
.appendTo( "#qunit-fixture" );
} );
};
this.iframeCallback = undefined;
// Tests are always loaded async
QUnit.config.autostart = false;
this.loadTests = function() {
// Leverage QUnit URL parsing to detect testSwarm environment and "basic" testing mode
var loadSwarm = ( QUnit.urlParams[ "swarmURL" ] + "" ).indexOf( "http" ) === 0,
basicTests = ( QUnit.urlParams[ "module" ] + "" ) === "basic";
// Get testSubproject from testrunner first
require( [ "data/testrunner.js" ], function() {
var i = 0,
tests = [
// A special module with basic tests, meant for
// not fully supported environments like Android 2.3,
// jsdom or PhantomJS. We run it everywhere, though,
// to make sure tests are not broken.
"unit/basic.js",
"unit/core.js",
"unit/callbacks.js",
"unit/deferred.js",
"unit/deprecated.js",
"unit/support.js",
"unit/data.js",
"unit/queue.js",
"unit/attributes.js",
"unit/event.js",
"unit/selector.js",
"unit/traversing.js",
"unit/manipulation.js",
"unit/wrap.js",
"unit/css.js",
"unit/serialize.js",
"unit/ajax.js",
"unit/effects.js",
"unit/offset.js",
"unit/dimensions.js"
];
// Ensure load order (to preserve test numbers)
( function loadDep() {
var dep = tests[ i++ ];
if ( dep ) {
if ( !basicTests || i === 1 ) {
require( [ dep ], loadDep );
// Support: Android 2.3 only
// When running basic tests, replace other modules with dummies to avoid overloading
// impaired clients.
} else {
QUnit.module( dep.replace( /^.*\/|\.js$/g, "" ) );
loadDep();
}
} else {
QUnit.load();
/**
* Run in noConflict mode
*/
if ( jQuery.noConflict ) {
jQuery.noConflict();
}
// Load the TestSwarm listener if swarmURL is in the address.
if ( loadSwarm ) {
require( [ "http://swarm.jquery.org/js/inject.js?" + ( new Date() ).getTime() ],
function() {
QUnit.start();
} );
} else {
QUnit.start();
}
}
} )();
} );
};

View file

@ -0,0 +1,203 @@
( function() {
// Store the old counts so that we only assert on tests that have actually leaked,
// instead of asserting every time a test has leaked sometime in the past
var oldCacheLength = 0,
oldActive = 0,
expectedDataKeys = {},
splice = [].splice,
ajaxSettings = jQuery.ajaxSettings;
/**
* QUnit configuration
*/
// Max time for stop() and asyncTest() until it aborts test
// and start()'s the next test.
QUnit.config.testTimeout = 12e4; // 2 minutes
// Enforce an "expect" argument or expect() call in all test bodies.
QUnit.config.requireExpects = true;
/**
* @param {jQuery|HTMLElement|Object|Array} elems Target (or array of targets) for jQuery.data.
* @param {string} key
*/
QUnit.assert.expectJqData = function( env, elems, key ) {
var i, elem, expando;
// As of jQuery 2.0, there will be no "cache"-data is
// stored and managed completely below the API surface
if ( jQuery.cache ) {
env.checkJqData = true;
if ( elems.jquery && elems.toArray ) {
elems = elems.toArray();
}
if ( !supportjQuery.isArray( elems ) ) {
elems = [ elems ];
}
for ( i = 0; i < elems.length; i++ ) {
elem = elems[ i ];
// jQuery.data only stores data for nodes in jQuery.cache,
// for other data targets the data is stored in the object itself,
// in that case we can't test that target for memory leaks.
// But we don't have to since in that case the data will/must will
// be available as long as the object is not garbage collected by
// the js engine, and when it is, the data will be removed with it.
if ( !elem.nodeType ) {
// Fixes false positives for dataTests(window), dataTests({}).
continue;
}
expando = elem[ jQuery.expando ];
if ( expando === undefined ) {
// In this case the element exists fine, but
// jQuery.data (or internal data) was never (in)directly
// called.
// Since this method was called it means some data was
// expected to be found, but since there is nothing, fail early
// (instead of in teardown).
this.notStrictEqual(
expando,
undefined,
"Target for expectJqData must have an expando, " +
"for else there can be no data to expect."
);
} else {
if ( expectedDataKeys[ expando ] ) {
expectedDataKeys[ expando ].push( key );
} else {
expectedDataKeys[ expando ] = [ key ];
}
}
}
}
};
QUnit.config.urlConfig.push( {
id: "jqdata",
label: "Always check jQuery.data",
tooltip: "Trigger QUnit.expectJqData detection for all tests " +
"instead of just the ones that call it"
} );
/**
* Ensures that tests have cleaned up properly after themselves. Should be passed as the
* teardown function on all modules' lifecycle object.
*/
window.moduleTeardown = function( assert ) {
var i, expectedKeys, actualKeys,
cacheLength = 0;
// Only look for jQuery data problems if this test actually
// provided some information to compare against.
if ( QUnit.urlParams.jqdata || this.checkJqData ) {
for ( i in jQuery.cache ) {
expectedKeys = expectedDataKeys[ i ];
actualKeys = jQuery.cache[ i ] ? Object.keys( jQuery.cache[ i ] ) : jQuery.cache[ i ];
if ( !QUnit.equiv( expectedKeys, actualKeys ) ) {
assert.deepEqual( actualKeys, expectedKeys, "Expected keys exist in jQuery.cache" );
}
delete jQuery.cache[ i ];
delete expectedDataKeys[ i ];
}
// In case it was removed from cache before (or never there in the first place)
for ( i in expectedDataKeys ) {
assert.deepEqual(
expectedDataKeys[ i ],
undefined,
"No unexpected keys were left in jQuery.cache (#" + i + ")"
);
delete expectedDataKeys[ i ];
}
}
// Reset data register
expectedDataKeys = {};
// Check for (and clean up, if possible) incomplete animations/requests/etc.
if ( jQuery.timers && jQuery.timers.length !== 0 ) {
assert.equal( jQuery.timers.length, 0, "No timers are still running" );
splice.call( jQuery.timers, 0, jQuery.timers.length );
jQuery.fx.stop();
}
if ( jQuery.active !== undefined && jQuery.active !== oldActive ) {
assert.equal( jQuery.active, oldActive, "No AJAX requests are still active" );
if ( ajaxTest.abort ) {
ajaxTest.abort( "active requests" );
}
oldActive = jQuery.active;
}
Globals.cleanup();
for ( i in jQuery.cache ) {
++cacheLength;
}
// Because QUnit doesn't have a mechanism for retrieving
// the number of expected assertions for a test,
// if we unconditionally assert any of these,
// the test will fail with too many assertions :|
if ( cacheLength !== oldCacheLength ) {
assert.equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" );
oldCacheLength = cacheLength;
}
};
QUnit.done( function() {
// Remove our own fixtures outside #qunit-fixture
supportjQuery( "#qunit ~ *" ).remove();
} );
QUnit.testDone( function() {
// Ensure jQuery events and data on the fixture are properly removed
jQuery( "#qunit-fixture" ).empty();
// ...even if the jQuery under test has a broken .empty()
supportjQuery( "#qunit-fixture" ).empty();
// Reset internal jQuery state
jQuery.event.global = {};
if ( ajaxSettings ) {
jQuery.ajaxSettings = jQuery.extend( true, {}, ajaxSettings );
} else {
delete jQuery.ajaxSettings;
}
// Cleanup globals
Globals.cleanup();
} );
// Register globals for cleanup and the cleanup code itself
window.Globals = ( function() {
var globals = {};
return {
register: function( name ) {
window[ name ] = globals[ name ] = true;
},
cleanup: function() {
var name;
for ( name in globals ) {
delete window[ name ];
}
globals = {};
}
};
} )();
} )();

View file

@ -0,0 +1,144 @@
ol#empty {
opacity: 0;
}
div#fx-tests h4 {
background: red;
}
div#fx-tests h4.pass {
background: green;
}
div#fx-tests div.box {
background: red;
overflow: hidden;
border: 2px solid #000;
}
div#fx-tests div.overflow {
overflow: visible;
}
div.inline {
display: inline;
}
div.autoheight {
height: auto;
}
div.autowidth {
width: auto;
}
div.autoopacity {
opacity: 1;
}
div.largewidth {
width: 100px;
}
div.largeheight {
height: 100px;
}
div.medwidth {
width: 50px;
}
div.medheight {
height: 50px;
}
div.medopacity {
opacity: 0.5;
}
div.nowidth {
width: 0px;
}
div.noheight {
height: 0px;
}
div.noopacity {
opacity: 0;
}
div.hidden {
display: none;
}
div#fx-tests div.widewidth {
background-repeat: repeat-x;
}
div#fx-tests div.wideheight {
background-repeat: repeat-y;
}
div#fx-tests div.widewidth.wideheight {
background-repeat: repeat;
}
div#fx-tests div.noback {
background-image: none;
}
.chain-test,
.chain-test div {
width: 100px;
height: 20px;
position: relative;
float: left;
}
.chain-test div {
position: absolute;
top: 0;
left: 0;
}
.chain-test {
background: red;
}
.chain-test div {
background: green;
}
.chain-test-out {
background: green;
}
.chain-test-out div {
background: red;
display: none;
}
/* tests to ensure jQuery can determine the native display mode of elements
that have been set as display: none in stylesheets */
div#show-tests * { display: none; }
#nothiddendiv { font-size: 16px; }
#nothiddendivchild.em { font-size: 2em; }
#nothiddendivchild.prct { font-size: 150%; }
/* 8099 changes to default styles are read correctly */
tt { display: none; }
sup { display: none; }
dfn { display: none; }
/* #9239 Attach a background to the body( avoid crashes in removing the test element in support ) */
body, div { background: url(http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif) no-repeat -1000px 0; }
/* #10501 */
section { background:#f0f; display:block; }
/* #11971 */
#foo { background: url(1x1.jpg) right bottom no-repeat; }
/* #14824 */
#span-14824 { display: block; }
#display { display: list-item !important; }

View file

@ -0,0 +1,12 @@
Lorem ipsum dolor sit amet
consectetuer adipiscing elit
Sed lorem leo
lorem leo consectetuer adipiscing elit
Sed lorem leo
rhoncus sit amet
elementum at
bibendum at, eros
Cras at mi et tortor egestas vestibulum
sed Cras at mi vestibulum
Phasellus sed felis sit amet
orci dapibus semper.

View file

@ -0,0 +1,25 @@
<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<jsconf xmlns="http://example.com/ns1">
<response xmlns:ab="http://example.com/ns2">
<meta>
<component id="seite1" class="component">
<properties xmlns:cd="http://example.com/ns3">
<property name="prop1">
<thing />
<value>1</value>
</property>
<property name="prop2">
<thing att="something" />
</property>
<foo_bar>foo</foo_bar>
</properties>
</component>
</meta>
</response>
</jsconf>
</soap:Body>
</soap:Envelope>

View file

@ -0,0 +1,7 @@
<?php
error_reporting(0);
$callback = $_REQUEST['callback'];
$json = $_REQUEST['json'];
$text = json_encode(file_get_contents(dirname(__FILE__)."/with_fries.xml"));
echo "$callback($text)";
?>

View file

@ -0,0 +1,228 @@
<!DOCTYPE html>
<html>
<head>
<title>Event Delegation Tests</title>
<script src="jquery.js"></script>
<style>
table {
border-collapse: collapse;
empty-cells: show;
}
th {
text-align: left;
}
thead td {
width: 11%;
}
tbody td {
background: #fed;
}
th, td {
border: 1px solid #bbb;
}
</style>
</head>
<body>
<h2>Delegate Tests (<span id="fileversion">x</span>)</h2>
<table id="changes">
<thead>
<tr>
<th>
Controls:
</th>
<td id="select-one">
<select>
<option value='one1'>one1</option>
<option value='one2'>one2</option>
<option value='one3'>one3</option>
</select>
<select>
<option value='two1'>two1</option>
<option value='two2' selected="selected">two2</option>
<option value='two3'>two3</option>
</select>
</td>
<td id="select-mult">
<select multiple="multiple">
<option value='multi1'>multi1</option>
<option value='multi2'>multi2</option>
<option value='multi3'>multi3</option>
</select>
</td>
<td id="checkbox">
<input type="checkbox" name="mycheckbox" id="check1"/>
<label for="check1">check1</label><br/>
<input type="checkbox" name="mycheckbox" id="check2"/>
<label for="check2">check2</label><br />
<input type="checkbox" name="mycheckbox" id="check3" disabled="disabled"/>
<label for="check3">check3</label>
</td>
<td id="radio">
<input type="radio" name="myradio" id="radio1"/>
<label for="radio1">Radio1</label><br/>
<input type="radio" name="myradio" id="radio2"/>
<label for="radio2">Radio2</label><br />
<input type="radio" name="myradio" id="radio3" disabled="disabled"/>
<label for="radio3">Radio3</label>
</td>
<td id="file">
<input class="file_test" id="file1" type="file"/>
</td>
<td id="text">
<input class='test' value='' id='input' size='10' />
<input class='test' value='test' id='input2' size='10' readonly="readonly" />
</td>
<td id="textarea">
<textarea rows='2'></textarea>
</td>
<td id="button">
<button name="mybutton1" id="button1">Button</button><br />
<button name="mybutton2" id="button2"><span>Button w/ child</span></button><br />
<button name="mybutton3" id="button3" disabled="disabled">Button Disabled</button><br />
<button name="mybutton4" id="button4" disabled="disabled"><span disabled="disabled">Button, child Disabled</span></button><br />
</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
<p>NOTE: Only IE supports propertychange, beforeactivate, beforedeactivate; buttons do not support change events.</p>
<h2>Submit Tests</h2>
<table>
<tr>
<td>
Submit each:
</td>
<td>
<form action="" id="text_submit">
<input class='test' type='text' value='Key Return To Submit'/>
</form>
</td>
<td>
<form action="" id="password_submit">
<input class='test' type='password' value=''/>
</form>
</td>
<td>
<form action="" id="submit_submit">
<input type='submit' value="Click Me To Submit" />
</form>
</td>
<td>$(document).bind('submit')</td>
</tr>
<tr>
<td>Results:</td>
<td id='textSubmit' class="red">TEXT</td>
<td id='passwordSubmit' class="red">PASSWORD</td>
<td id='submitSubmit' class="red">BUTTON</td>
<td id='boundSubmit' class="red">DOCUMENT</td>
</tr>
</table>
<form id="autosub"><input type=submit name=subme /></form>
<script type='text/javascript'>
$("#fileversion").text($.fn.jquery);
// Try an auto-submit, it should only fire once
$(function(){
var triggered = false;
$("#autosub input").trigger("keypress");
$("body").on("submit", "#autosub", function( e ){
e.preventDefault();
e.stopPropagation();
if ( triggered ) {
alert("autosubmit FAIL");
}
triggered = true;
});
$("#autosub").submit().remove();
});
// Events we want to track in row-order
var events = "bind-change live-change onX-change bind-propertychange live-beforeactivate live-focusin bind-focus live-beforedeactivate live-focusout bind-blur live-click live-keydown".split(" "),
counter = 0;
blinker = function(event){
if ( !counter ) {
$("#changes tbody td").text("");
}
var $el = event.data,
prev = $el.text();
prev = prev? prev +" | " : "";
return $el
.text(prev + ++counter+" " + (this.value.replace(/^on$/,"") || this.id || this.checked || ""))
.css("backgroundColor","#0f0")
.delay(800)
.queue(function(next){
$el.css("backgroundColor","#afa");
--counter;
next();
});
};
for ( var i=0; i < events.length; i++ ) {
var m = events[i].split("-"),
api = m[0],
type = m[1],
$row = $("<tr><th>"+type+" "+api+"</th></tr>");
$("#changes thead td").each(function(){
var id = "#"+this.id,
$cell = $("<td></td>");
if ( api == "onX" ) {
$(this).find("input, button, select, textarea").each(function(){
this["on"+type] = function(e){ e = $.event.fix(e||event); e.data = $cell; blinker.call(this, e); };
});
} else if ( api == "bind" ) {
$(this).find("input, button, select, textarea").bind(type, $cell, blinker);
} else {
$(id+" input,"+id+" button,"+id+" select,"+id+" textarea").live(type, $cell, blinker);
}
$row.append($cell);
});
$("#changes tbody").append($row);
}
// Ensure that cloned elements get the delegated event magic; this is
// implementation-specific knowledge but otherwise impossible to test.
// The beforeactivate event attaches a direct-bound change event.
// (Only care about the live change for this third select element.)
var sel1 = $("#select-one select:first-child");
if ( typeof(sel1[0].fireEvent) !== "undefined" ) {
sel1.trigger( "beforeactivate" ).clone().appendTo("#select-one");
//alert($("#select-one select").map(function(){ return this._change_attached || "undef"; }).get().join("|"));
}
jQuery.fn.blink = function(){
return this
.css("backgroundColor","green")
.text( (parseInt(this.text(), 10) || 0) + 1 )
.delay(700).queue(function(next){
jQuery(this).css("backgroundColor","#afa");
next();
});
};
jQuery.fn.addSubmitTest = function( id, prevent ) {
return this.live("submit", function(e){
if ( prevent ) {
e.preventDefault();
}
jQuery(id).blink();
});
};
$("#text_submit").addSubmitTest("#textSubmit", true);
$("#password_submit").addSubmitTest("#passwordSubmit", true);
$("#submit_submit").addSubmitTest("#submitSubmit", true);
$("#prog_submit").addSubmitTest("#submitSubmit", true);
$(document).bind("submit", function(){
jQuery("#boundSubmit").blink();
});
</script>
</body>
</html>

View file

@ -0,0 +1,158 @@
<html>
<head>
<title>Hover tests</title>
<script src="jquery.js"></script>
<style>
/* Remove body dimensions so we can test enter/leave to surrounding browser chrome */
body, html {
border: 0;
margin: 0;
padding: 0;
}
p {
margin: 2px 0;
}
.hover-box {
background: #f33;
padding: 3px;
margin: 10px 40px 20px 0;
}
.hover-status {
background: #f66;
padding: 1px;
}
.hover-inside {
background: #6f6;
padding: 1px;
margin: 8px auto;
width: 40%;
text-align: center;
}
</style>
</head>
<body>
<h2>Hover (mouse{over,out,enter,leave}) Tests</h2>
<p>Be sure to try moving the mouse out of the browser via the left side on each test.</p>
<div id="wrapper">
<div id="hoverbox" class="hover-box">
<div class="hover-status">
<button>Activate</button>
.hover() in/out: <span class="ins">0</span> / <span class="outs">0</span>
</div>
<div class="hover-inside">
Mouse over here should NOT trigger the counter.
</div>
</div>
<div id="liveenterbox" class="hover-box">
<div class="hover-status">
<button>Activate</button>
Live enter/leave: <span class="ins">0</span> / <span class="outs">0</span>
</div>
<div class="hover-inside">
Mouse over here should NOT trigger the counter.
</div>
</div>
<div id="delegateenterbox" class="hover-box">
<div class="hover-status">
<button>Activate</button>
Delegated enter/leave: <span class="ins">0</span> / <span class="outs">0</span>
</div>
<div class="hover-inside">
Mouse over here should NOT trigger the counter.
</div>
</div>
<div id="overbox" class="hover-box">
<div class="hover-status">
<button>Activate</button>
Bind over/out: <span class="ins">0</span> / <span class="outs">0</span>
</div>
<div class="hover-inside">
Mouse over here SHOULD trigger the counter.
</div>
</div>
<div id="liveoverbox" class="hover-box">
<div class="hover-status">
<button>Activate</button>
Live over/out: <span class="ins">0</span> / <span class="outs">0</span>
</div>
<div class="hover-inside">
Mouse over here SHOULD trigger the counter.
</div>
</div>
<div id="delegateoverbox" class="hover-box">
<div class="hover-status">
<button>Activate</button>
Delegated over/out: <span class="ins">0</span> / <span class="outs">0</span>
</div>
<div class="hover-inside">
Mouse over here SHOULD trigger the counter.
</div>
</div>
</div> <!-- wrapper -->
<script>
$(function(){
var x,
countIns = function() {
var d = $(this).data();
$("span.ins", this).text(++d.ins);
},
countOuts = function() {
var d = $(this).data();
$("span.outs", this).text(++d.outs);
};
// Tests can be activated separately or in combination to check for interference
$("#hoverbox button").click(function(){
$("#hoverbox")
.data({ ins: 0, outs: 0 })
.hover( countIns, countOuts );
$(this).remove();
});
$("#delegateenterbox button").click(function(){
$("html")
.find("#delegateenterbox").data({ ins: 0, outs: 0 }).end()
.delegate("#delegateenterbox", "mouseenter", countIns )
.delegate("#delegateenterbox", "mouseleave", countOuts );
$(this).remove();
});
$("#liveenterbox button").click(function(){
$("#liveenterbox")
.data({ ins: 0, outs: 0 })
.live("mouseenter", countIns )
.live("mouseleave", countOuts );
$(this).remove();
});
$("#overbox button").click(function(){
$("#overbox")
.data({ ins: 0, outs: 0 })
.bind("mouseover", countIns )
.bind("mouseout", countOuts );
$(this).remove();
});
$("#liveoverbox button").click(function(){
$("#liveoverbox")
.data({ ins: 0, outs: 0 })
.live("mouseover", countIns )
.live("mouseout", countOuts );
$(this).remove();
});
$("#delegateoverbox button").click(function(){
$(document)
.find("#delegateoverbox").data({ ins: 0, outs: 0 }).end()
.delegate("#delegateoverbox", "mouseover", countIns )
.delegate("#delegateoverbox", "mouseout", countOuts );
$(this).remove();
});
});
</script>
</body>
</html>

View file

@ -0,0 +1,295 @@
<!doctype html>
<html lang="en" id="html">
<head>
<meta charset="utf-8">
<title>jQuery Test Suite</title>
<link rel="stylesheet" href="../external/qunit/qunit.css" />
<link rel="stylesheet" href="data/testsuite.css" />
<!--
We have to use previous jQuery as helper to ensure testability with
ajax-free builds (and non-interference when changing ajax internals)
-->
<script src="data/jquery-1.9.1.js"></script>
<script src="../external/qunit/qunit.js"></script>
<script src="../external/qunit-assert-step/qunit-assert-step.js"></script>
<script src="../external/sinon/sinon-1.14.1.js"></script>
<script src="../external/requirejs/require.js"></script>
<!-- See testinit for the list of tests -->
<script src="data/testinit.js"></script>
<!-- A script that includes jQuery min, dev, or AMD -->
<!-- Adds "basic" URL option, even to iframes -->
<!-- iframes will not load AMD as loading needs to be synchronous for some tests -->
<!-- Also executes the function above to load tests -->
<script src="jquery.js"></script>
<script>
// Load tests if they have not been loaded
// This is in a different script tag to ensure that
// jQuery is on the page when the testrunner executes
if ( !QUnit.urlParams.amd ) {
loadTests();
}
</script>
</head>
<body id="body">
<div id="qunit"></div>
<!-- Test HTML -->
<!-- this iframe is outside the #qunit-fixture so it won't reload constantly wasting time, but it means the tests must be "safe" and clean up after themselves -->
<iframe id="loadediframe" name="loadediframe" style="display:none;" src="data/iframe.html"></iframe>
<dl id="dl" style="position:absolute;top:-32767px;left:-32767px;width:1px;">
<div id="donor-outer">
<form id="donor-form">
<input id="donor-input" type="radio" />
</form>
</div>
<div id="qunit-fixture">
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
<p id="ap">
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
<a id="groups" href="http://groups.google.com/" class="GROUPS">Google Groups (Link)</a>.
This link has <code><a href="http://smin" id="anchor1">class="blog"</a></code>:
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
</p>
<div id="foo">
<p id="sndp">Everything inside the red border is inside a div with <code>id="foo"</code>.</p>
<p lang="en" id="en">This is a normal link: <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
</div>
<div id="nothiddendiv" style="height:1px;background:white;" class="nothiddendiv">
<div id="nothiddendivchild"></div>
</div>
<span id="name+value"></span>
<p id="first">Try them out:</p>
<ul id="firstUL"></ul>
<ol id="empty"></ol>
<form id="form" action="formaction">
<label for="action" id="label-for">Action:</label>
<input type="text" name="action" value="Test" id="text1" maxlength="30"/>
<input type="text" name="text2" value="Test" id="text2" disabled="disabled"/>
<input type="radio" name="radio1" id="radio1" value="on"/>
<input type="radio" name="radio2" id="radio2" checked="checked"/>
<input type="checkbox" name="check" id="check1" checked="checked"/>
<input type="checkbox" id="check2" value="on"/>
<input type="hidden" name="hidden" id="hidden1"/>
<input type="text" style="display:none;" name="foo[bar]" id="hidden2"/>
<input type="text" id="name" name="name" value="name" />
<input type="search" id="search" name="search" value="search" />
<button id="button" name="button" type="button">Button</button>
<textarea id="area1" maxlength="30">foobar</textarea>
<select name="select1" id="select1">
<option id="option1a" class="emptyopt" value="">Nothing</option>
<option id="option1b" value="1">1</option>
<option id="option1c" value="2">2</option>
<option id="option1d" value="3">3</option>
</select>
<select name="select2" id="select2">
<option id="option2a" class="emptyopt" value="">Nothing</option>
<option id="option2b" value="1">1</option>
<option id="option2c" value="2">2</option>
<option id="option2d" selected="selected" value="3">3</option>
</select>
<select name="select3" id="select3" multiple="multiple">
<option id="option3a" class="emptyopt" value="">Nothing</option>
<option id="option3b" selected="selected" value="1">1</option>
<option id="option3c" selected="selected" value="2">2</option>
<option id="option3d" value="3">3</option>
<option id="option3e">no value</option>
</select>
<select name="select4" id="select4" multiple="multiple">
<optgroup disabled="disabled">
<option id="option4a" class="emptyopt" value="">Nothing</option>
<option id="option4b" disabled="disabled" selected="selected" value="1">1</option>
<option id="option4c" selected="selected" value="2">2</option>
</optgroup>
<option selected="selected" disabled="disabled" id="option4d" value="3">3</option>
<option id="option4e">no value</option>
</select>
<select name="select5" id="select5">
<option id="option5a" value="3">1</option>
<option id="option5b" value="2">2</option>
<option id="option5c" value="1" data-attr="">3</option>
</select>
<object id="object1" codebase="stupid">
<param name="p1" value="x1" />
<param name="p2" value="x2" />
</object>
<span id="台北Táiběi"></span>
<span id="台北" lang="中文"></span>
<span id="utf8class1" class="台北Táiběi 台北"></span>
<span id="utf8class2" class="台北"></span>
<span id="foo:bar" class="foo:bar"></span>
<span id="test.foo[5]bar" class="test.foo[5]bar"></span>
<foo_bar id="foobar">test element</foo_bar>
</form>
<b id="floatTest">Float test.</b>
<iframe id="iframe" name="iframe"></iframe>
<form id="lengthtest">
<input type="text" id="length" name="test"/>
<input type="text" id="idTest" name="id"/>
</form>
<table id="table"></table>
<form id="name-tests">
<!-- Inputs with a grouped name attribute. -->
<input name="types[]" id="types_all" type="checkbox" value="all" />
<input name="types[]" id="types_anime" type="checkbox" value="anime" />
<input name="types[]" id="types_movie" type="checkbox" value="movie" />
</form>
<form id="testForm" action="#" method="get">
<textarea name="T3" rows="2" cols="15">?
Z</textarea>
<input type="hidden" name="H1" value="x" />
<input type="hidden" name="H2" />
<input name="PWD" type="password" value="" />
<input name="T1" type="text" />
<input name="T2" type="text" value="YES" readonly="readonly" />
<input type="checkbox" name="C1" value="1" />
<input type="checkbox" name="C2" />
<input type="radio" name="R1" value="1" />
<input type="radio" name="R1" value="2" />
<input type="text" name="My Name" value="me" />
<input type="reset" name="reset" value="NO" />
<select name="S1">
<option value="abc">ABC</option>
<option value="abc">ABC</option>
<option value="abc">ABC</option>
</select>
<select name="S2" multiple="multiple" size="3">
<option value="abc">ABC</option>
<option value="abc">ABC</option>
<option value="abc">ABC</option>
</select>
<select name="S3">
<option selected="selected">YES</option>
</select>
<select name="S4">
<option value="" selected="selected">NO</option>
</select>
<input type="submit" name="sub1" value="NO" />
<input type="submit" name="sub2" value="NO" />
<input type="image" name="sub3" value="NO" />
<button name="sub4" type="submit" value="NO">NO</button>
<input name="D1" type="text" value="NO" disabled="disabled" />
<input type="checkbox" checked="checked" disabled="disabled" name="D2" value="NO" />
<input type="radio" name="D3" value="NO" checked="checked" disabled="disabled" />
<select name="D4" disabled="disabled">
<option selected="selected" value="NO">NO</option>
</select>
<input id="list-test" type="text" />
<datalist id="datalist">
<option value="option"></option>
</datalist>
</form>
<div id="moretests">
<form>
<div id="checkedtest" style="display:none;">
<input type="radio" name="checkedtestradios" checked="checked"/>
<input type="radio" name="checkedtestradios" value="on"/>
<input type="checkbox" name="checkedtestcheckboxes" checked="checked"/>
<input type="checkbox" name="checkedtestcheckboxes" />
</div>
</form>
<div id="nonnodes"><span id="nonnodesElement">hi</span> there <!-- mon ami --></div>
<div id="t2037">
<div><div class="hidden">hidden</div></div>
</div>
<div id="t6652">
<div></div>
</div>
<div id="no-clone-exception"><object><embed></embed></object></div>
</div>
<div id="tabindex-tests">
<ol id="listWithTabIndex" tabindex="5">
<li id="foodWithNegativeTabIndex" tabindex="-1">Rice</li>
<li id="foodNoTabIndex">Beans</li>
<li>Blinis</li>
<li>Tofu</li>
</ol>
<div id="divWithNoTabIndex">I'm hungry. I should...</div>
<span>...</span><a href="#" id="linkWithNoTabIndex">Eat lots of food</a><span>...</span> |
<span>...</span><a href="#" id="linkWithTabIndex" tabindex="2">Eat a little food</a><span>...</span> |
<span>...</span><a href="#" id="linkWithNegativeTabIndex" tabindex="-1">Eat no food</a><span>...</span>
<span>...</span><a id="linkWithNoHrefWithNoTabIndex">Eat a burger</a><span>...</span>
<span>...</span><a id="linkWithNoHrefWithTabIndex" tabindex="1">Eat some funyuns</a><span>...</span>
<span>...</span><a id="linkWithNoHrefWithNegativeTabIndex" tabindex="-1">Eat some funyuns</a><span>...</span>
<input id="inputWithoutTabIndex"/>
<button id="buttonWithoutTabIndex"></button>
<textarea id="textareaWithoutTabIndex"></textarea>
<menu type="popup">
<menuitem id="menuitemWithoutTabIndex" command="submitbutton" default/>
</menu>
</div>
<div id="liveHandlerOrder">
<span id="liveSpan1"><a href="#" id="liveLink1"></a></span>
<span id="liveSpan2"><a href="#" id="liveLink2"></a></span>
</div>
<div id="siblingTest">
<em id="siblingfirst">1</em>
<em id="siblingnext">2</em>
<em id="siblingthird">
<em id="siblingchild">
<em id="siblinggrandchild">
<em id="siblinggreatgrandchild"></em>
</em>
</em>
</em>
<span id="siblingspan"></span>
</div>
<div id="fx-test-group" style="position: absolute; width: 1px; height: 1px; overflow: hidden;">
<div id="fx-queue" name="test">
<div id="fadein" class='chain-test' name='div'>fadeIn<div>fadeIn</div></div>
<div id="fadeout" class='chain-test chain-test-out'>fadeOut<div>fadeOut</div></div>
<div id="show" class='chain-test'>show<div>show</div></div>
<div id="hide" class='chain-test chain-test-out'>hide<div>hide</div></div>
<div id="easehide" class='chain-test chain-test-out'>hide<div>hide</div></div>
<div id="togglein" class='chain-test'>togglein<div>togglein</div></div>
<div id="toggleout" class='chain-test chain-test-out'>toggleout<div>toggleout</div></div>
<div id="easetoggleout" class='chain-test chain-test-out'>toggleout<div>toggleout</div></div>
<div id="slideup" class='chain-test'>slideUp<div>slideUp</div></div>
<div id="slidedown" class='chain-test chain-test-out'>slideDown<div>slideDown</div></div>
<div id="easeslideup" class='chain-test'>slideUp<div>slideUp</div></div>
<div id="slidetogglein" class='chain-test'>slideToggleIn<div>slideToggleIn</div></div>
<div id="slidetoggleout" class='chain-test chain-test-out'>slideToggleOut<div>slideToggleOut</div></div>
<div id="fadetogglein" class='chain-test'>fadeToggleIn<div>fadeToggleIn</div></div>
<div id="fadetoggleout" class='chain-test chain-test-out'>fadeToggleOut<div>fadeToggleOut</div></div>
<div id="fadeto" class='chain-test'>fadeTo<div>fadeTo</div></div>
</div>
<div id="fx-tests"></div>
<span id="display"></span>
</div>
</div>
</dl>
<map name="imgmap" id="imgmap">
<area shape="rect" coords="0,0,200,50">
</map>
</body>
</html>

View file

@ -0,0 +1,18 @@
.result {
font-size: 24px;
margin: 0.5em 0;
width: 700px;
height: 56px;
}
.error {
background-color: red;
}
.warn {
background-color: yellow;
}
.success {
background-color: lightgreen;
}

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Test for gh-1764 - test iframe</title>
<link rel="stylesheet" href="gh-1764-fullscreen-iframe.css">
</head>
<body class="iframe-page">
<div class="container">
<div class="result"></div>
<button class="toggle-fullscreen">Toggle fullscreen mode - iframe</button>
</div>
<script src="../../../dist/jquery.js"></script>
<script src="gh-1764-fullscreen.js"></script>
<script>
bootstrapFrom( ".iframe-page", "iframe" );
</script>
</body>
</html>

View file

@ -0,0 +1,99 @@
/* exported bootstrapFrom */
// `mode` may be "iframe" or not specified.
function bootstrapFrom( mainSelector, mode ) {
if ( mode === "iframe" && window.parent === window ) {
jQuery( mainSelector + " .result" )
.attr( "class", "result warn" )
.text( "This test should be run in an iframe. Open ../gh-1764-fullscreen.html." );
jQuery( mainSelector + " .toggle-fullscreen" ).remove();
return;
}
var fullscreenSupported = document.exitFullscreen ||
document.exitFullscreen ||
document.msExitFullscreen ||
document.mozCancelFullScreen ||
document.webkitExitFullscreen;
function isFullscreen() {
return !!( document.fullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement ||
document.msFullscreenElement );
}
function requestFullscreen( element ) {
if ( !isFullscreen() ) {
if ( element.requestFullscreen ) {
element.requestFullscreen();
} else if ( element.msRequestFullscreen ) {
element.msRequestFullscreen();
} else if ( element.mozRequestFullScreen ) {
element.mozRequestFullScreen();
} else if ( element.webkitRequestFullscreen ) {
element.webkitRequestFullscreen();
}
}
}
function exitFullscreen() {
if ( document.exitFullscreen ) {
document.exitFullscreen();
} else if ( document.msExitFullscreen ) {
document.msExitFullscreen();
} else if ( document.mozCancelFullScreen ) {
document.mozCancelFullScreen();
} else if ( document.webkitExitFullscreen ) {
document.webkitExitFullscreen();
}
}
function runTest() {
var dimensions;
if ( !fullscreenSupported ) {
jQuery( mainSelector + " .result" )
.attr( "class", "result success" )
.text( "Fullscreen mode is not supported in this browser. Test not run." );
} else if ( !isFullscreen() ) {
jQuery( mainSelector + " .result" )
.attr( "class", "result warn" )
.text( "Enable fullscreen mode to fire the test." );
} else {
dimensions = jQuery( mainSelector + " .result" ).css( [ "width", "height" ] );
dimensions.width = parseFloat( dimensions.width ).toFixed( 3 );
dimensions.height = parseFloat( dimensions.height ).toFixed( 3 );
if ( dimensions.width === "700.000" && dimensions.height === "56.000" ) {
jQuery( mainSelector + " .result" )
.attr( "class", "result success" )
.text( "Dimensions in fullscreen mode are computed correctly." );
} else {
jQuery( mainSelector + " .result" )
.attr( "class", "result error" )
.html( "Incorrect dimensions; " +
"expected: { width: '700.000', height: '56.000' };<br>" +
"got: { width: '" + dimensions.width + "', height: '" +
dimensions.height + "' }." );
}
}
}
function toggleFullscreen() {
if ( isFullscreen() ) {
exitFullscreen();
} else {
requestFullscreen( jQuery( mainSelector + " .container" )[ 0 ] );
}
}
$( mainSelector + " .toggle-fullscreen" ).on( "click", toggleFullscreen );
$( document ).on( [
"webkitfullscreenchange",
"mozfullscreenchange",
"fullscreenchange",
"MSFullscreenChange"
].join( " " ), runTest );
runTest();
}

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Test for gh-1764</title>
<link rel="stylesheet" href="./data/gh-1764-fullscreen-iframe.css">
<style>
#test-iframe {
position: absolute;
top: 100px;
left: 0;
border: 0;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body class="main-page">
<div class="container">
<div class="result"></div>
<button class="toggle-fullscreen">Toggle fullscreen mode - main page</button>
</div>
<script src="../../dist/jquery.js"></script>
<iframe id="test-iframe" allowfullscreen src="data/gh-1764-fullscreen-iframe.html"></iframe>
<script src="./data/gh-1764-fullscreen.js"></script>
<script>
bootstrapFrom( ".main-page" );
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Test for gh-2343 (IE11)</title>
<script src="../../dist/jquery.js"></script>
<script>
$(document).ready(function() {
$( "fieldset" ).on( "click", "input", function() {
$( ".result" ).append( "click " + this.value + "<br />" );
} );
} );
</script>
</head>
<body>
<h1>Test for gh-2343 (IE11)</h1>
<p>
Instructions: In <b>IE11</b>, click on or focus the first radio button.
Then use the left/right arrow keys to select the other radios.
You should see events logged in the results below.
</p>
<fieldset>
<input type="radio" name="rad" value="0" /> 0
<input type="radio" name="rad" value="1" /> 1
<input type="radio" name="rad" value="2" /> 2
</fieldset>
<div class="result"></div>
</body>
</html>

View file

@ -0,0 +1,58 @@
// Use the right jQuery source on the test page (and iframes)
( function() {
/* global loadTests: false */
var src,
path = window.location.pathname.split( "test" )[ 0 ],
QUnit = window.QUnit || parent.QUnit,
require = window.require || parent.require;
// iFrames won't load AMD (the iframe tests synchronously expect jQuery to be there)
QUnit.config.urlConfig.push( {
id: "amd",
label: "Load with AMD",
tooltip: "Load the AMD jQuery file (and its dependencies)"
} );
// If QUnit is on window, this is the main window
// This detection allows AMD tests to be run in an iframe
if ( QUnit.urlParams.amd && window.QUnit ) {
require.config( {
baseUrl: path,
paths: {
sizzle: "external/sizzle/dist/sizzle"
}
} );
src = "src/jquery";
// Include tests if specified
if ( typeof loadTests !== "undefined" ) {
require( [ src ], loadTests );
} else {
require( [ src ] );
}
return;
}
// Config parameter to use minified jQuery
QUnit.config.urlConfig.push( {
id: "dev",
label: "Load unminified",
tooltip: "Load the development (unminified) jQuery file"
} );
if ( QUnit.urlParams.dev ) {
src = "dist/jquery.js";
} else {
src = "dist/jquery.min.js";
}
// Load jQuery
document.write( "<script id='jquery-js' src='" + path + src + "'><\x2Fscript>" );
// Synchronous-only tests
// Other tests are loaded from the test page
if ( typeof loadTests !== "undefined" ) {
document.write( "<script src='" + path + "test/unit/ready.js'><\x2Fscript>" );
}
} )();

View file

@ -0,0 +1,75 @@
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Local File Test</title>
<!-- Includes -->
<script src="jquery.js"></script>
<style>
.error { color: red; }
.success { color: green; }
</style>
</head>
<body>
<h1>jQuery Local File Test</h1>
<h2>
Introduction
</h2>
<ul>
<li>
Access this file using the "file:" protocol,
</li>
<li>
two green "OK" strings must appear below,
</li>
<li>
Empty local files will issue errors, it's a known limitation.
</li>
</ul>
<h2>
Results
</h2>
<ul>
<li>
Success:
<span id="success">
</span>
</li>
<li>
Error:
<span id="error">
</span>
</li>
</ul>
<h2>
Logs:
</h2>
<ul id="log">
</ul>
<script>
var logUL = jQuery( "#log" );
function doLog( message, args ) {
jQuery( "<li />").appendTo( logUL ).text( message + ': "' + Array.prototype.join.call( args, '" - "' ) + '"' );
}
jQuery.ajax( "./data/badjson.js" , {
context: jQuery( "#success" ),
dataType: "text"
}).success(function( data, _, xhr ) {
doLog( "Success (" + xhr.status + ")" , arguments );
this.addClass( data ? "success" : "error" ).text( "OK" );
}).error(function( xhr ) {
doLog( "Success (" + xhr.status + ")" , arguments );
this.addClass( "error" ).text( "FAIL" );
});
jQuery.ajax( "./data/doesnotexist.ext" , {
context: jQuery( "#error" ),
dataType: "text"
}).error(function( xhr ) {
doLog( "Error (" + xhr.status + ")" , arguments );
this.addClass( "success" ).text( "OK" );
}).success(function( data, _, xhr ) {
doLog( "Error (" + xhr.status + ")" , arguments );
this.addClass( "error" ).text( "FAIL" );
});
</script>
</body>

View file

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html>
<!--
Test for #8135
Thanks John Firebaugh for this test page based on his gist
https://gist.github.com/807090
Access this page through a web server, then stop said server and click the button.
-->
<head>
<title>
jQuery Network Error Test for Firefox
</title>
<style>
div { margin-top: 10px; }
</style>
<script src="jquery.js"></script>
<script type="text/javascript">
$("button").live("click", function () {
$.ajax({
url: '/',
error: function() {
console.log( "abort", arguments );
}
}).abort();
$.ajax({
url: '/',
error: function() {
console.log( "complete", arguments );
}
});
return false;
})
</script>
</head>
<body>
<h1>
jQuery Network Error Test for Firefox
</h1>
<div>
This is a test page for
<a href="http://bugs.jquery.com/ticket/8135">
#8135
</a>
which was reported in Firefox when accessing properties
of an XMLHttpRequest object after a network error occurred.
</div>
<div>Take the following steps:</div>
<ol>
<li>
make sure you accessed this page through a web server,
</li>
<li>
stop the web server,
</li>
<li>
open the console,
</li>
<li>
click this
<button>button</button>
,
</li>
<li>
wait for both requests to fail.
</li>
</ol>
<div>
Test passes if you get two log lines:
<ul>
<li>
the first starting with "abort",
</li>
<li>
the second starting with "complete",
</li>
</ul>
</div>
<div>
Test fails if the browser notifies an exception.
</div>
</body>
</html>

View file

@ -0,0 +1,14 @@
{
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"immed": true,
"noarg": true,
"quotmark": "double",
"undef": true,
"unused": true,
"node": true
}

View file

@ -0,0 +1,11 @@
"use strict";
var assert = require( "assert" ),
ensureGlobalNotCreated = require( "./lib/ensure_global_not_created" ),
jQueryFactory = require( "../../dist/jquery.js" );
assert.throws( function() {
jQueryFactory( {} );
}, /jQuery requires a window with a document/ );
ensureGlobalNotCreated( module.exports );

View file

@ -0,0 +1,14 @@
"use strict";
var assert = require( "assert" );
require( "jsdom" ).env( "", function( errors, window ) {
assert.ifError( errors );
var ensureJQuery = require( "./lib/ensure_jquery" ),
ensureGlobalNotCreated = require( "./lib/ensure_global_not_created" ),
jQuery = require( "../../dist/jquery.js" )( window );
ensureJQuery( jQuery );
ensureGlobalNotCreated( module.exports );
} );

View file

@ -0,0 +1,17 @@
"use strict";
var assert = require( "assert" );
require( "jsdom" ).env( "", function( errors, window ) {
assert.ifError( errors );
// Pretend the window is a global.
global.window = window;
var ensureJQuery = require( "./lib/ensure_jquery" ),
ensureGlobalNotCreated = require( "./lib/ensure_global_not_created" ),
jQuery = require( "../../dist/jquery.js" );
ensureJQuery( jQuery );
ensureGlobalNotCreated( module.exports, window );
} );

View file

@ -0,0 +1,8 @@
"use strict";
if ( typeof Symbol === "undefined" ) {
console.log( "Symbols not supported, skipping the test..." );
process.exit();
}
require( "./lib/ensure_iterability_es6" )();

View file

@ -0,0 +1,13 @@
/* jshint esnext: true */
"use strict";
var assert = require( "assert" );
delete global.Symbol;
require( "core-js" );
assert.strictEqual( typeof Symbol, "function", "Expected Symbol to be a function" );
assert.notEqual( typeof Symbol.iterator, "symbol", "Expected Symbol.iterator to be polyfilled" );
require( "./lib/ensure_iterability" )();

View file

@ -0,0 +1,15 @@
"use strict";
var assert = require( "assert" );
// Ensure the jQuery property on global/window/module.exports/etc. was not
// created in a CommonJS environment.
// `global` is always checked in addition to passed parameters.
module.exports = function ensureGlobalNotCreated() {
var args = [].slice.call( arguments ).concat( global );
args.forEach( function( object ) {
assert.strictEqual( object.jQuery, undefined,
"A jQuery global was created in a CommonJS environment." );
} );
};

View file

@ -0,0 +1,25 @@
/* jshint esnext: true */
"use strict";
var assert = require( "assert" );
module.exports = function ensureIterability() {
require( "jsdom" ).env( "", function( errors, window ) {
assert.ifError( errors );
var i,
ensureJQuery = require( "./ensure_jquery" ),
jQuery = require( "../../../dist/jquery.js" )( window ),
elem = jQuery( "<div></div><span></span><a></a>" ),
result = "";
ensureJQuery( jQuery );
for ( i of elem ) {
result += i.nodeName;
}
assert.strictEqual( result, "DIVSPANA", "for-of doesn't work on jQuery objects" );
} );
};

View file

@ -0,0 +1,9 @@
"use strict";
var assert = require( "assert" );
// Check if the object we got is the jQuery object by invoking a basic API.
module.exports = function ensureJQuery( jQuery ) {
assert( /^jQuery/.test( jQuery.expando ),
"jQuery.expando was not detected, the jQuery bootstrap process has failed" );
};

View file

@ -0,0 +1,22 @@
/* jshint node: true */
"use strict";
require( "jsdom" ).env( "", function( errors, window ) {
if ( errors ) {
console.error( errors );
return;
}
var jQuery = require( ".." )( window );
exports.deferred = function() {
var deferred = jQuery.Deferred();
return {
promise: deferred.promise(),
resolve: deferred.resolve.bind( deferred ),
reject: deferred.reject.bind( deferred )
};
};
} );

View file

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<!--
Test for jQuery.holdReady. Needs to be a
standalone test since it deals with DOM
ready.
-->
<head>
<title>
jQuery.holdReady Test
</title>
<style>
div { margin-top: 10px; }
#output { background-color: green }
#expectedOutput { background-color: green }
</style>
<script src="jquery.js"></script>
<!-- Load the script loader that uses
jQuery.readyWait -->
<script src="data/readywaitloader.js"></script>
<script type="text/javascript">
jQuery(function() {
// The delayedMessage is defined by
// the readywaitasset.js file, so the
// next line will only work if this DOM
// ready callback is called after readyWait
// has been decremented by readywaitloader.js
// If an error occurs.
jQuery("#output").append(delayedMessage);
});
</script>
</head>
<body>
<h1>
jQuery.holdReady Test
</h1>
<p>
This is a test page for jQuery.readyWait and jQuery.holdReady,
see
<a href="http://bugs.jquery.com/ticket/6781">#6781</a>
and
<a href="http://bugs.jquery.com/ticket/8803">#8803</a>.
</p>
<p>
Test for jQuery.holdReady, which can be used
by plugins and other scripts to indicate something
important to the page is still loading and needs
to block the DOM ready callbacks that are registered
with jQuery.
</p>
<p>
Script loaders are the most likely kind of script
to use jQuery.holdReady, but it could be used by
other things like a script that loads a CSS file
and wants to pause the DOM ready callbacks.
</p>
<p>
<strong>Expected Result</strong>: The text
<span id="expectedOutput">It Worked!</span>
appears below after about <strong>2 seconds.</strong>
</p>
<p>
If there is an error in the console,
or the text does not show up, then the test failed.
</p>
<div id="output"></div>
</body>
</html>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,302 @@
QUnit.module( "basic", { teardown: moduleTeardown } );
if ( jQuery.ajax ) {
QUnit.test( "ajax", function( assert ) {
assert.expect( 4 );
var done = jQuery.map( new Array( 3 ), function() { return assert.async(); } );
jQuery.ajax( {
type: "GET",
url: url( "data/name.php?name=foo" ),
success: function( msg ) {
assert.strictEqual( msg, "bar", "Check for GET" );
done.pop()();
}
} );
jQuery.ajax( {
type: "POST",
url: url( "data/name.php" ),
data: "name=peter",
success: function( msg ) {
assert.strictEqual( msg, "pan", "Check for POST" );
done.pop()();
}
} );
jQuery( "#first" ).load( url( "data/name.html" ), function() {
assert.ok( /^ERROR/.test( jQuery( "#first" ).text() ),
"Check if content was injected into the DOM" );
done.pop()();
} );
} );
}
QUnit.test( "attributes", function( assert ) {
assert.expect( 6 );
var a = jQuery( "<a/>" ).appendTo( "#qunit-fixture" ),
input = jQuery( "<input/>" ).appendTo( "#qunit-fixture" );
assert.strictEqual( a.attr( "foo", "bar" ).attr( "foo" ), "bar", ".attr getter/setter" );
assert.strictEqual( a.removeAttr( "foo" ).attr( "foo" ), undefined, ".removeAttr" );
assert.strictEqual( a.prop( "href", "#5" ).prop( "href" ),
location.href.replace( /\#.*$/, "" ) + "#5",
".prop getter/setter" );
a.addClass( "abc def ghj" ).removeClass( "def ghj" );
assert.strictEqual( a.hasClass( "abc" ), true, ".(add|remove|has)Class, class present" );
assert.strictEqual( a.hasClass( "def" ), false, ".(add|remove|has)Class, class missing" );
assert.strictEqual( input.val( "xyz" ).val(), "xyz", ".val getter/setter" );
} );
if ( jQuery.css ) {
QUnit.test( "css", function( assert ) {
assert.expect( 3 );
var div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
assert.strictEqual( div.css( "width", "50px" ).css( "width" ), "50px", ".css getter/setter" );
div.hide();
assert.strictEqual( div.css( "display" ), "none", "div hidden" );
div.show();
assert.strictEqual( div.css( "display" ), "block", "div shown" );
} );
}
QUnit.test( "core", function( assert ) {
assert.expect( 28 );
var elem = jQuery( "<div></div><span></span>" );
assert.strictEqual( elem.length, 2, "Correct number of elements" );
assert.strictEqual( jQuery.trim( " hello " ), "hello", "jQuery.trim" );
assert.strictEqual( jQuery.type( null ), "null", "jQuery.type(null)" );
assert.strictEqual( jQuery.type( undefined ), "undefined", "jQuery.type(undefined)" );
assert.strictEqual( jQuery.type( "a" ), "string", "jQuery.type(String)" );
assert.ok( jQuery.isPlainObject( { "a": 2 } ), "jQuery.isPlainObject(object)" );
assert.ok( !jQuery.isPlainObject( "foo" ), "jQuery.isPlainObject(String)" );
assert.ok( jQuery.isFunction( jQuery.noop ), "jQuery.isFunction(jQuery.noop)" );
assert.ok( !jQuery.isFunction( 2 ), "jQuery.isFunction(Number)" );
assert.ok( jQuery.isNumeric( "-2" ), "jQuery.isNumeric(String representing a number)" );
assert.ok( !jQuery.isNumeric( "" ), "jQuery.isNumeric(\"\")" );
assert.ok( jQuery.isXMLDoc( jQuery.parseXML(
"<?xml version='1.0' encoding='UTF-8'?><foo bar='baz'></foo>"
) ), "jQuery.isXMLDoc" );
assert.ok( jQuery.isWindow( window ), "jQuery.isWindow(window)" );
assert.ok( !jQuery.isWindow( 2 ), "jQuery.isWindow(Number)" );
assert.strictEqual( jQuery.inArray( 3, [ "a", 6, false, 3, {} ] ), 3, "jQuery.inArray - true" );
assert.strictEqual(
jQuery.inArray( 3, [ "a", 6, false, "3", {} ] ),
-1,
"jQuery.inArray - false"
);
assert.strictEqual( elem.get( 1 ), elem[ 1 ], ".get" );
assert.strictEqual( elem.first()[ 0 ], elem[ 0 ], ".first" );
assert.strictEqual( elem.last()[ 0 ], elem[ 1 ], ".last" );
assert.deepEqual( jQuery.map( [ "a", "b", "c" ], function( v, k ) {
return k + v;
} ), [ "0a", "1b", "2c" ], "jQuery.map" );
assert.deepEqual( jQuery.merge( [ 1, 2 ], [ "a", "b" ] ), [ 1, 2, "a", "b" ], "jQuery.merge" );
assert.deepEqual( jQuery.grep( [ 1, 2, 3 ], function( value ) {
return value % 2 !== 0;
} ), [ 1, 3 ], "jQuery.grep" );
assert.deepEqual( jQuery.extend( { a: 2 }, { b: 3 } ), { a: 2, b: 3 }, "jQuery.extend" );
jQuery.each( [ 0, 2 ], function( k, v ) {
assert.strictEqual( k * 2, v, "jQuery.each" );
} );
assert.deepEqual( jQuery.makeArray( { 0: "a", 1: "b", 2: "c", length: 3 } ),
[ "a", "b", "c" ], "jQuery.makeArray" );
assert.strictEqual( jQuery.parseHTML( "<div></div><span></span>" ).length,
2, "jQuery.parseHTML" );
assert.deepEqual( jQuery.parseJSON( "{\"a\": 2}" ), { a: 2 }, "jQuery.parseJON" );
} );
QUnit.test( "data", function( assert ) {
assert.expect( 4 );
var elem = jQuery( "<div data-c='d'/>" ).appendTo( "#qunit-fixture" );
assert.ok( !jQuery.hasData( elem[ 0 ] ), "jQuery.hasData - false" );
assert.strictEqual( elem.data( "a", "b" ).data( "a" ), "b", ".data getter/setter" );
assert.strictEqual( elem.data( "c" ), "d", ".data from data-* attributes" );
assert.ok( jQuery.hasData( elem[ 0 ] ), "jQuery.hasData - true" );
} );
QUnit.test( "dimensions", function( assert ) {
assert.expect( 3 );
var elem = jQuery(
"<div style='margin: 10px; padding: 7px; border: 2px solid black;' /> "
).appendTo( "#qunit-fixture" );
assert.strictEqual( elem.width( 50 ).width(), 50, ".width getter/setter" );
assert.strictEqual( elem.innerWidth(), 64, ".innerWidth getter" );
assert.strictEqual( elem.outerWidth(), 68, ".outerWidth getter" );
} );
QUnit.test( "event", function( assert ) {
assert.expect( 1 );
var elem = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
elem
.on( "click", function() {
assert.ok( false, "click should not fire" );
} )
.off( "click" )
.trigger( "click" )
.on( "click", function() {
assert.ok( true, "click should fire" );
} )
.trigger( "click" );
} );
QUnit.test( "manipulation", function( assert ) {
assert.expect( 5 );
var child,
elem1 = jQuery( "<div><span></span></div>" ).appendTo( "#qunit-fixture" ),
elem2 = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
assert.strictEqual( elem1.text( "foo" ).text(), "foo", ".html getter/setter" );
assert.strictEqual(
// Support: IE 8 only
// IE 8 prints tag names in upper case.
elem1.html( "<span/>" ).html().toLowerCase(),
"<span></span>",
".html getter/setter"
);
assert.strictEqual( elem1.append( elem2 )[ 0 ].childNodes[ 1 ], elem2[ 0 ], ".append" );
assert.strictEqual( elem1.prepend( elem2 )[ 0 ].childNodes[ 0 ], elem2[ 0 ], ".prepend" );
child = elem1.find( "span" );
child.after( "<a/>" );
child.before( "<b/>" );
assert.strictEqual(
// Support: IE 8 only
// IE 8 prints tag names in upper case.
elem1.html().toLowerCase(),
"<div></div><b></b><span></span><a></a>",
".after/.before"
);
} );
QUnit.test( "offset", function( assert ) {
assert.expect( 3 );
var parent = jQuery( "<div style='position:fixed;top:20px;'/>" ).appendTo( "#qunit-fixture" ),
elem = jQuery( "<div style='position:absolute;top:5px;'/>" ).appendTo( parent );
assert.strictEqual( elem.offset().top, 25, ".offset getter" );
assert.strictEqual( elem.position().top, 5, ".position getter" );
assert.strictEqual( elem.offsetParent()[ 0 ], parent[ 0 ], ".offsetParent" );
} );
QUnit.test( "selector", function( assert ) {
assert.expect( 2 );
var elem = jQuery( "<div><span class='a'></span><span class='b'><a></a></span></div>" )
.appendTo( "#qunit-fixture" );
assert.strictEqual( elem.find( ".a a" ).length, 0, ".find - no result" );
assert.strictEqual( elem.find( "span.b a" )[ 0 ].nodeName, "A", ".find - one result" );
} );
QUnit.test( "serialize", function( assert ) {
assert.expect( 2 );
var params = { "someName": [ 1, 2, 3 ], "regularThing": "blah" };
assert.strictEqual( jQuery.param( params ),
"someName%5B%5D=1&someName%5B%5D=2&someName%5B%5D=3&regularThing=blah",
"jQuery.param" );
assert.strictEqual( jQuery( "#form" ).serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search" +
"&select1=&select2=3&select3=1&select3=2&select5=3",
"form serialization as query string" );
} );
QUnit.test( "traversing", function( assert ) {
assert.expect( 12 );
var elem = jQuery( "<div><a><b><em></em></b></a><i></i><span></span>foo</div>" )
.appendTo( "#qunit-fixture" );
assert.strictEqual( elem.find( "em" ).parent()[ 0 ].nodeName, "B", ".parent" );
assert.strictEqual( elem.find( "em" ).parents()[ 1 ].nodeName, "A", ".parents" );
assert.strictEqual( elem.find( "em" ).parentsUntil( "div" ).length, 2, ".parentsUntil" );
assert.strictEqual( elem.find( "i" ).next()[ 0 ].nodeName, "SPAN", ".next" );
assert.strictEqual( elem.find( "i" ).prev()[ 0 ].nodeName, "A", ".prev" );
assert.strictEqual( elem.find( "a" ).nextAll()[ 1 ].nodeName, "SPAN", ".nextAll" );
assert.strictEqual( elem.find( "span" ).prevAll()[ 1 ].nodeName, "A", ".prevAll" );
assert.strictEqual( elem.find( "a" ).nextUntil( "span" ).length, 1, ".nextUntil" );
assert.strictEqual( elem.find( "span" ).prevUntil( "a" ).length, 1, ".prevUntil" );
assert.strictEqual( elem.find( "i" ).siblings().length, 2, ".siblings" );
assert.strictEqual( elem.children()[ 2 ].nodeName, "SPAN", ".children" );
assert.strictEqual( elem.contents()[ 3 ].nodeType, 3, ".contents" );
} );
QUnit.test( "wrap", function( assert ) {
assert.expect( 3 );
var elem = jQuery( "<div><a><b></b></a><a></a></div>" );
elem.find( "b" ).wrap( "<span>" );
assert.strictEqual(
// Support: IE 8 only
// IE 8 prints tag names in upper case.
elem.html().toLowerCase(),
"<a><span><b></b></span></a><a></a>",
".wrap"
);
elem.find( "span" ).wrapInner( "<em>" );
assert.strictEqual(
// Support: IE 8 only
// IE 8 prints tag names in upper case.
elem.html().toLowerCase(),
"<a><span><em><b></b></em></span></a><a></a>",
".wrapInner"
);
elem.find( "a" ).wrapAll( "<i>" );
assert.strictEqual(
// Support: IE 8 only
// IE 8 prints tag names in upper case.
elem.html().toLowerCase(),
"<i><a><span><em><b></b></em></span></a><a></a></i>",
".wrapAll"
);
} );

Some files were not shown because too many files have changed in this diff Show more