ionic-Material Design , Codecanyon

This commit is contained in:
Carsten Hilmer
2016-08-22 12:59:56 +02:00
parent 7cd84fe179
commit 92601ec169
1440 changed files with 482763 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
qunit/
data/badjson.js
data/jquery-1.8.2.ajax_xhr.min.js

View File

@@ -0,0 +1,55 @@
{
"curly": true,
"expr": true,
"quotmark": "double",
"trailing": true,
"undef": true,
"maxerr": 100,
"eqnull": true,
"evil": true,
"smarttabs": true,
"sub": true,
"browser": true,
"devel": true,
"wsh": true,
"predef": [
"DOMParser",
"jQuery",
"QUnit",
"module",
"ok",
"equal",
"test",
"asyncTest",
"notEqual",
"deepEqual",
"strictEqual",
"notStrictEqual",
"start",
"stop",
"expect",
"raises",
"ajaxTest",
"testIframe",
"testIframeWithCallback",
"createDashboardXML",
"createXMLFragment",
"moduleTeardown",
"testFoo",
"url",
"t",
"q",
"amdDefined",
"fireNative",
"Globals",
"hasPHP",
"isLocal",
"originaljQuery",
"$",
"original$",
"externalHost"
]
}

View File

@@ -0,0 +1,16 @@
<?php
header("X-Content-Security-Policy: default-src localhost 'self';");
header("X-WebKit-CSP: script-src 'self'; style-src 'self' 'unsafe-inline'");
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSP Test Page</title>
<script src="../dist/jquery.js"></script>
</head>
<body>
<p>CSP Test Page</p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

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 type="text/javascript" src="../../../dist/jquery.min.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=600");
}
});
</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,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="../../../dist/jquery.min.js"></script>
</head>
<body>
<script>
window.parent.iframeCallback( cc_on, errors, jQuery );
</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,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="../../../dist/jquery.min.js"></script>
</div>
</body>
</html>

View File

@@ -0,0 +1,21 @@
<!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>
html {
/**
* we need to null out border-width, because it causes bug #3838
* and until we drop IE6, this test will fail in IE6 if we didn't
* special case this situation.
**/
border-width: 0;
}
</style>
</head>
<body>
<div>
<script src="../../../dist/jquery.min.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,5 @@
<?php
header("HTTP/1.0 400 Bad Request");
echo "plain text message";

View File

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

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,4 @@
<?php
sleep((int)$_GET['sleep']);
header('Content-type: text/javascript');
?>

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 type="text/javascript" src="../../../dist/jquery.min.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 type="text/javascript" src="../../../dist/jquery.min.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 @@
<?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 ) {
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 one or more lines are too long

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="../../../dist/jquery.min.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="../../../dist/jquery.min.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="../../../dist/jquery.min.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="../../../dist/jquery.min.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,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>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; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../../dist/jquery.min.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>
<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,39 @@
<!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; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../../dist/jquery.min.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="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="../../../dist/jquery.min.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="../../../dist/jquery.min.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="../../../dist/jquery.min.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="../../../dist/jquery.js"></script>
<script>
var $cached = jQuery.noConflict(true);
</script>
<script src="../../../dist/jquery.min.js"></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="../../../dist/jquery.min.js"></script>
</div>
<script>
jQuery(function() {
window.parent.iframeCallback( jQuery( "body" ).css( "backgroundColor" ), jQuery.support );
});
</script>
</body>
</html>

View File

@@ -0,0 +1,23 @@
<!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>
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
</style>
</head>
<body>
<div>
<script src="../../../dist/jquery.min.js"></script>
</div>
<script>
jQuery(function() {
window.parent.iframeCallback( jQuery.support.shrinkWrapBlocks );
});
</script>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
body {
background: url('../1x1.jpg');
}
</style>
<script src="../../../dist/jquery.min.js"></script>
</head>
<body>
<script>
window.parent.iframeCallback();
</script>
</body>
</html>

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/test.js"></script>
blabla

View File

@@ -0,0 +1,3 @@
var testBar = "bar";
jQuery("#ap").html("bar");
ok( true, "test.js executed");

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/test.js?<?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,3 @@
<div class="user">This is a user</div>
<div class="user">This is a user</div>
<div class="teacher">This is a teacher</div>

View File

@@ -0,0 +1,269 @@
/*jshint multistr:true, quotmark:false */
var amdDefined, fireNative,
originaljQuery = this.jQuery || "jQuery",
original$ = this.$ || "$",
hasPHP = true,
isLocal = window.location.protocol === "file:",
// see RFC 2606
externalHost = "example.com";
// For testing .noConflict()
this.jQuery = originaljQuery;
this.$ = original$;
/**
* Set up a mock AMD define function for testing AMD registration.
*/
function define( name, dependencies, callback ) {
amdDefined = callback();
}
define.amd = {
jQuery: true
};
/**
* Returns an array of elements with the given IDs
* @example q("main", "foo", "bar")
* @result [<div id="main">, <span id="foo">, <input id="bar">]
*/
function q() {
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", "baar"]);
* @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
*/
function t( a, b, c ) {
var f = jQuery(b).get(),
s = "",
i = 0;
for ( ; i < f.length; i++ ) {
s += ( s && "," ) + '"' + f[ i ].id + '"';
}
deepEqual(f, q.apply( q, c ), a + " (" + b + ")");
}
function createDashboardXML() {
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);
}
function createWithFriesXML() {
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 ) );
}
function createXMLFragment() {
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 ) {
var event = document.createEventObject();
node.fireEvent( 'on' + type, event );
};
/**
* 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 value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random() * 100000, 10);
}
// Ajax testing helper
function ajaxTest( title, expect, options ) {
var requestOptions;
if ( jQuery.isFunction( options ) ) {
options = options();
}
options = options || [];
requestOptions = options.requests || options.request || options;
if ( !jQuery.isArray( requestOptions ) ) {
requestOptions = [ requestOptions ];
}
asyncTest( title, expect, function() {
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();
}
start();
}
},
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 ) {
ok( false, "unexpected " + status );
} else if ( jQuery.isFunction( handler ) ) {
handler.apply( this, arguments );
}
}
};
};
if ( options.afterSend ) {
options.afterSend( request );
}
return request
.done( callIfDefined( "done", "success" ) )
.fail( callIfDefined( "fail", "error" ) )
.always( complete );
});
ajaxTest.abort = function( reason ) {
if ( !completed ) {
completed = true;
delete ajaxTest.abort;
ok( false, "aborted " + reason );
jQuery.each( requests, function( i, request ) {
request.abort();
});
}
};
});
}
(function () {
this.testIframe = function( fileName, name, fn ) {
test(name, function() {
// pause execution for now
stop();
// load fixture in iframe
var iframe = loadFixture(),
win = iframe.contentWindow,
interval = setInterval( function() {
if ( win && win.jQuery && win.jQuery.isReady ) {
clearInterval( interval );
// continue
start();
// call actual tests passing the correct jQuery instance to use
fn.call( this, win.jQuery, win, win.document );
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 ) {
test( title, function() {
var iframe;
stop();
window.iframeCallback = function() {
var self = this,
args = arguments;
setTimeout(function() {
window.iframeCallback = undefined;
iframe.remove();
func.apply( self, args );
func = function() {};
start();
}, 0 );
};
iframe = jQuery( "<div/>" ).append(
jQuery( "<iframe/>" ).attr( "src", url( "./data/" + fileName ) )
).appendTo( "body" );
});
};
window.iframeCallback = undefined;
}());

View File

@@ -0,0 +1,368 @@
/**
* Allow the test suite to run with other libs or jQuery's.
*/
jQuery.noConflict();
// For checking globals pollution despite auto-created globals in various environments
jQuery.each( [ jQuery.expando, "getInterface", "Packages", "java", "netscape" ], function( i, name ) {
window[ name ] = window[ name ];
});
// Expose Sizzle for Sizzle's selector tests
// We remove Sizzle's globalization in jQuery
var Sizzle = Sizzle || jQuery.find;
// Allow subprojects to test against their own fixtures
var qunitModule = QUnit.module,
qunitTest = QUnit.test;
function testSubproject( label, url, risTests ) {
var sub, fixture, fixtureHTML,
fixtureReplaced = false;
// Don't let subproject tests jump the gun
QUnit.config.reorder = false;
// Create module
module( label );
// Duckpunch QUnit
// TODO restore parent fixture on teardown to support reordering
module = QUnit.module = function( name ) {
var args = arguments;
// Remember subproject-scoped module name
sub = name;
// Override
args[0] = label;
return qunitModule.apply( this, args );
};
test = function( name ) {
var args = arguments,
i = args.length - 1;
// Prepend subproject-scoped module name to test name
args[0] = sub + ": " + name;
// Find test function and wrap to require subproject fixture
for ( ; i >= 0; i-- ) {
if ( originaljQuery.isFunction( args[i] ) ) {
args[i] = requireFixture( args[i] );
break;
}
}
return qunitTest.apply( this, args );
};
// Load tests and fixture from subproject
// Test order matters, so we must be synchronous and throw an error on load failure
originaljQuery.ajax( url, {
async: false,
dataType: "html",
error: function( jqXHR, status ) {
throw new Error( "Could not load: " + url + " (" + status + ")" );
},
success: function( data, status, jqXHR ) {
var page = originaljQuery.parseHTML(
// replace html/head with dummy elements so they are represented in the DOM
( data || "" ).replace( /<\/?((!DOCTYPE|html|head)\b.*?)>/gi, "[$1]" ),
document,
true
);
if ( !page || !page.length ) {
this.error( jqXHR, "no data" );
}
page = originaljQuery( page );
// Include subproject tests
page.filter("script[src]").add( page.find("script[src]") ).each(function() {
var src = originaljQuery( this ).attr("src"),
html = "<script src='" + url + src + "'></script>";
if ( risTests.test( src ) ) {
if ( originaljQuery.isReady ) {
originaljQuery("head").first().append( html );
} else {
document.write( html );
}
}
});
// Get the fixture, including content outside of #qunit-fixture
fixture = page.find("[id='qunit-fixture']");
fixtureHTML = fixture.html();
fixture.empty();
while ( fixture.length && !fixture.prevAll("[id='qunit']").length ) {
fixture = fixture.parent();
}
fixture = fixture.add( fixture.nextAll() );
}
});
function requireFixture( fn ) {
return function() {
if ( !fixtureReplaced ) {
// Make sure that we retrieved a fixture for the subproject
if ( !fixture.length ) {
ok( false, "Found subproject fixture" );
return;
}
// Replace the current fixture, including content outside of #qunit-fixture
var oldFixture = originaljQuery("#qunit-fixture");
while ( oldFixture.length && !oldFixture.prevAll("[id='qunit']").length ) {
oldFixture = oldFixture.parent();
}
oldFixture.nextAll().remove();
oldFixture.replaceWith( fixture );
// WARNING: UNDOCUMENTED INTERFACE
QUnit.config.fixture = fixtureHTML;
QUnit.reset();
if ( originaljQuery("#qunit-fixture").html() !== fixtureHTML ) {
ok( false, "Copied subproject fixture" );
return;
}
fixtureReplaced = true;
}
fn.apply( this, arguments );
};
}
}
// Register globals for cleanup and the cleanup code itself
// Explanation at http://perfectionkills.com/understanding-delete/#ie_bugs
var Globals = (function() {
var globals = {};
return {
register: function( name ) {
globals[ name ] = true;
jQuery.globalEval( "var " + name + " = undefined;" );
},
cleanup: function() {
var name,
current = globals;
globals = {};
for ( name in current ) {
jQuery.globalEval( "try { " +
"delete " + ( jQuery.support.deleteExpando ? "window['" + name + "']" : name ) +
"; } catch( x ) {}" );
}
}
};
})();
// Sandbox start for great justice
(function() {
var oldStart = window.start;
window.start = function() {
oldStart();
};
})();
/**
* QUnit hooks
*/
(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,
oldFragmentsLength = 0,
oldTimersLength = 0,
oldActive = 0,
expectedDataKeys = {},
reset = QUnit.reset,
ajaxSettings = jQuery.ajaxSettings;
function keys(o) {
var ret, key;
if ( Object.keys ) {
ret = Object.keys( o );
} else {
ret = [];
for ( key in o ) {
ret.push( key );
}
}
ret.sort();
return ret;
}
/**
* @param {jQuery|HTMLElement|Object|Array} elems Target (or array of targets) for jQuery.data.
* @param {string} key
*/
QUnit.expectJqData = function( elems, key ) {
var i, elem, expando;
QUnit.current_testEnvironment.checkJqData = true;
if ( elems.jquery && elems.toArray ) {
elems = elems.toArray();
}
if ( !jQuery.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).
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.
*/
this.moduleTeardown = function() {
var i,
expectedKeys, actualKeys,
fragmentsLength = 0,
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] ? keys( jQuery.cache[i] ) : jQuery.cache[i];
if ( !QUnit.equiv( expectedKeys, actualKeys ) ) {
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 ) {
deepEqual( expectedDataKeys[i], undefined, "No unexpected keys were left in jQuery.cache (#" + i + ")" );
delete expectedDataKeys[i];
}
}
// Reset data register
expectedDataKeys = {};
// Allow QUnit.reset to clean up any attached elements before checking for leaks
QUnit.reset();
for ( i in jQuery.cache ) {
++cacheLength;
}
jQuery.fragments = {};
for ( i in jQuery.fragments ) {
++fragmentsLength;
}
// 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 ) {
equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" );
oldCacheLength = cacheLength;
}
if ( fragmentsLength !== oldFragmentsLength ) {
equal( fragmentsLength, oldFragmentsLength, "No unit tests leak memory in jQuery.fragments" );
oldFragmentsLength = fragmentsLength;
}
if ( jQuery.timers && jQuery.timers.length !== oldTimersLength ) {
equal( jQuery.timers.length, oldTimersLength, "No timers are still running" );
oldTimersLength = jQuery.timers.length;
}
if ( jQuery.active !== undefined && jQuery.active !== oldActive ) {
equal( jQuery.active, 0, "No AJAX requests are still active" );
if ( ajaxTest.abort ) {
ajaxTest.abort("active requests");
}
oldActive = jQuery.active;
}
};
QUnit.done(function() {
// Remove our own fixtures outside #qunit-fixture
jQuery("#qunit ~ *").remove();
});
// jQuery-specific QUnit.reset
QUnit.reset = function() {
// Ensure jQuery events and data on the fixture are properly removed
jQuery("#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();
// Let QUnit reset the fixture
reset.apply( this, arguments );
};
})();
/**
* QUnit configuration
*/
// Max time for stop() and asyncTest() until it aborts test
// and start()'s the next test.
QUnit.config.testTimeout = 20 * 1000; // 20 seconds
// Enforce an "expect" argument or expect() call in all test bodies.
QUnit.config.requireExpects = true;
/**
* Load the TestSwarm listener if swarmURL is in the address.
*/
(function() {
var url = window.location.search;
url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + "swarmURL=".length ) );
if ( !url || url.indexOf("http") !== 0 ) {
return;
}
document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() + "'></scr" + "ipt>");
})();

View File

@@ -0,0 +1,155 @@
/* for testing opacity set in styles in IE */
ol#empty {
opacity: 0;
filter:Alpha(opacity=0) progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffff0000', EndColorStr='#ffffffff');
}
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: auto;
}
div.largewidth {
width: 100px;
}
div.largeheight {
height: 100px;
}
div.largeopacity {
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
}
div.medwidth {
width: 50px;
}
div.medheight {
height: 50px;
}
div.medopacity {
opacity: 0.5;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
}
div.nowidth {
width: 0px;
}
div.noheight {
height: 0px;
}
div.noopacity {
opacity: 0;
filter: progid:DXImageTransform.Microsoft.Alpha(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%; }
/* For testing type on vml in IE #7071 */
v\:oval { behavior:url(#default#VML); display:inline-block; }
/* 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; }
/* #6652 REMOVE FILTER:ALPHA(OPACITY=100) AFTER ANIMATION */
#t6652 div { filter: alpha(opacity=50); }
/* #10501 */
section { background:#f0f; display:block; }
/* #11971 */
#foo { background: url(1x1.jpg) right bottom no-repeat; }
#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,272 @@
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Win 9x 4.90; http://www.Abolimba.de)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; JyxoToolbar1.0; http://www.Abolimba.de; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322)
0 Mozilla/5.0 (compatible; ABrowse 0.4; Syllable)
webkit 420 Mozilla/5.0 (compatible; U; ABrowse 0.6; Syllable) AppleWebKit/420+ (KHTML, like Gecko)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Acoo Browser; InfoPath.2; .NET CLR 2.0.50727; Alexa Toolbar)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Acoo Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)
0 amaya/9.52 libwww/5.4.0
0 amaya/11.1 libwww/5.4.0
0 Amiga-AWeb/3.5.07 beta
0 AmigaVoyager/3.4.4 (MorphOS/PPC native)
0 AmigaVoyager/2.95 (compatible; MC680x0; AmigaOS)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; AOL 7.0; Windows NT 5.1; FunWebProducts)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; AOL 8.0; Windows NT 5.1; SV1)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.0; Windows NT 5.1; .NET CLR 1.1.4322; Zango 10.1.181.0)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; AOL 6.0; Windows NT 5.1)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.5; AOLBuild 4337.35; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
webkit 523.15 Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN) AppleWebKit/523.15 (KHTML, like Gecko, Safari/419.3) Arora/0.3 (Change: 287 c9dfb30)
webkit 527 Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.6
webkit 523.15 Mozilla/5.0 (X11; U; Linux; C -) AppleWebKit/523.15 (KHTML, like Gecko, Safari/419.3) Arora/0.5
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Avant Browser; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
0 Avant Browser (http://www.avantbrowser.com)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; JyxoToolbar1.0; Embedded Web Browser from: http://bsalsa.com/; Avant Browser; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; Avant Browser)
mozilla 0 Mozilla/5.0 (Windows; U; Win9x; en; Stable) Gecko/20020911 Beonex/0.8.1-stable
mozilla 0 Mozilla/5.0 (Windows; U; WinNT; en; Preview) Gecko/20020603 Beonex/0.8-stable
mozilla 1.0.2 Mozilla/5.0 (Windows; U; WinNT; en; rv:1.0.2) Gecko/20030311 Beonex/0.8.2-stable
mozilla 1.9 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008120120 Blackbird/0.9991
webkit 527 Mozilla/5.0 (X11; 78; CentOS; US-en) AppleWebKit/527+ (KHTML, like Gecko) Bolt/0.862 Version/3.0 Safari/523.15
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Browzar)
0 Bunjalloo/0.7.4(Nintendo DS;U;en)
0 Bunjalloo/0.7.6(Nintendo DS;U;en)
mozilla 1.8.1.4pre Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.4pre) Gecko/20070511 Camino/1.6pre
mozilla 1.7.2 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.2) Gecko/20040825 Camino/0.8.1
mozilla 1.8.1.12 Mozilla/5.0 (Macintosh; U; Intel Mac OS X Mach-O; en; rv:1.8.1.12) Gecko/20080206 Camino/1.5.5
mozilla 1.0.1 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.0.1) Gecko/20030111 Chimera/0.6
mozilla 1.8.0.10 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.10) Gecko/20070228 Camino/1.0.4
webkit 418.9 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko, Safari) Safari/419.3 Cheshire/1.0.ALPHA
webkit 419 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko, Safari/419.3) Cheshire/1.0.ALPHA
chrome 1.0.154.36 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.36 Safari/525.19
chrome 1.0.154.53 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.53 Safari/525.19
mozilla 1.9.0.10 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042815 Firefox/3.0.10 CometBird/3.0.10
mozilla 1.9.0.5 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2009011615 Firefox/3.0.5 CometBird/3.0.5
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; Crazy Browser 3.0.0 Beta2)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; Crazy Browser 2.0.1)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Crazy Browser 1.0.5; .NET CLR 1.1.4322; InfoPath.1)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Deepnet Explorer 1.5.0; .NET CLR 1.0.3705)
webkit 525.27.1 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Demeter/1.0.9 Safari/125
webkit 312.8 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; pl-pl) AppleWebKit/312.8 (KHTML, like Gecko, Safari) DeskBrowse/1.0
0 Dillo/0.8.5
0 Dillo/2.0
0 DocZilla/1.0 (Windows; U; WinNT4.0; en-US; rv:1.0.0) Gecko/20020804
0 DocZilla/2.7 (Windows; U; Windows NT 5.1; en-US; rv:2.7.0) Gecko/20050706 CiTEC Information
webkit 527 Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Dooble
0 Doris/1.15 [en] (Symbian)
0 edbrowse/1.5.17-2
0 edbrowse/2.2.10
0 edbrowse/3.1.2-1
0 ELinks/0.13.GIT (textmode; Linux 2.6.22-2-686 i686; 148x68-3)
0 ELinks/0.9.3 (textmode; Linux 2.6.11 i686; 79x24)
0 Enigma Browser
mozilla 1.8.1.12 Mozilla/5.0 (X11; U; Linux i686; en; rv:1.8.1.12) Gecko/20080208 (Debian-1.8.1.12-2) Epiphany/2.20
mozilla 1.9.0.12 Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.12) Gecko/20080528 Fedora/2.24.3-8.fc10 Epiphany/2.22 Firefox/3.0
mozilla 1.7.3 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Epiphany/1.4.7
mozilla 1.5 Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
mozilla 1.5 Mozilla/5.0 (Windows; U; Win95; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
mozilla 1.8.0.3 Mozilla/5.0 (Windows; U; Windows NT 5.0; es-ES; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
mozilla 1.9.1b2 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; ko; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2
mozilla 1.9.0.8 Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8
mozilla 1.7.9 Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7.9) Gecko/20050711 Firefox/1.0.5
mozilla 1.9b5 Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5
mozilla 1.8.0.5 Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.8.0.5) Gecko/20060819 Firefox/1.5.0.5
mozilla 1.9.1b3 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3) Gecko/20090305 Firefox/3.1b3 GTB5
mozilla 1.8.1.12 Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080214 Firefox/2.0.0.12
mozilla 1.8.1.9 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.9) Gecko/20071113 BonEcho/2.0.0.9
mozilla 1.8.1 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061026 BonEcho/2.0
mozilla 1.8.1.21pre Mozilla/5.0 (BeOS; U; Haiku BePC; en-US; rv:1.8.1.21pre) Gecko/20090227 BonEcho/2.0.0.21pre
mozilla 1.9.0.8 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/2009033017 GranParadiso/3.0.8
mozilla 1.9.2a2pre Mozilla/5.0 (Windows; U; Windows NT 6.1; cs; rv:1.9.2a2pre) Gecko/20090912 Namoroka/3.6a2pre (.NET CLR 3.5.30729)
mozilla 1.9.2a2pre Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2a2pre) Gecko/20090901 Ubuntu/9.10 (karmic) Namoroka/3.6a2pre
mozilla 1.9.2a1 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2a1) Gecko/20090806 Namoroka/3.6a1
mozilla 1.9.1b3pre Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090109 Shiretoko/3.1b3pre
mozilla 1.9.1b4pre Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b4pre) Gecko/20090311 Shiretoko/3.1b4pre
mozilla 1.8.0.1 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060314 Flock/0.5.13.2
mozilla 1.9.0.2 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.2) Gecko/2008092122 Firefox/3.0.2 Flock/2.0b3
webkit 525.13 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Fluid/0.9.4 Safari/525.13
mozilla 1.7.12 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050929 Galeon/1.3.21
mozilla 1.9.0.8 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/20090327 Galeon/2.0.7
mozilla 1.9.1.5 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091105 Firefox/3.5.5 compat GlobalMojo/1.5.5 GlobalMojoExt/1.5
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; GreenBrowser)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; GreenBrowser)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; GreenBrowser)
0 HotJava/1.1.2 FCS
mozilla 0 Mozilla/3.0 (x86 [cs] Windows NT 5.1; Sun)
mozilla 1.8.0.3 Mozilla/5.1 (X11; U; Linux i686; en-US; rv:1.8.0.3) Gecko/20060425 SUSE/1.5.0.3-7 Hv3/alpha
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SIMBAR={CFBFDAEA-F21E-4D6E-A9B0-E100A69B860F}; Hydra Browser; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Hydra Browser; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
0 IBrowse/2.3 (AmigaOS 3.9)
0 Mozilla/5.0 (compatible; IBrowse 3.0; AmigaOS4.0)
0 iCab/4.0 (Macintosh; U; Intel Mac OS X)
0 Mozilla/4.5 (compatible; iCab 2.9.1; Macintosh; U; PPC)
0 iCab/3.0.2 (Macintosh; U; PPC Mac OS X)
0 ICE Browser/v5_4_3 (Java 1.4.2; Windows XP 5.1 x86)
mozilla 0 Mozilla/5.0 (Java 1.6.0_01; Windows XP 5.1 x86; en) ICEbrowser/v6_1_2
0 ICE Browser/5.05 (Java 1.4.0; Windows 2000 5.0 x86)
mozilla 1.8.1.9 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.9) Gecko/20071030 Iceape/1.1.6 (Debian-1.1.6-3)
mozilla 1.8.1.8 Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.8) Gecko/20071008 Iceape/1.1.5 (Ubuntu-1.1.5-1ubuntu0.7.10)
mozilla 1.9.0.3 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092921 IceCat/3.0.3-g1
mozilla 1.8.1.11 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20071203 IceCat/2.0.0.11-g1
mozilla 1.9.0.5 Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.0.5) Gecko/2008122011 Iceweasel/3.0.5 (Debian-3.0.5-1)
mozilla 1.8.1.1 Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.1) Gecko/20061205 Iceweasel/2.0.0.1 (Debian-2.0.0.1+dfsg-4)
mozilla 1.9.0.5 Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.0.5) Gecko/2008122011 Iceweasel/3.0.5 (Debian-3.0.5-1)
msie 4.0 Mozilla/2.0 (compatible; MSIE 4.0; Windows 98)
msie 6.0 Mozilla/4.0 (Windows; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
msie 7.0 Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1; .NET CLR 3.0.04506.30)
msie 5.01 Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
msie 8.0 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; MS-RTC LM 8; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; .NET CLR 3.0.30729)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727)
msie 5.0b1 Mozilla/4.0 (compatible; MSIE 5.0b1; Mac_PowerPC)
msie 5.0 Mozilla/4.0 (compatible; MSIE 5.0; Windows NT;)
msie 5.23 Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB6; Ant.com Toolbar 1.6; MSIECrawler)
msie 8.0 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB5; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; MS-RTC LM 8; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; .NET CLR 3.0.30729)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; iRider 2.21.1108; FDM)
webkit 528.5 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/528.5 (KHTML, like Gecko) Iron/0.4.155.0 Safari/528.5
webkit 528.7 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/528.7 (KHTML, like Gecko) Iron/1.0.155.0 Safari/528.7
webkit 525.19 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Iron/0.2.152.0 Safari/12081672.525
webkit 531.0 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/531.0 (KHTML, like Gecko) Iron/3.0.189.0 Safari/531.0
mozilla 1.8.1.19 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.8.1.19) Gecko/20081217 K-Meleon/1.5.2
mozilla 1.8.1.21 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090331 K-Meleon/1.5.3
mozilla 1.8.0.5 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060706 K-Meleon/1.0
mozilla 1.8.1.21 Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.21) Gecko/20090331 K-Meleon/1.5.3
mozilla 1.8.0.6 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060731 K-Ninja/2.0.2
mozilla 1.8.1.4pre Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4pre) Gecko/20070404 K-Ninja/2.1.3
mozilla 1.8.1.2pre Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre) Gecko/20070215 K-Ninja/2.1.1
mozilla 1.9 Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/20080705 Firefox/3.0 Kapiko/3.0
mozilla 0 Mozilla/5.0 (X11; Linux i686; U;) Gecko/20070322 Kazehakase/0.4.5
mozilla 1.9.0.8 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko Fedora/1.9.0.8-1.fc10 Kazehakase/0.5.6
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; KKman2.0)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; KKMAN3.2)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; KKman3.0)
0 Mozilla/5.0 (compatible; Konqueror/3.1-rc5; i686 Linux; 20020712)
0 Mozilla/5.0 (compatible; Konqueror/4.3; Windows) KHTML/4.3.0 (like Gecko)
0 Mozilla/5.0 (compatible; Konqueror/2.2.1; Linux)
0 Mozilla/5.0 (compatible; Konqueror/3.5; SunOS)
0 Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko)
0 Links (0.96; Linux 2.4.20-18.7 i586)
0 Links (0.98; Win32; 80x25)
0 Links (2.1pre18; Linux 2.4.31 i686; 100x37)
0 Links (2.1; Linux 2.6.18-gentoo-r6 x86_64; 80x24)
0 Links (2.2; Linux 2.6.25-gentoo-r9 sparc64; 166x52)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Linux 2.6.26-1-amd64) Lobo/0.98.3
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows XP 5.1) Lobo/0.98.4
0 Mozilla/4.0 (compatible; Lotus-Notes/5.0; Windows-NT)
0 Mozilla/4.0 (compatible; Lotus-Notes/6.0; Windows-NT)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; Lunascape 2.1.3)
mozilla 1.9.1b3pre Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/2008 Lunascape/4.9.9.98
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; JyxoToolbar1.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; Lunascape 5.1.4.5)
webkit 528 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/528+ (KHTML, like Gecko, Safari/528.0) Lunascape/5.0.2.0
mozilla 1.9.1.2 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090804 Firefox/3.5.2 Lunascape/5.1.4.5
0 Lynx/2.8.6rel.4 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.6.3
0 Lynx/2.8.3dev.6 libwww-FM/2.14
0 Lynx/2.8.5dev.16 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7a
mozilla 1.7.12 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20051001 Firefox/1.0.7 Madfox/0.3.2u3
webkit 530.6 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.6 (KHTML, like Gecko) Maxthon/3.0 Safari/530.6
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MyIE2)
msie 8.0 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; MAXTHON 2.0)
0 Midori/0.1.7
webkit 532 Midori/0.1.5 (X11; Linux; U; en-gb) WebKit/532+
mozilla 1.0.1 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020919
mozilla 1.7.12 Mozilla/5.0 (Windows; U; Windows NT 5.0; it-IT; rv:1.7.12) Gecko/20050915
mozilla 1.4 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4; MultiZilla v1.5.0.0f) Gecko/20030624
mozilla 1.2.1 Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1; MultiZilla v1.1.32 final) Gecko/20021130
0 NCSA_Mosaic/2.0 (Windows 3.1)
0 NCSA_Mosaic/3.0 (Windows 95)
0 NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m)
0 NCSA_Mosaic/2.6 (X11; SunOS 4.1.3 sun4m)
0 Mozilla/3.01 (compatible; Netbox/3.5 R92; Linux 2.2)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; NetCaptor 7.5.4; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
msie 5.01 Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; NetCaptor 6.5.0RC1)
mozilla 1.7.5 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20060127 Netscape/8.1
mozilla 0 Mozilla/4.04 [en] (X11; I; IRIX 5.3 IP22)
mozilla 0.9.2 Mozilla/5.0 (Windows; U; Win 9x 4.90; de-DE; rv:0.9.2) Gecko/20010726 Netscape6/6.1
mozilla 1.8.1.12 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080219 Firefox/2.0.0.12 Navigator/9.0.0.6
mozilla 0 Mozilla/4.08 [en] (WinNT; U ;Nav)
mozilla 1.0.2 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02
mozilla 0 Mozilla/3.0 (Win95; I)
mozilla 0 Mozilla/4.51 [en] (Win98; U)
0 NetSurf/2.0 (RISC OS; armv3l)
0 NetSurf/1.2 (Linux; i686)
0 Mozilla/4.7 (compatible; OffByOne; Windows 2000)
0 Mozilla/4.7 (compatible; OffByOne; Windows 98)
0 Mozilla/4.5 (compatible; OmniWeb/4.1.1-v424.6; Mac_PowerPC)
0 OmniWeb/2.7-beta-3 OWF/1.0
webkit 420 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/420+ (KHTML, like Gecko, Safari) OmniWeb/v595
opera 6.0 Opera/6.0 (Windows 2000; U) [fr]
opera 7.10 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.10 [en]
opera 10.00 Opera/9.80 (Windows NT 5.1; U; cs) Presto/2.2.15 Version/10.00
opera 5.11 Opera/5.11 (Windows 98; U) [en]
opera 9.51 Opera/9.51 (Macintosh; Intel Mac OS X; U; en)
opera 6.01 Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 4.0) Opera 6.01 [en]
opera 9.02 Opera/9.02 (Windows XP; U; ru)
opera 5.12 Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 5.12 [en]
opera 9.70 Opera/9.70 (Linux i686 ; U; en) Presto/2.2.1
opera 7.03 Opera/7.03 (Windows NT 5.0; U) [en]
opera 9.24 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.24
mozilla 1.9.0.7 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009030821 Firefox/3.0.7 Orca/1.1 build 2
mozilla 1.9.0.6 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009022300 Firefox/3.0.6 Orca/1.1 build 1
0 Mozilla/1.10 [en] (Compatible; RISC OS 3.70; Oregano 1.10)
webkit 530.0 Mozilla/5.0 (compatible; Origyn Web Browser; AmigaOS 4.1; ppc; U; en) AppleWebKit/530.0+ (KHTML, like Gecko, Safari/530.0+)
webkit 531.0 Mozilla/5.0 (compatible; Origyn Web Browser; AmigaOS 4.0; U; en) AppleWebKit/531.0+ (KHTML, like Gecko, Safari/531.0+)
webkit 528.5 Mozilla/5.0 (compatible; Origyn Web Browser; MorphOS; PPC; U) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; PhaseOut-www.phaseout.net)
mozilla 1.4a Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4a) Gecko/20030411 Phoenix/0.5
mozilla 1.2b Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021029 Phoenix/0.4
webkit 527 Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/527+ (KHTML, like Gecko) QtWeb Internet Browser/2.5 http://www.QtWeb.net
webkit 527 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/527+ (KHTML, like Gecko) QtWeb Internet Browser/1.2 http://www.QtWeb.net
webkit 527 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/527+ (KHTML, like Gecko) QtWeb Internet Browser/1.7 http://www.QtWeb.net
webkit 527 Mozilla/5.0 (X11; U; Linux; cs-CZ) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) rekonq
0 retawq/0.2.6c [en] (text)
webkit 312.8 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.6
webkit 528.16 Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_6; it-it) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16
webkit 523.15 Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/523.15 (KHTML, like Gecko) Version/3.0 Safari/523.15
webkit 125.2 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.7
webkit 528.16 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16
webkit 420 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; fi-fi) AppleWebKit/420+ (KHTML, like Gecko) Safari/419.3
mozilla 1.8.1.13 Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9
mozilla 1.9.1a2pre Mozilla/5.0 (X11; U; Linux i686; rv:1.9.1a2pre) Gecko/20080824052448 SeaMonkey/2.0a1pre
mozilla 1.8.1.6 Mozilla/5.0 (Windows; U; Win 9x 4.90; en-GB; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4
mozilla 1.9.1b3pre Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1b3pre) Gecko/20081208 SeaMonkey/2.0a3pre
mozilla 1.9a1 Mozilla/5.0 (BeOS; U; BeOS BePC; en-US; rv:1.9a1) Gecko/20060702 SeaMonkey/1.5a
mozilla 1.9.1b3pre Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3pre) Gecko/20081202 SeaMonkey/2.0a2
webkit 419 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; ja-jp) AppleWebKit/419 (KHTML, like Gecko) Shiira/1.2.3 Safari/125
webkit 417.9 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/417.9 (KHTML, like Gecko, Safari) Shiira/1.1
webkit 418.9.1 Mozilla/5.0 (Macintosh; U; Intel Mac OS X; fr) AppleWebKit/418.9.1 (KHTML, like Gecko) Shiira Safari/125
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Sleipnir/2.8.1
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727) Sleipnir/2.8.4
webkit 525.27.1 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Stainless/0.4 Safari/525.20.1
webkit 528.16 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/528.16 (KHTML, like Gecko) Stainless/0.5.3 Safari/525.20.1
webkit 525.18 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Sunrise/1.7.4 like Safari/4525.22
webkit 125.5.7 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/125.5.7 (KHTML, like Gecko) SunriseBrowser/0.853
mozilla 1.9.0.10pre Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10pre) Gecko/2009041814 Firefox/3.0.10pre (Swiftfox)
msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; TheWorld)
webkit 1.1.8 Webkit/1.1.8 (Linux; en-us) Uzbl
webkit 1.1.10 Uzbl (X11; U; Linux x86_64; en-GB) AppleWebkit/1.1.10
webkit 1.1.9 Uzbl (Webkit 1.1.9) (Linux)
webkit 1.1.10 Uzbl (U; Linux x86_64; en-GB) Webkit 1.1.10
0 w3m/0.5.1
0 w3m/0.5.2
webkit 103u Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/103u (KHTML, like Gecko) wKiosk/100
mozilla 1.9.0.9 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.9) Gecko/2009042410 Firefox/3.0.9 Wyzo/3.0.3
0 X-Smiles/1.2-20081113
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; MEGAUPLOAD 2.0)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
mozilla 1.9.0.4 Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.4) Gecko/2008111217 Fedora/3.0.4-1.fc9 Firefox/3.0.4
mozilla 1.9.0.4 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; .NET CLR 1.1.4322; FDM)
msie 6.0 mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; mra 4.6 (build 01425); .net clr 2.0.50727)
msie 7.0 mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; mra 4.9 (build 01863))
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath?.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; MS-RTC LM 8; .NET CLR 1.1.4322)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; InfoPath?.2; .NET CLR 3.5.21022)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Sky Broadband; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; MS-RTC LM 8; .NET CLR 1.1.4322)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; InfoPath.2; .NET CLR 3.5.21022)
msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; http://bsalsa.com); .NET CLR 1.1.4322; .NET CLR 2.0.50727
opera 10.00 Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.00
msie 8.0 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; InfoPath?.2; .NET CLR 2.0.50727; CIBA; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
opera 10.00 Opera/9.80 (X11; Linux x86_64; U; de) Presto/2.2.15 Version/10.00
opera 10.50 Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.5.18 Version/10.50

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="../dist/jquery.min.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="../dist/jquery.min.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,330 @@
<!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" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>jQuery Test Suite</title>
<link rel="Stylesheet" media="screen" href="qunit/qunit/qunit.css" />
<link rel="Stylesheet" media="screen" href="data/testsuite.css" />
<!-- Includes -->
<!-- Allows us to fetch submodule tests when using a no-ajax build -->
<script src="data/jquery-1.8.2.ajax_xhr.min.js"></script>
<script src="data/testinit.js"></script>
<script src="qunit/qunit/qunit.js"></script>
<script>
(function() {
var src = "../dist/jquery.min.js";
// 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";
}
// Config parameter to force basic code paths
QUnit.config.urlConfig.push({
id: "basic",
label: "Bypass optimizations",
tooltip: "Force use of the most basic code by disabling native querySelectorAll; contains; compareDocumentPosition"
});
if ( QUnit.urlParams.basic ) {
document.querySelectorAll = null;
document.documentElement.contains = null;
document.documentElement.compareDocumentPosition = null;
}
// Load jQuery
document.write( "<script src='" + src + "'><\/script>" );
})();
</script>
<script src="data/testrunner.js"></script>
<script src="unit/core.js"></script>
<script src="unit/callbacks.js"></script>
<script src="unit/deferred.js"></script>
<script src="unit/support.js"></script>
<script src="unit/data.js"></script>
<script src="unit/queue.js"></script>
<script src="unit/attributes.js"></script>
<script src="unit/event.js"></script>
<script src="unit/selector.js"></script>
<script src="unit/traversing.js"></script>
<script src="unit/manipulation.js"></script>
<script src="unit/css.js"></script>
<script src="unit/serialize.js"></script>
<script src="unit/ajax.js"></script>
<script src="unit/effects.js"></script>
<script src="unit/offset.js"></script>
<script src="unit/dimensions.js"></script>
<script src="unit/deprecated.js"></script>
<script src="unit/exports.js"></script>
<!-- Subproject tests must be last because they replace our test fixture -->
<script>
testSubproject( "Sizzle", "../src/sizzle/test/", /^unit\/.*\.js$/ );
</script>
<script>
// html5shiv, enabling HTML5 elements to be used with jQuery
( "abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup " +
"mark meter nav output progress section summary time video"
).replace(/\w+/g, function(n) {
document.createElement(n);
});
</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="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>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>
</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,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="../dist/jquery.min.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="../dist/jquery.min.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 occured.
</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,110 @@
<?php
$baseURL = "http://ajax.googleapis.com/ajax/libs/";
$libraries = array(
"Dojo" => array(
"versions" => array( "1.1.1", "1.2.0", "1.2.3", "1.3.0", "1.3.1", "1.3.2", "1.4.0", "1.4.1", "1.4.3", "1.5.0" ),
"url" => "dojo/XYZ/dojo/dojo.xd.js"
),
"ExtCore" => array(
"versions" => array( "3.0.0", "3.1.0" ),
"url" => "ext-core/XYZ/ext-core.js"
),
"jQuery" => array(
"versions" => array( "1.2.3", "1.2.6", "1.3.0", "1.3.1", "1.3.2", "1.4.0", "1.4.1", "1.4.2", "1.4.3", "1.4.4", "1.5.0" ),
"url" => "jquery/XYZ/jquery.min.js"
),
"jQueryUI" => array(
"versions" => array( "1.5.2", "1.5.3", "1.6.0", "1.7.0", "1.7.1", "1.7.2", "1.7.3", "1.8.0", "1.8.1", "1.8.2", "1.8.4", "1.8.5", "1.8.6", "1.8.7", "1.8.8", "1.8.9" ),
"url" => "jqueryui/XYZ/jquery-ui.min.js"
),
"MooTools" => array(
"versions" => array( "1.1.1", "1.1.2", "1.2.1", "1.2.2", "1.2.3", "1.2.4", "1.2.5", "1.3.0" ),
"url" => "mootools/XYZ/mootools-yui-compressed.js"
),
"Prototype" => array(
"versions" => array( "1.6.0.2", "1.6.0.3", "1.6.1.0", "1.7.0.0" ),
"url" => "prototype/XYZ/prototype.js"
),
"scriptaculous" => array(
"versions" => array( "1.8.1", "1.8.2", "1.8.3" ),
"url" => "scriptaculous/XYZ/scriptaculous.js"
),
"SWFObject" => array(
"versions" => array( "2.1", "2.2" ),
"url" => "swfobject/XYZ/swfobject.js"
),
"YUI" => array(
"versions" => array( "2.6.0", "2.7.0", "2.8.0r4", "2.8.1", "2.8.2", "3.3.0" ),
"url" => "yui/XYZ/build/yui/yui-min.js"
)
);
if( count($_POST) ) {
$includes = array();
foreach( $_POST as $name => $ver ){
if ( empty( $libraries[ $name ] )) {
echo "unsupported library ". $name;
exit;
}
$url = $libraries[ $name ][ "url" ];
if( $name == "YUI" && $ver[0] == "2" ) {
$url = str_replace( "/yui", "/yuiloader", $url);
}
if ( empty( $libraries[ $name ][ "versions" ][ $ver ] )) {
echo "library ". $name ." not supported in version ". $ver;
exit;
}
$include = "<script src='$baseURL".str_replace("XYZ", $ver, $url)."'></script>\n";
if( $lib == "prototype" ) { // prototype must be included first
array_unshift( $includes, $include );
} else {
array_push( $includes, $include );
}
}
$includes = implode( "\n", $includes );
$suite = file_get_contents( "index.html" );
echo str_replace( "<!-- Includes -->", $includes, $suite );
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Run jQuery Test Suite Polluted</title>
<style type="text/css">
.otherlibs fieldset {
width: 400px
}
.otherlibs label{
margin: 5px 0px 5px 20px;
}
</style>
</head>
<body id="body">
<h1 id="header">jQuery Test Suite</h1>
<h2 id="banner" class="fail"></h2>
<h2 id="userAgent">Choose other libraries to include</h2>
<form class="otherlibs" action="./polluted.php" method="POST">
<?php
foreach( $libraries as $name => $data ) {
echo "<fieldset><legend>$name</legend>";
$i = 0;
foreach( $data[ "versions" ] as $ver ) {
$i++;
echo "<label><input type='radio' name='$name' value='$ver' />$ver</label>";
if( !($i % 4) ) echo "<br />";
}
echo "</fieldset>";
}
?>
<input type="submit" value=" Run " class="submit" />
</form>
</body>
</html>

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="../dist/jquery.min.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,326 @@
module( "callbacks", {
teardown: moduleTeardown
});
(function() {
var output,
addToOutput = function( string ) {
return function() {
output += string;
};
},
outputA = addToOutput("A"),
outputB = addToOutput("B"),
outputC = addToOutput("C"),
tests = {
"": "XABC X XABCABCC X XBB X XABA X XX",
"once": "XABC X X X X X XABA X XX",
"memory": "XABC XABC XABCABCCC XA XBB XB XABA XC XX",
"unique": "XABC X XABCA X XBB X XAB X X",
"stopOnFalse": "XABC X XABCABCC X XBB X XA X XX",
"once memory": "XABC XABC X XA X XA XABA XC XX",
"once unique": "XABC X X X X X XAB X X",
"once stopOnFalse": "XABC X X X X X XA X XX",
"memory unique": "XABC XA XABCA XA XBB XB XAB XC X",
"memory stopOnFalse": "XABC XABC XABCABCCC XA XBB XB XA X XX",
"unique stopOnFalse": "XABC X XABCA X XBB X XA X X"
},
filters = {
"no filter": undefined,
"filter": function( fn ) {
return function() {
return fn.apply( this, arguments );
};
}
};
function showFlags( flags ) {
if ( typeof flags === "string" ) {
return "'" + flags + "'";
}
var output = [], key;
for ( key in flags ) {
output.push( "'" + key + "': " + flags[ key ] );
}
return "{ " + output.join( ", " ) + " }";
}
jQuery.each( tests, function( strFlags, resultString ) {
var objectFlags = {};
jQuery.each( strFlags.split( " " ), function() {
if ( this.length ) {
objectFlags[ this ] = true;
}
});
jQuery.each( filters, function( filterLabel, filter ) {
jQuery.each({
"string": strFlags,
"object": objectFlags
}, function( flagsTypes, flags ) {
test( "jQuery.Callbacks( " + showFlags( flags ) + " ) - " + filterLabel, function() {
expect( 21 );
// Give qunit a little breathing room
stop();
setTimeout( start, 0 );
var cblist,
results = resultString.split( /\s+/ );
// Basic binding and firing
output = "X";
cblist = jQuery.Callbacks( flags );
cblist.add(function( str ) {
output += str;
});
cblist.fire("A");
strictEqual( output, "XA", "Basic binding and firing" );
strictEqual( cblist.fired(), true, ".fired() detects firing" );
output = "X";
cblist.disable();
cblist.add(function( str ) {
output += str;
});
strictEqual( output, "X", "Adding a callback after disabling" );
cblist.fire("A");
strictEqual( output, "X", "Firing after disabling" );
// Basic binding and firing (context, arguments)
output = "X";
cblist = jQuery.Callbacks( flags );
cblist.add(function() {
equal( this, window, "Basic binding and firing (context)" );
output += Array.prototype.join.call( arguments, "" );
});
cblist.fireWith( window, [ "A", "B" ] );
strictEqual( output, "XAB", "Basic binding and firing (arguments)" );
// fireWith with no arguments
output = "";
cblist = jQuery.Callbacks( flags );
cblist.add(function() {
equal( this, window, "fireWith with no arguments (context is window)" );
strictEqual( arguments.length, 0, "fireWith with no arguments (no arguments)" );
});
cblist.fireWith();
// Basic binding, removing and firing
output = "X";
cblist = jQuery.Callbacks( flags );
cblist.add( outputA, outputB, outputC );
cblist.remove( outputB, outputC );
cblist.fire();
strictEqual( output, "XA", "Basic binding, removing and firing" );
// Empty
output = "X";
cblist = jQuery.Callbacks( flags );
cblist.add( outputA );
cblist.add( outputB );
cblist.add( outputC );
cblist.empty();
cblist.fire();
strictEqual( output, "X", "Empty" );
// Locking
output = "X";
cblist = jQuery.Callbacks( flags );
cblist.add(function( str ) {
output += str;
});
cblist.lock();
cblist.add(function( str ) {
output += str;
});
cblist.fire("A");
cblist.add(function( str ) {
output += str;
});
strictEqual( output, "X", "Lock early" );
// Ordering
output = "X";
cblist = jQuery.Callbacks( flags );
cblist.add(function() {
cblist.add( outputC );
outputA();
}, outputB );
cblist.fire();
strictEqual( output, results.shift(), "Proper ordering" );
// Add and fire again
output = "X";
cblist.add(function() {
cblist.add( outputC );
outputA();
}, outputB );
strictEqual( output, results.shift(), "Add after fire" );
output = "X";
cblist.fire();
strictEqual( output, results.shift(), "Fire again" );
// Multiple fire
output = "X";
cblist = jQuery.Callbacks( flags );
cblist.add(function( str ) {
output += str;
});
cblist.fire("A");
strictEqual( output, "XA", "Multiple fire (first fire)" );
output = "X";
cblist.add(function( str ) {
output += str;
});
strictEqual( output, results.shift(), "Multiple fire (first new callback)" );
output = "X";
cblist.fire("B");
strictEqual( output, results.shift(), "Multiple fire (second fire)" );
output = "X";
cblist.add(function( str ) {
output += str;
});
strictEqual( output, results.shift(), "Multiple fire (second new callback)" );
// Return false
output = "X";
cblist = jQuery.Callbacks( flags );
cblist.add( outputA, function() { return false; }, outputB );
cblist.add( outputA );
cblist.fire();
strictEqual( output, results.shift(), "Callback returning false" );
// Add another callback (to control lists with memory do not fire anymore)
output = "X";
cblist.add( outputC );
strictEqual( output, results.shift(), "Adding a callback after one returned false" );
// Callbacks are not iterated
output = "";
function handler( tmp ) {
output += "X";
}
handler.method = function() {
output += "!";
};
cblist = jQuery.Callbacks( flags );
cblist.add( handler );
cblist.add( handler );
cblist.fire();
strictEqual( output, results.shift(), "No callback iteration" );
});
});
});
});
})();
test( "jQuery.Callbacks( options ) - options are copied", function() {
expect( 1 );
var options = {
"unique": true
},
cb = jQuery.Callbacks( options ),
count = 0,
fn = function() {
ok( !( count++ ), "called once" );
};
options["unique"] = false;
cb.add( fn, fn );
cb.fire();
});
test( "jQuery.Callbacks.fireWith - arguments are copied", function() {
expect( 1 );
var cb = jQuery.Callbacks("memory"),
args = ["hello"];
cb.fireWith( null, args );
args[ 0 ] = "world";
cb.add(function( hello ) {
strictEqual( hello, "hello", "arguments are copied internally" );
});
});
test( "jQuery.Callbacks.remove - should remove all instances", function() {
expect( 1 );
var cb = jQuery.Callbacks();
function fn() {
ok( false, "function wasn't removed" );
}
cb.add( fn, fn, function() {
ok( true, "end of test" );
}).remove( fn ).fire();
});
test( "jQuery.Callbacks.has", function() {
expect( 13 );
var cb = jQuery.Callbacks();
function getA() {
return "A";
}
function getB() {
return "B";
}
function getC() {
return "C";
}
cb.add(getA, getB, getC);
strictEqual( cb.has(), true, "No arguments to .has() returns whether callback function(s) are attached or not" );
strictEqual( cb.has(getA), true, "Check if a specific callback function is in the Callbacks list" );
cb.remove(getB);
strictEqual( cb.has(getB), false, "Remove a specific callback function and make sure its no longer there" );
strictEqual( cb.has(getA), true, "Remove a specific callback function and make sure other callback function is still there" );
cb.empty();
strictEqual( cb.has(), false, "Empty list and make sure there are no callback function(s)" );
strictEqual( cb.has(getA), false, "Check for a specific function in an empty() list" );
cb.add(getA, getB, function(){
strictEqual( cb.has(), true, "Check if list has callback function(s) from within a callback function" );
strictEqual( cb.has(getA), true, "Check if list has a specific callback from within a callback function" );
}).fire();
strictEqual( cb.has(), true, "Callbacks list has callback function(s) after firing" );
cb.disable();
strictEqual( cb.has(), false, "disabled() list has no callback functions (returns false)" );
strictEqual( cb.has(getA), false, "Check for a specific function in a disabled() list" );
cb = jQuery.Callbacks("unique");
cb.add(getA);
cb.add(getA);
strictEqual( cb.has(), true, "Check if unique list has callback function(s) attached" );
cb.lock();
strictEqual( cb.has(), false, "locked() list is empty and returns false" );
});
test( "jQuery.Callbacks() - adding a string doesn't cause a stack overflow", function() {
expect( 1 );
jQuery.Callbacks().add( "hello world" );
ok( true, "no stack overflow" );
});

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,636 @@
module("data", { teardown: moduleTeardown });
test("expando", function(){
expect(1);
equal(jQuery.expando !== undefined, true, "jQuery is exposing the expando");
});
function dataTests (elem) {
var oldCacheLength, dataObj, internalDataObj, expected, actual;
equal( jQuery.data(elem, "foo"), undefined, "No data exists initially" );
strictEqual( jQuery.hasData(elem), false, "jQuery.hasData agrees no data exists initially" );
dataObj = jQuery.data(elem);
equal( typeof dataObj, "object", "Calling data with no args gives us a data object reference" );
strictEqual( jQuery.data(elem), dataObj, "Calling jQuery.data returns the same data object when called multiple times" );
strictEqual( jQuery.hasData(elem), false, "jQuery.hasData agrees no data exists even when an empty data obj exists" );
dataObj["foo"] = "bar";
equal( jQuery.data(elem, "foo"), "bar", "Data is readable by jQuery.data when set directly on a returned data object" );
strictEqual( jQuery.hasData(elem), true, "jQuery.hasData agrees data exists when data exists" );
jQuery.data(elem, "foo", "baz");
equal( jQuery.data(elem, "foo"), "baz", "Data can be changed by jQuery.data" );
equal( dataObj["foo"], "baz", "Changes made through jQuery.data propagate to referenced data object" );
jQuery.data(elem, "foo", undefined);
equal( jQuery.data(elem, "foo"), "baz", "Data is not unset by passing undefined to jQuery.data" );
jQuery.data(elem, "foo", null);
strictEqual( jQuery.data(elem, "foo"), null, "Setting null using jQuery.data works OK" );
jQuery.data(elem, "foo", "foo1");
jQuery.data(elem, { "bar" : "baz", "boom" : "bloz" });
strictEqual( jQuery.data(elem, "foo"), "foo1", "Passing an object extends the data object instead of replacing it" );
equal( jQuery.data(elem, "boom"), "bloz", "Extending the data object works" );
jQuery._data(elem, "foo", "foo2", true);
equal( jQuery._data(elem, "foo"), "foo2", "Setting internal data works" );
equal( jQuery.data(elem, "foo"), "foo1", "Setting internal data does not override user data" );
internalDataObj = jQuery._data( elem );
ok( internalDataObj, "Internal data object exists" );
notStrictEqual( dataObj, internalDataObj, "Internal data object is not the same as user data object" );
strictEqual( elem.boom, undefined, "Data is never stored directly on the object" );
jQuery.removeData(elem, "foo");
strictEqual( jQuery.data(elem, "foo"), undefined, "jQuery.removeData removes single properties" );
jQuery.removeData(elem);
strictEqual( jQuery._data(elem), internalDataObj, "jQuery.removeData does not remove internal data if it exists" );
jQuery.data(elem, "foo", "foo1");
jQuery._data(elem, "foo", "foo2");
equal( jQuery.data(elem, "foo"), "foo1", "(sanity check) Ensure data is set in user data object" );
equal( jQuery._data(elem, "foo"), "foo2", "(sanity check) Ensure data is set in internal data object" );
strictEqual( jQuery._data(elem, jQuery.expando), undefined, "Removing the last item in internal data destroys the internal data object" );
jQuery._data(elem, "foo", "foo2");
equal( jQuery._data(elem, "foo"), "foo2", "(sanity check) Ensure data is set in internal data object" );
jQuery.removeData(elem, "foo");
equal( jQuery._data(elem, "foo"), "foo2", "(sanity check) jQuery.removeData for user data does not remove internal data" );
}
test("jQuery.data(div)", 25, function() {
var div = document.createElement("div");
dataTests(div);
// We stored one key in the private data
// assert that nothing else was put in there, and that that
// one stayed there.
QUnit.expectJqData(div, "foo");
});
test("jQuery.data({})", 25, function() {
dataTests({});
});
test("jQuery.data(window)", 25, function() {
// remove bound handlers from window object to stop potential false positives caused by fix for #5280 in
// transports/xhr.js
jQuery(window).unbind("unload");
dataTests(window);
});
test("jQuery.data(document)", 25, function() {
dataTests(document);
QUnit.expectJqData(document, "foo");
});
test("Expando cleanup", 4, function() {
var expected, actual,
div = document.createElement("div");
function assertExpandoAbsent(message) {
if (jQuery.support.deleteExpando) {
expected = false;
actual = jQuery.expando in div;
} else {
expected = null;
actual = div[ jQuery.expando ];
}
equal( actual, expected, message );
}
assertExpandoAbsent("There is no expando on new elements");
jQuery.data(div, "foo", 100);
jQuery.data(div, "bar", 200);
ok(jQuery.expando in div, "There is an expando on the element after using $.data()");
jQuery.removeData(div, "foo");
ok(jQuery.expando in div, "There is still an expando on the element after removing (some) of the data");
jQuery.removeData(div, "bar");
assertExpandoAbsent("Removing the last item in the data store deletes the expando");
// Clean up unattached element
jQuery(div).remove();
});
test("Data is not being set on comment and text nodes", function() {
expect(2);
ok( !jQuery.hasData( jQuery("<!-- comment -->").data("foo", 0) ) );
ok( !jQuery.hasData( jQuery("<span>text</span>").contents().data("foo", 0) ) );
});
test("jQuery.acceptData", function() {
expect(9);
ok( jQuery.acceptData( document ), "document" );
ok( jQuery.acceptData( document.documentElement ), "documentElement" );
ok( jQuery.acceptData( {} ), "object" );
ok( !jQuery.acceptData( document.createElement("embed") ), "embed" );
ok( !jQuery.acceptData( document.createElement("applet") ), "applet" );
var flash = document.createElement("object");
flash.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
ok( jQuery.acceptData( flash ), "flash" );
var applet = document.createElement("object");
applet.setAttribute("classid", "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
ok( !jQuery.acceptData( applet ), "applet" );
ok( !jQuery.acceptData( document.createComment("") ), "comment" );
ok( !jQuery.acceptData( document.createTextNode("") ), "text" );
});
test(".data()", function() {
expect(5);
var div = jQuery("#foo");
strictEqual( div.data("foo"), undefined, "Make sure that missing result is undefined" );
div.data("test", "success");
var dataObj = div.data();
deepEqual( dataObj, {test: "success"}, "data() returns entire data object with expected properties" );
strictEqual( div.data("foo"), undefined, "Make sure that missing result is still undefined" );
var nodiv = jQuery("#unfound");
equal( nodiv.data(), null, "data() on empty set returns null" );
var obj = { foo: "bar" };
jQuery(obj).data("foo", "baz");
dataObj = jQuery.extend(true, {}, jQuery(obj).data());
deepEqual( dataObj, { "foo": "baz" }, "Retrieve data object from a wrapped JS object (#7524)" );
});
var testDataTypes = function( $obj ) {
jQuery.each({
"null": null,
"true": true,
"false": false,
"zero": 0,
"one": 1,
"empty string": "",
"empty array": [],
"array": [1],
"empty object": {},
"object": { foo: "bar" },
"date": new Date(),
"regex": /test/,
"function": function() {}
}, function( type, value ) {
strictEqual( $obj.data( "test", value ).data("test"), value, "Data set to " + type );
});
};
test("jQuery(Element).data(String, Object).data(String)", function() {
expect( 18 );
var parent = jQuery("<div><div></div></div>"),
div = parent.children();
strictEqual( div.data("test"), undefined, "No data exists initially" );
strictEqual( div.data("test", "success").data("test"), "success", "Data added" );
strictEqual( div.data("test", "overwritten").data("test"), "overwritten", "Data overwritten" );
strictEqual( div.data("test", undefined).data("test"), "overwritten", ".data(key,undefined) does nothing but is chainable (#5571)");
strictEqual( div.data("notexist"), undefined, "No data exists for unset key" );
testDataTypes( div );
parent.remove();
});
test("jQuery(plain Object).data(String, Object).data(String)", function() {
expect( 16 );
// #3748
var $obj = jQuery({ exists: true });
strictEqual( $obj.data("nothing"), undefined, "Non-existent data returns undefined");
strictEqual( $obj.data("exists"), undefined, "Object properties are not returned as data" );
testDataTypes( $obj );
// Clean up
$obj.removeData();
deepEqual( $obj[0], { exists: true }, "removeData does not clear the object" );
});
test("data-* attributes", function() {
expect(40);
var div = jQuery("<div>"),
child = jQuery("<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>"),
dummy = jQuery("<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>");
equal( div.data("attr"), undefined, "Check for non-existing data-attr attribute" );
div.attr("data-attr", "exists");
equal( div.data("attr"), "exists", "Check for existing data-attr attribute" );
div.attr("data-attr", "exists2");
equal( div.data("attr"), "exists", "Check that updates to data- don't update .data()" );
div.data("attr", "internal").attr("data-attr", "external");
equal( div.data("attr"), "internal", "Check for .data('attr') precedence (internal > external data-* attribute)" );
div.remove();
child.appendTo("#qunit-fixture");
equal( child.data("myobj"), "old data", "Value accessed from data-* attribute");
child.data("myobj", "replaced");
equal( child.data("myobj"), "replaced", "Original data overwritten");
child.data("ignored", "cache");
equal( child.data("ignored"), "cache", "Cached data used before DOM data-* fallback");
var prop,
obj = child.data(),
obj2 = dummy.data(),
check = [ "myobj", "ignored", "other" ],
num = 0,
num2 = 0;
dummy.remove();
for ( var i = 0, l = check.length; i < l; i++ ) {
ok( obj[ check[i] ], "Make sure data- property exists when calling data-." );
ok( obj2[ check[i] ], "Make sure data- property exists when calling data-." );
}
for ( prop in obj ) {
num++;
}
equal( num, check.length, "Make sure that the right number of properties came through." );
for ( prop in obj2 ) {
num2++;
}
equal( num2, check.length, "Make sure that the right number of properties came through." );
child.attr("data-other", "newvalue");
equal( child.data("other"), "test", "Make sure value was pulled in properly from a .data()." );
child
.attr("data-true", "true")
.attr("data-false", "false")
.attr("data-five", "5")
.attr("data-point", "5.5")
.attr("data-pointe", "5.5E3")
.attr("data-grande", "5.574E9")
.attr("data-hexadecimal", "0x42")
.attr("data-pointbad", "5..5")
.attr("data-pointbad2", "-.")
.attr("data-bigassnum", "123456789123456789123456789")
.attr("data-badjson", "{123}")
.attr("data-badjson2", "[abc]")
.attr("data-empty", "")
.attr("data-space", " ")
.attr("data-null", "null")
.attr("data-string", "test");
strictEqual( child.data("true"), true, "Primitive true read from attribute");
strictEqual( child.data("false"), false, "Primitive false read from attribute");
strictEqual( child.data("five"), 5, "Primitive number read from attribute");
strictEqual( child.data("point"), 5.5, "Primitive number read from attribute");
strictEqual( child.data("pointe"), "5.5E3", "Floating point exponential number read from attribute");
strictEqual( child.data("grande"), "5.574E9", "Big exponential number read from attribute");
strictEqual( child.data("hexadecimal"), "0x42", "Hexadecimal number read from attribute");
strictEqual( child.data("pointbad"), "5..5", "Bad number read from attribute");
strictEqual( child.data("pointbad2"), "-.", "Bad number read from attribute");
strictEqual( child.data("bigassnum"), "123456789123456789123456789", "Bad bigass number read from attribute");
strictEqual( child.data("badjson"), "{123}", "Bad number read from attribute");
strictEqual( child.data("badjson2"), "[abc]", "Bad number read from attribute");
strictEqual( child.data("empty"), "", "Empty string read from attribute");
strictEqual( child.data("space"), " ", "Empty string read from attribute");
strictEqual( child.data("null"), null, "Primitive null read from attribute");
strictEqual( child.data("string"), "test", "Typical string read from attribute");
child.remove();
// tests from metadata plugin
function testData(index, elem) {
switch (index) {
case 0:
equal(jQuery(elem).data("foo"), "bar", "Check foo property");
equal(jQuery(elem).data("bar"), "baz", "Check baz property");
break;
case 1:
equal(jQuery(elem).data("test"), "bar", "Check test property");
equal(jQuery(elem).data("bar"), "baz", "Check bar property");
break;
case 2:
equal(jQuery(elem).data("zoooo"), "bar", "Check zoooo property");
deepEqual(jQuery(elem).data("bar"), {"test":"baz"}, "Check bar property");
break;
case 3:
equal(jQuery(elem).data("number"), true, "Check number property");
deepEqual(jQuery(elem).data("stuff"), [2,8], "Check stuff property");
break;
default:
ok(false, ["Assertion failed on index ", index, ", with data"].join(""));
}
}
var metadata = "<ol><li class='test test2' data-foo='bar' data-bar='baz' data-arr='[1,2]'>Some stuff</li><li class='test test2' data-test='bar' data-bar='baz'>Some stuff</li><li class='test test2' data-zoooo='bar' data-bar='{\"test\":\"baz\"}'>Some stuff</li><li class='test test2' data-number=true data-stuff='[2,8]'>Some stuff</li></ol>",
elem = jQuery(metadata).appendTo("#qunit-fixture");
elem.find("li").each(testData);
elem.remove();
});
test(".data(Object)", function() {
expect(4);
var div = jQuery("<div/>");
div.data({ "test": "in", "test2": "in2" });
equal( div.data("test"), "in", "Verify setting an object in data" );
equal( div.data("test2"), "in2", "Verify setting an object in data" );
var obj = {test:"unset"},
jqobj = jQuery(obj);
jqobj.data("test", "unset");
jqobj.data({ "test": "in", "test2": "in2" });
equal( jQuery.data(obj)["test"], "in", "Verify setting an object on an object extends the data object" );
equal( obj["test2"], undefined, "Verify setting an object on an object does not extend the object" );
// manually clean up detached elements
div.remove();
});
test("jQuery.removeData", function() {
expect(10);
var div = jQuery("#foo")[0];
jQuery.data(div, "test", "testing");
jQuery.removeData(div, "test");
equal( jQuery.data(div, "test"), undefined, "Check removal of data" );
jQuery.data(div, "test2", "testing");
jQuery.removeData( div );
ok( !jQuery.data(div, "test2"), "Make sure that the data property no longer exists." );
ok( !div[ jQuery.expando ], "Make sure the expando no longer exists, as well." );
jQuery.data(div, {
test3: "testing",
test4: "testing"
});
jQuery.removeData( div, "test3 test4" );
ok( !jQuery.data(div, "test3") || jQuery.data(div, "test4"), "Multiple delete with spaces." );
jQuery.data(div, {
test3: "testing",
test4: "testing"
});
jQuery.removeData( div, [ "test3", "test4" ] );
ok( !jQuery.data(div, "test3") || jQuery.data(div, "test4"), "Multiple delete by array." );
jQuery.data(div, {
"test3 test4": "testing",
"test3": "testing"
});
jQuery.removeData( div, "test3 test4" );
ok( !jQuery.data(div, "test3 test4"), "Multiple delete with spaces deleted key with exact name" );
ok( jQuery.data(div, "test3"), "Left the partial matched key alone" );
var obj = {};
jQuery.data(obj, "test", "testing");
equal( jQuery(obj).data("test"), "testing", "verify data on plain object");
jQuery.removeData(obj, "test");
equal( jQuery.data(obj, "test"), undefined, "Check removal of data on plain object" );
jQuery.data( window, "BAD", true );
jQuery.removeData( window, "BAD" );
ok( !jQuery.data( window, "BAD" ), "Make sure that the value was not still set." );
});
test(".removeData()", function() {
expect(6);
var div = jQuery("#foo");
div.data("test", "testing");
div.removeData("test");
equal( div.data("test"), undefined, "Check removal of data" );
div.data("test", "testing");
div.data("test.foo", "testing2");
div.removeData("test.bar");
equal( div.data("test.foo"), "testing2", "Make sure data is intact" );
equal( div.data("test"), "testing", "Make sure data is intact" );
div.removeData("test");
equal( div.data("test.foo"), "testing2", "Make sure data is intact" );
equal( div.data("test"), undefined, "Make sure data is intact" );
div.removeData("test.foo");
equal( div.data("test.foo"), undefined, "Make sure data is intact" );
});
if (window.JSON && window.JSON.stringify) {
test("JSON serialization (#8108)", function () {
expect(1);
var obj = { "foo": "bar" };
jQuery.data(obj, "hidden", true);
equal( JSON.stringify(obj), "{\"foo\":\"bar\"}", "Expando is hidden from JSON.stringify" );
});
}
test("jQuery.data should follow html5 specification regarding camel casing", function() {
expect(10);
var div = jQuery("<div id='myObject' data-w-t-f='ftw' data-big-a-little-a='bouncing-b' data-foo='a' data-foo-bar='b' data-foo-bar-baz='c'></div>")
.prependTo("body");
equal( div.data()["wTF"], "ftw", "Verify single letter data-* key" );
equal( div.data()["bigALittleA"], "bouncing-b", "Verify single letter mixed data-* key" );
equal( div.data()["foo"], "a", "Verify single word data-* key" );
equal( div.data()["fooBar"], "b", "Verify multiple word data-* key" );
equal( div.data()["fooBarBaz"], "c", "Verify multiple word data-* key" );
equal( div.data("foo"), "a", "Verify single word data-* key" );
equal( div.data("fooBar"), "b", "Verify multiple word data-* key" );
equal( div.data("fooBarBaz"), "c", "Verify multiple word data-* key" );
div.data("foo-bar", "d");
equal( div.data("fooBar"), "d", "Verify updated data-* key" );
equal( div.data("foo-bar"), "d", "Verify updated data-* key" );
div.remove();
});
test("jQuery.data should not miss data with preset hyphenated property names", function() {
expect(2);
var div = jQuery("<div/>", { id: "hyphened" }).appendTo("#qunit-fixture"),
test = {
"camelBar": "camelBar",
"hyphen-foo": "hyphen-foo"
};
div.data( test );
jQuery.each( test , function(i, k) {
equal( div.data(k), k, "data with property '"+k+"' was correctly found");
});
});
test("jQuery.data supports interoperable hyphenated/camelCase get/set of properties with arbitrary non-null|NaN|undefined values", function() {
var div = jQuery("<div/>", { id: "hyphened" }).appendTo("#qunit-fixture"),
datas = {
"non-empty": "a string",
"empty-string": "",
"one-value": 1,
"zero-value": 0,
"an-array": [],
"an-object": {},
"bool-true": true,
"bool-false": false,
// JSHint enforces double quotes,
// but JSON strings need double quotes to parse
// so we need escaped double quotes here
"some-json": "{ \"foo\": \"bar\" }",
"num-1-middle": true,
"num-end-2": true,
"2-num-start": true
};
expect( 24 );
jQuery.each( datas, function( key, val ) {
div.data( key, val );
deepEqual( div.data( key ), val, "get: " + key );
deepEqual( div.data( jQuery.camelCase( key ) ), val, "get: " + jQuery.camelCase( key ) );
});
});
test("jQuery.data supports interoperable removal of hyphenated/camelCase properties", function() {
var div = jQuery("<div/>", { id: "hyphened" }).appendTo("#qunit-fixture"),
datas = {
"non-empty": "a string",
"empty-string": "",
"one-value": 1,
"zero-value": 0,
"an-array": [],
"an-object": {},
"bool-true": true,
"bool-false": false,
// JSHint enforces double quotes,
// but JSON strings need double quotes to parse
// so we need escaped double quotes here
"some-json": "{ \"foo\": \"bar\" }"
};
expect( 27 );
jQuery.each( datas, function( key, val ) {
div.data( key, val );
deepEqual( div.data( key ), val, "get: " + key );
deepEqual( div.data( jQuery.camelCase( key ) ), val, "get: " + jQuery.camelCase( key ) );
div.removeData( key );
equal( div.data( key ), undefined, "get: " + key );
});
});
test( "jQuery.fn.removeData supports removal of hyphenated properties via array (#12786)", function( assert ) {
expect( 4 );
var div, plain, compare;
div = jQuery("<div>").appendTo("#qunit-fixture");
plain = jQuery({});
// When data is batch assigned (via plain object), the properties
// are not camel cased as they are with (property, value) calls
compare = {
// From batch assignment .data({ "a-a": 1 })
"a-a": 1,
// From property, value assignment .data( "b-b", 1 )
"bB": 1
};
// Mixed assignment
div.data({ "a-a": 1 }).data( "b-b", 1 );
plain.data({ "a-a": 1 }).data( "b-b", 1 );
deepEqual( div.data(), compare, "Data appears as expected. (div)" );
deepEqual( plain.data(), compare, "Data appears as expected. (plain)" );
div.removeData([ "a-a", "b-b" ]);
plain.removeData([ "a-a", "b-b" ]);
// NOTE: Timo's proposal for "propEqual" (or similar) would be nice here
deepEqual( div.data(), {}, "Data is empty. (div)" );
deepEqual( plain.data(), {}, "Data is empty. (plain)" );
});
// Test originally by Moschel
test("Triggering the removeData should not throw exceptions. (#10080)", function() {
expect(1);
stop();
var frame = jQuery("#loadediframe");
jQuery(frame[0].contentWindow).bind("unload", function() {
ok(true, "called unload");
start();
});
// change the url to trigger unload
frame.attr("src", "data/iframe.html?param=true");
});
test( "Only check element attributes once when calling .data() - #8909", function() {
expect( 2 );
var testing = {
"test": "testing",
"test2": "testing"
},
element = jQuery( "<div data-test='testing'>" ),
node = element[ 0 ];
// set an attribute using attr to ensure it
node.setAttribute( "data-test2", "testing" );
deepEqual( element.data(), testing, "Sanity Check" );
node.setAttribute( "data-test3", "testing" );
deepEqual( element.data(), testing, "The data didn't change even though the data-* attrs did" );
// clean up data cache
element.remove();
});
test( "JSON data- attributes can have newlines", function() {
expect(1);
var x = jQuery("<div data-some='{\n\"foo\":\n\t\"bar\"\n}'></div>");
equal( x.data("some").foo, "bar", "got a JSON data- attribute with spaces" );
x.remove();
});

View File

@@ -0,0 +1,440 @@
module( "deferred", {
teardown: moduleTeardown
});
jQuery.each( [ "", " - new operator" ], function( _, withNew ) {
function createDeferred( fn ) {
return withNew ? new jQuery.Deferred( fn ) : jQuery.Deferred( fn );
}
test( "jQuery.Deferred" + withNew, function() {
expect( 23 );
var defer = createDeferred();
strictEqual( defer.pipe, defer.then, "pipe is an alias of then" );
createDeferred().resolve().done(function() {
ok( true, "Success on resolve" );
strictEqual( this.state(), "resolved", "Deferred is resolved (state)" );
}).fail(function() {
ok( false, "Error on resolve" );
}).always(function() {
ok( true, "Always callback on resolve" );
});
createDeferred().reject().done(function() {
ok( false, "Success on reject" );
}).fail(function() {
ok( true, "Error on reject" );
strictEqual( this.state(), "rejected", "Deferred is rejected (state)" );
}).always(function() {
ok( true, "Always callback on reject" );
});
createDeferred(function( defer ) {
ok( this === defer, "Defer passed as this & first argument" );
this.resolve("done");
}).done(function( value ) {
strictEqual( value, "done", "Passed function executed" );
});
createDeferred(function( defer ) {
var promise = defer.promise(),
func = function() {},
funcPromise = defer.promise( func );
strictEqual( defer.promise(), promise, "promise is always the same" );
strictEqual( funcPromise, func, "non objects get extended" );
jQuery.each( promise, function( key, value ) {
if ( !jQuery.isFunction( promise[ key ] ) ) {
ok( false, key + " is a function (" + jQuery.type( promise[ key ] ) + ")" );
}
if ( promise[ key ] !== func[ key ] ) {
strictEqual( func[ key ], promise[ key ], key + " is the same" );
}
});
});
jQuery.expandedEach = jQuery.each;
jQuery.expandedEach( "resolve reject".split(" "), function( _, change ) {
createDeferred(function( defer ) {
strictEqual( defer.state(), "pending", "pending after creation" );
var checked = 0;
defer.progress(function( value ) {
strictEqual( value, checked, "Progress: right value (" + value + ") received" );
});
for ( checked = 0; checked < 3; checked++ ) {
defer.notify( checked );
}
strictEqual( defer.state(), "pending", "pending after notification" );
defer[ change ]();
notStrictEqual( defer.state(), "pending", "not pending after " + change );
defer.notify();
});
});
});
});
test( "jQuery.Deferred - chainability", function() {
var defer = jQuery.Deferred();
expect( 10 );
jQuery.expandedEach = jQuery.each;
jQuery.expandedEach( "resolve reject notify resolveWith rejectWith notifyWith done fail progress always".split(" "), function( _, method ) {
var object = {
m: defer[ method ]
};
strictEqual( object.m(), object, method + " is chainable" );
});
});
test( "jQuery.Deferred.then - filtering (done)", function() {
expect( 4 );
var value1, value2, value3,
defer = jQuery.Deferred(),
piped = defer.then(function( a, b ) {
return a * b;
});
piped.done(function( result ) {
value3 = result;
});
defer.done(function( a, b ) {
value1 = a;
value2 = b;
});
defer.resolve( 2, 3 );
strictEqual( value1, 2, "first resolve value ok" );
strictEqual( value2, 3, "second resolve value ok" );
strictEqual( value3, 6, "result of filter ok" );
jQuery.Deferred().reject().then(function() {
ok( false, "then should not be called on reject" );
});
jQuery.Deferred().resolve().then( jQuery.noop ).done(function( value ) {
strictEqual( value, undefined, "then done callback can return undefined/null" );
});
});
test( "jQuery.Deferred.then - filtering (fail)", function() {
expect( 4 );
var value1, value2, value3,
defer = jQuery.Deferred(),
piped = defer.then( null, function( a, b ) {
return a * b;
});
piped.fail(function( result ) {
value3 = result;
});
defer.fail(function( a, b ) {
value1 = a;
value2 = b;
});
defer.reject( 2, 3 );
strictEqual( value1, 2, "first reject value ok" );
strictEqual( value2, 3, "second reject value ok" );
strictEqual( value3, 6, "result of filter ok" );
jQuery.Deferred().resolve().then( null, function() {
ok( false, "then should not be called on resolve" );
});
jQuery.Deferred().reject().then( null, jQuery.noop ).fail(function( value ) {
strictEqual( value, undefined, "then fail callback can return undefined/null" );
});
});
test( "jQuery.Deferred.then - filtering (progress)", function() {
expect( 3 );
var value1, value2, value3,
defer = jQuery.Deferred(),
piped = defer.then( null, null, function( a, b ) {
return a * b;
});
piped.progress(function( result ) {
value3 = result;
});
defer.progress(function( a, b ) {
value1 = a;
value2 = b;
});
defer.notify( 2, 3 );
strictEqual( value1, 2, "first progress value ok" );
strictEqual( value2, 3, "second progress value ok" );
strictEqual( value3, 6, "result of filter ok" );
});
test( "jQuery.Deferred.then - deferred (done)", function() {
expect( 3 );
var value1, value2, value3,
defer = jQuery.Deferred(),
piped = defer.then(function( a, b ) {
return jQuery.Deferred(function( defer ) {
defer.reject( a * b );
});
});
piped.fail(function( result ) {
value3 = result;
});
defer.done(function( a, b ) {
value1 = a;
value2 = b;
});
defer.resolve( 2, 3 );
strictEqual( value1, 2, "first resolve value ok" );
strictEqual( value2, 3, "second resolve value ok" );
strictEqual( value3, 6, "result of filter ok" );
});
test( "jQuery.Deferred.then - deferred (fail)", function() {
expect( 3 );
var value1, value2, value3,
defer = jQuery.Deferred(),
piped = defer.then( null, function( a, b ) {
return jQuery.Deferred(function( defer ) {
defer.resolve( a * b );
});
});
piped.done(function( result ) {
value3 = result;
});
defer.fail(function( a, b ) {
value1 = a;
value2 = b;
});
defer.reject( 2, 3 );
strictEqual( value1, 2, "first reject value ok" );
strictEqual( value2, 3, "second reject value ok" );
strictEqual( value3, 6, "result of filter ok" );
});
test( "jQuery.Deferred.then - deferred (progress)", function() {
expect( 3 );
var value1, value2, value3,
defer = jQuery.Deferred(),
piped = defer.then( null, null, function( a, b ) {
return jQuery.Deferred(function( defer ) {
defer.resolve( a * b );
});
});
piped.done(function( result ) {
value3 = result;
});
defer.progress(function( a, b ) {
value1 = a;
value2 = b;
});
defer.notify( 2, 3 );
strictEqual( value1, 2, "first progress value ok" );
strictEqual( value2, 3, "second progress value ok" );
strictEqual( value3, 6, "result of filter ok" );
});
test( "jQuery.Deferred.then - context", function() {
expect( 7 );
var context = {};
jQuery.Deferred().resolveWith( context, [ 2 ] ).then(function( value ) {
return value * 3;
}).done(function( value ) {
strictEqual( this, context, "custom context correctly propagated" );
strictEqual( value, 6, "proper value received" );
});
jQuery.Deferred().resolve().then(function() {
return jQuery.Deferred().resolveWith(context);
}).done(function() {
strictEqual( this, context, "custom context of returned deferred correctly propagated" );
});
var defer = jQuery.Deferred(),
piped = defer.then(function( value ) {
return value * 3;
});
defer.resolve( 2 );
piped.done(function( value ) {
strictEqual( this, piped, "default context gets updated to latest promise in the chain" );
strictEqual( value, 6, "proper value received" );
});
var defer2 = jQuery.Deferred(),
piped2 = defer2.then();
defer2.resolve( 2 );
piped2.done(function( value ) {
strictEqual( this, piped2, "default context gets updated to latest promise in the chain (without passing function)" );
strictEqual( value, 2, "proper value received (without passing function)" );
});
});
test( "jQuery.when", function() {
expect( 34 );
// Some other objects
jQuery.each({
"an empty string": "",
"a non-empty string": "some string",
"zero": 0,
"a number other than zero": 1,
"true": true,
"false": false,
"null": null,
"undefined": undefined,
"a plain object": {}
}, function( message, value ) {
ok(
jQuery.isFunction(
jQuery.when( value ).done(function( resolveValue ) {
strictEqual( this, window, "Context is the global object with " + message );
strictEqual( resolveValue, value, "Test the promise was resolved with " + message );
}).promise
),
"Test " + message + " triggers the creation of a new Promise"
);
} );
ok(
jQuery.isFunction(
jQuery.when().done(function( resolveValue ) {
strictEqual( this, window, "Test the promise was resolved with window as its context" );
strictEqual( resolveValue, undefined, "Test the promise was resolved with no parameter" );
}).promise
),
"Test calling when with no parameter triggers the creation of a new Promise"
);
var context = {};
jQuery.when( jQuery.Deferred().resolveWith( context ) ).done(function() {
strictEqual( this, context, "when( promise ) propagates context" );
});
var cache;
jQuery.each([ 1, 2, 3 ], function( k, i ) {
jQuery.when( cache || jQuery.Deferred(function() {
this.resolve( i );
})
).done(function( value ) {
strictEqual( value, 1, "Function executed" + ( i > 1 ? " only once" : "" ) );
cache = value;
});
});
});
test( "jQuery.when - joined", function() {
expect( 119 );
var deferreds = {
value: 1,
success: jQuery.Deferred().resolve( 1 ),
error: jQuery.Deferred().reject( 0 ),
futureSuccess: jQuery.Deferred().notify( true ),
futureError: jQuery.Deferred().notify( true ),
notify: jQuery.Deferred().notify( true )
},
willSucceed = {
value: true,
success: true,
futureSuccess: true
},
willError = {
error: true,
futureError: true
},
willNotify = {
futureSuccess: true,
futureError: true,
notify: true
};
jQuery.each( deferreds, function( id1, defer1 ) {
jQuery.each( deferreds, function( id2, defer2 ) {
var shouldResolve = willSucceed[ id1 ] && willSucceed[ id2 ],
shouldError = willError[ id1 ] || willError[ id2 ],
shouldNotify = willNotify[ id1 ] || willNotify[ id2 ],
expected = shouldResolve ? [ 1, 1 ] : [ 0, undefined ],
expectedNotify = shouldNotify && [ willNotify[ id1 ], willNotify[ id2 ] ],
code = id1 + "/" + id2,
context1 = defer1 && jQuery.isFunction( defer1.promise ) ? defer1.promise() : undefined,
context2 = defer2 && jQuery.isFunction( defer2.promise ) ? defer2.promise() : undefined;
jQuery.when( defer1, defer2 ).done(function( a, b ) {
if ( shouldResolve ) {
deepEqual( [ a, b ], expected, code + " => resolve" );
strictEqual( this[ 0 ], context1, code + " => first context OK" );
strictEqual( this[ 1 ], context2, code + " => second context OK" );
} else {
ok( false, code + " => resolve" );
}
}).fail(function( a, b ) {
if ( shouldError ) {
deepEqual( [ a, b ], expected, code + " => reject" );
} else {
ok( false, code + " => reject" );
}
}).progress(function( a, b ) {
deepEqual( [ a, b ], expectedNotify, code + " => progress" );
strictEqual( this[ 0 ], expectedNotify[ 0 ] ? context1 : undefined, code + " => first context OK" );
strictEqual( this[ 1 ], expectedNotify[ 1 ] ? context2 : undefined, code + " => second context OK" );
});
});
});
deferreds.futureSuccess.resolve( 1 );
deferreds.futureError.reject( 0 );
});

View File

@@ -0,0 +1 @@
module("deprecated");

View File

@@ -0,0 +1,461 @@
if ( jQuery.fn.width ) {
module("dimensions", { teardown: moduleTeardown });
var pass = function( val ) {
return val;
};
var fn = function( val ) {
return function() {
return val;
};
};
/*
======== local reference =======
pass and fn can be used to test passing functions to setters
See testWidth below for an example
pass( value );
This function returns whatever value is passed in
fn( value );
Returns a function that returns the value
*/
var testWidth = function( val ) {
expect(9);
var $div = jQuery("#nothiddendiv");
$div.width( val(30) );
equal($div.width(), 30, "Test set to 30 correctly");
$div.hide();
equal($div.width(), 30, "Test hidden div");
$div.show();
$div.width( val(-1) ); // handle negative numbers by setting to 0 #11604
equal($div.width(), 0, "Test negative width normalized to 0");
$div.css("padding", "20px");
equal($div.width(), 0, "Test padding specified with pixels");
$div.css("border", "2px solid #fff");
equal($div.width(), 0, "Test border specified with pixels");
$div.css({ "display": "", "border": "", "padding": "" });
jQuery("#nothiddendivchild").css({ "width": 20, "padding": "3px", "border": "2px solid #fff" });
equal(jQuery("#nothiddendivchild").width(), 20, "Test child width with border and padding");
jQuery("#nothiddendiv, #nothiddendivchild").css({ "border": "", "padding": "", "width": "" });
var blah = jQuery("blah");
equal( blah.width( val(10) ), blah, "Make sure that setting a width on an empty set returns the set." );
equal( blah.width(), null, "Make sure 'null' is returned on an empty set");
equal( jQuery(window).width(), document.documentElement.clientWidth, "Window width is equal to width reported by window/document." );
QUnit.expectJqData( $div[0], "olddisplay" );
};
test("width()", function() {
testWidth( pass );
});
test("width(Function)", function() {
testWidth( fn );
});
test("width(Function(args))", function() {
expect( 2 );
var $div = jQuery("#nothiddendiv");
$div.width( 30 ).width(function(i, width) {
equal( width, 30, "Make sure previous value is corrrect." );
return width + 1;
});
equal( $div.width(), 31, "Make sure value was modified correctly." );
});
var testHeight = function( val ) {
expect(9);
var $div = jQuery("#nothiddendiv");
$div.height( val(30) );
equal($div.height(), 30, "Test set to 30 correctly");
$div.hide();
equal($div.height(), 30, "Test hidden div");
$div.show();
$div.height( val(-1) ); // handle negative numbers by setting to 0 #11604
equal($div.height(), 0, "Test negative height normalized to 0");
$div.css("padding", "20px");
equal($div.height(), 0, "Test padding specified with pixels");
$div.css("border", "2px solid #fff");
equal($div.height(), 0, "Test border specified with pixels");
$div.css({ "display": "", "border": "", "padding": "", "height": "1px" });
jQuery("#nothiddendivchild").css({ "height": 20, "padding": "3px", "border": "2px solid #fff" });
equal(jQuery("#nothiddendivchild").height(), 20, "Test child height with border and padding");
jQuery("#nothiddendiv, #nothiddendivchild").css({ "border": "", "padding": "", "height": "" });
var blah = jQuery("blah");
equal( blah.height( val(10) ), blah, "Make sure that setting a height on an empty set returns the set." );
equal( blah.height(), null, "Make sure 'null' is returned on an empty set");
equal( jQuery(window).height(), document.documentElement.clientHeight, "Window width is equal to width reported by window/document." );
QUnit.expectJqData( $div[0], "olddisplay" );
};
test("height()", function() {
testHeight( pass );
});
test("height(Function)", function() {
testHeight( fn );
});
test("height(Function(args))", function() {
expect( 2 );
var $div = jQuery("#nothiddendiv");
$div.height( 30 ).height(function(i, height) {
equal( height, 30, "Make sure previous value is corrrect." );
return height + 1;
});
equal( $div.height(), 31, "Make sure value was modified correctly." );
});
test("innerWidth()", function() {
expect(6);
var winWidth = jQuery( window ).width(),
docWidth = jQuery( document ).width();
equal(jQuery(window).innerWidth(), winWidth, "Test on window");
equal(jQuery(document).innerWidth(), docWidth, "Test on document");
var $div = jQuery("#nothiddendiv");
// set styles
$div.css({
"margin": 10,
"border": "2px solid #fff",
"width": 30
});
equal($div.innerWidth(), 30, "Test with margin and border");
$div.css("padding", "20px");
equal($div.innerWidth(), 70, "Test with margin, border and padding");
$div.hide();
equal($div.innerWidth(), 70, "Test hidden div");
// reset styles
$div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
var div = jQuery( "<div>" );
// Temporarily require 0 for backwards compat - should be auto
equal( div.innerWidth(), 0, "Make sure that disconnected nodes are handled." );
div.remove();
QUnit.expectJqData( $div[0], "olddisplay" );
});
test("innerHeight()", function() {
expect(6);
var winHeight = jQuery( window ).height(),
docHeight = jQuery( document ).height();
equal(jQuery(window).innerHeight(), winHeight, "Test on window");
equal(jQuery(document).innerHeight(), docHeight, "Test on document");
var $div = jQuery("#nothiddendiv");
// set styles
$div.css({
"margin": 10,
"border": "2px solid #fff",
"height": 30
});
equal($div.innerHeight(), 30, "Test with margin and border");
$div.css("padding", "20px");
equal($div.innerHeight(), 70, "Test with margin, border and padding");
$div.hide();
equal($div.innerHeight(), 70, "Test hidden div");
// reset styles
$div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
var div = jQuery( "<div>" );
// Temporarily require 0 for backwards compat - should be auto
equal( div.innerHeight(), 0, "Make sure that disconnected nodes are handled." );
div.remove();
QUnit.expectJqData( $div[0], "olddisplay" );
});
test("outerWidth()", function() {
expect(11);
var winWidth = jQuery( window ).width(),
docWidth = jQuery( document ).width();
equal( jQuery( window ).outerWidth(), winWidth, "Test on window without margin option" );
equal( jQuery( window ).outerWidth( true ), winWidth, "Test on window with margin option" );
equal( jQuery( document ).outerWidth(), docWidth, "Test on document without margin option" );
equal( jQuery( document ).outerWidth( true ), docWidth, "Test on document with margin option" );
var $div = jQuery("#nothiddendiv");
$div.css("width", 30);
equal($div.outerWidth(), 30, "Test with only width set");
$div.css("padding", "20px");
equal($div.outerWidth(), 70, "Test with padding");
$div.css("border", "2px solid #fff");
equal($div.outerWidth(), 74, "Test with padding and border");
$div.css("margin", "10px");
equal($div.outerWidth(), 74, "Test with padding, border and margin without margin option");
$div.css("position", "absolute");
equal($div.outerWidth(true), 94, "Test with padding, border and margin with margin option");
$div.hide();
equal($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option");
// reset styles
$div.css({ "position": "", "display": "", "border": "", "padding": "", "width": "", "height": "" });
var div = jQuery( "<div>" );
// Temporarily require 0 for backwards compat - should be auto
equal( div.outerWidth(), 0, "Make sure that disconnected nodes are handled." );
div.remove();
QUnit.expectJqData( $div[0], "olddisplay" );
});
test("child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see #9441 #9300", function() {
expect(16);
// setup html
var $divNormal = jQuery("<div>").css({ "width": "100px", "height": "100px", "border": "10px solid white", "padding": "2px", "margin": "3px" }),
$divChild = $divNormal.clone(),
$divUnconnected = $divNormal.clone(),
$divHiddenParent = jQuery("<div>").css( "display", "none" ).append( $divChild ).appendTo("body");
$divNormal.appendTo("body");
// tests that child div of a hidden div works the same as a normal div
equal( $divChild.width(), $divNormal.width(), "child of a hidden element width() is wrong see #9441" );
equal( $divChild.innerWidth(), $divNormal.innerWidth(), "child of a hidden element innerWidth() is wrong see #9441" );
equal( $divChild.outerWidth(), $divNormal.outerWidth(), "child of a hidden element outerWidth() is wrong see #9441" );
equal( $divChild.outerWidth(true), $divNormal.outerWidth( true ), "child of a hidden element outerWidth( true ) is wrong see #9300" );
equal( $divChild.height(), $divNormal.height(), "child of a hidden element height() is wrong see #9441" );
equal( $divChild.innerHeight(), $divNormal.innerHeight(), "child of a hidden element innerHeight() is wrong see #9441" );
equal( $divChild.outerHeight(), $divNormal.outerHeight(), "child of a hidden element outerHeight() is wrong see #9441" );
equal( $divChild.outerHeight(true), $divNormal.outerHeight( true ), "child of a hidden element outerHeight( true ) is wrong see #9300" );
// tests that child div of an unconnected div works the same as a normal div
equal( $divUnconnected.width(), $divNormal.width(), "unconnected element width() is wrong see #9441" );
equal( $divUnconnected.innerWidth(), $divNormal.innerWidth(), "unconnected element innerWidth() is wrong see #9441" );
equal( $divUnconnected.outerWidth(), $divNormal.outerWidth(), "unconnected element outerWidth() is wrong see #9441" );
equal( $divUnconnected.outerWidth(true), $divNormal.outerWidth( true ), "unconnected element outerWidth( true ) is wrong see #9300" );
equal( $divUnconnected.height(), $divNormal.height(), "unconnected element height() is wrong see #9441" );
equal( $divUnconnected.innerHeight(), $divNormal.innerHeight(), "unconnected element innerHeight() is wrong see #9441" );
equal( $divUnconnected.outerHeight(), $divNormal.outerHeight(), "unconnected element outerHeight() is wrong see #9441" );
equal( $divUnconnected.outerHeight(true), $divNormal.outerHeight( true ), "unconnected element outerHeight( true ) is wrong see #9300" );
// teardown html
$divHiddenParent.remove();
$divNormal.remove();
});
test("getting dimensions shouldnt modify runtimeStyle see #9233", function() {
expect( 1 );
var $div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ),
div = $div.get( 0 ),
runtimeStyle = div.runtimeStyle;
if ( runtimeStyle ) {
div.runtimeStyle.marginLeft = "12em";
div.runtimeStyle.left = "11em";
}
$div.outerWidth( true );
if ( runtimeStyle ) {
equal( div.runtimeStyle.left, "11em", "getting dimensions modifies runtimeStyle, see #9233" );
} else {
ok( true, "this browser doesnt support runtimeStyle, see #9233" );
}
$div.remove();
});
test( "table dimensions", 2, function() {
var table = jQuery("<table><colgroup><col/><col/></colgroup><tbody><tr><td></td><td>a</td></tr><tr><td></td><td>a</td></tr></tbody></table>").appendTo("#qunit-fixture"),
tdElem = table.find("tr:eq(0) td:eq(0)"),
colElem = table.find("col:eq(1)").width( 300 );
table.find("td").css({ "margin": 0, "padding": 0 });
equal( tdElem.width(), tdElem.width(), "width() doesn't alter dimension values of empty cells, see #11293" );
equal( colElem.width(), 300, "col elements have width(), see #12243" );
});
test("box-sizing:border-box child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see #10413", function() {
expect(16);
// setup html
var $divNormal = jQuery("<div>").css({ "boxSizing": "border-box", "width": "100px", "height": "100px", "border": "10px solid white", "padding": "2px", "margin": "3px" }),
$divChild = $divNormal.clone(),
$divUnconnected = $divNormal.clone(),
$divHiddenParent = jQuery("<div>").css( "display", "none" ).append( $divChild ).appendTo("body");
$divNormal.appendTo("body");
// tests that child div of a hidden div works the same as a normal div
equal( $divChild.width(), $divNormal.width(), "child of a hidden element width() is wrong see #10413" );
equal( $divChild.innerWidth(), $divNormal.innerWidth(), "child of a hidden element innerWidth() is wrong see #10413" );
equal( $divChild.outerWidth(), $divNormal.outerWidth(), "child of a hidden element outerWidth() is wrong see #10413" );
equal( $divChild.outerWidth(true), $divNormal.outerWidth( true ), "child of a hidden element outerWidth( true ) is wrong see #10413" );
equal( $divChild.height(), $divNormal.height(), "child of a hidden element height() is wrong see #10413" );
equal( $divChild.innerHeight(), $divNormal.innerHeight(), "child of a hidden element innerHeight() is wrong see #10413" );
equal( $divChild.outerHeight(), $divNormal.outerHeight(), "child of a hidden element outerHeight() is wrong see #10413" );
equal( $divChild.outerHeight(true), $divNormal.outerHeight( true ), "child of a hidden element outerHeight( true ) is wrong see #10413" );
// tests that child div of an unconnected div works the same as a normal div
equal( $divUnconnected.width(), $divNormal.width(), "unconnected element width() is wrong see #10413" );
equal( $divUnconnected.innerWidth(), $divNormal.innerWidth(), "unconnected element innerWidth() is wrong see #10413" );
equal( $divUnconnected.outerWidth(), $divNormal.outerWidth(), "unconnected element outerWidth() is wrong see #10413" );
equal( $divUnconnected.outerWidth(true), $divNormal.outerWidth( true ), "unconnected element outerWidth( true ) is wrong see #10413" );
equal( $divUnconnected.height(), $divNormal.height(), "unconnected element height() is wrong see #10413" );
equal( $divUnconnected.innerHeight(), $divNormal.innerHeight(), "unconnected element innerHeight() is wrong see #10413" );
equal( $divUnconnected.outerHeight(), $divNormal.outerHeight(), "unconnected element outerHeight() is wrong see #10413" );
equal( $divUnconnected.outerHeight(true), $divNormal.outerHeight( true ), "unconnected element outerHeight( true ) is wrong see #10413" );
// teardown html
$divHiddenParent.remove();
$divNormal.remove();
});
test("outerHeight()", function() {
expect(11);
var winHeight = jQuery( window ).height(),
docHeight = jQuery( document ).height();
equal( jQuery( window ).outerHeight(), winHeight, "Test on window without margin option" );
equal( jQuery( window ).outerHeight( true ), winHeight, "Test on window with margin option" );
equal( jQuery( document ).outerHeight(), docHeight, "Test on document without margin option" );
equal( jQuery( document ).outerHeight( true ), docHeight, "Test on document with margin option" );
var $div = jQuery("#nothiddendiv");
$div.css("height", 30);
equal($div.outerHeight(), 30, "Test with only width set");
$div.css("padding", "20px");
equal($div.outerHeight(), 70, "Test with padding");
$div.css("border", "2px solid #fff");
equal($div.outerHeight(), 74, "Test with padding and border");
$div.css("margin", "10px");
equal($div.outerHeight(), 74, "Test with padding, border and margin without margin option");
equal($div.outerHeight(true), 94, "Test with padding, border and margin with margin option");
$div.hide();
equal($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option");
// reset styles
$div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
var div = jQuery( "<div>" );
// Temporarily require 0 for backwards compat - should be auto
equal( div.outerHeight(), 0, "Make sure that disconnected nodes are handled." );
div.remove();
QUnit.expectJqData( $div[0], "olddisplay" );
});
test("passing undefined is a setter #5571", function() {
expect(4);
equal(jQuery("#nothiddendiv").height(30).height(undefined).height(), 30, ".height(undefined) is chainable (#5571)");
equal(jQuery("#nothiddendiv").height(30).innerHeight(undefined).height(), 30, ".innerHeight(undefined) is chainable (#5571)");
equal(jQuery("#nothiddendiv").height(30).outerHeight(undefined).height(), 30, ".outerHeight(undefined) is chainable (#5571)");
equal(jQuery("#nothiddendiv").width(30).width(undefined).width(), 30, ".width(undefined) is chainable (#5571)");
});
test( "getters on non elements should return null", function() {
expect( 8 );
var nonElem = jQuery("notAnElement");
strictEqual( nonElem.width(), null, ".width() is not null (#12283)" );
strictEqual( nonElem.innerWidth(), null, ".innerWidth() is not null (#12283)" );
strictEqual( nonElem.outerWidth(), null, ".outerWidth() is not null (#12283)" );
strictEqual( nonElem.outerWidth( true ), null, ".outerWidth(true) is not null (#12283)" );
strictEqual( nonElem.height(), null, ".height() is not null (#12283)" );
strictEqual( nonElem.innerHeight(), null, ".innerHeight() is not null (#12283)" );
strictEqual( nonElem.outerHeight(), null, ".outerHeight() is not null (#12283)" );
strictEqual( nonElem.outerHeight( true ), null, ".outerHeight(true) is not null (#12283)" );
});
test("setters with and without box-sizing:border-box", function(){
expect(20);
var el_bb = jQuery("<div style='width:114px;height:114px;margin:5px;padding:3px;border:4px solid white;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;'>test</div>").appendTo("#qunit-fixture"),
el = jQuery("<div style='width:100px;height:100px;margin:5px;padding:3px;border:4px solid white;'>test</div>").appendTo("#qunit-fixture"),
expected = 100;
equal( el_bb.width( 101 ).width(), expected + 1, "test border-box width(int) by roundtripping" );
equal( el_bb.innerWidth( 108 ).width(), expected + 2, "test border-box innerWidth(int) by roundtripping" );
equal( el_bb.outerWidth( 117 ).width(), expected + 3, "test border-box outerWidth(int) by roundtripping" );
equal( el_bb.outerWidth( 118, false ).width(), expected + 4, "test border-box outerWidth(int, false) by roundtripping" );
equal( el_bb.outerWidth( 129, true ).width(), expected + 5, "test border-box innerWidth(int, true) by roundtripping" );
equal( el_bb.height( 101 ).height(), expected + 1, "test border-box height(int) by roundtripping" );
equal( el_bb.innerHeight( 108 ).height(), expected + 2, "test border-box innerHeight(int) by roundtripping" );
equal( el_bb.outerHeight( 117 ).height(), expected + 3, "test border-box outerHeight(int) by roundtripping" );
equal( el_bb.outerHeight( 118, false ).height(), expected + 4, "test border-box outerHeight(int, false) by roundtripping" );
equal( el_bb.outerHeight( 129, true ).height(), expected + 5, "test border-box innerHeight(int, true) by roundtripping" );
equal( el.width( 101 ).width(), expected + 1, "test border-box width(int) by roundtripping" );
equal( el.innerWidth( 108 ).width(), expected + 2, "test border-box innerWidth(int) by roundtripping" );
equal( el.outerWidth( 117 ).width(), expected + 3, "test border-box outerWidth(int) by roundtripping" );
equal( el.outerWidth( 118, false ).width(), expected + 4, "test border-box outerWidth(int, false) by roundtripping" );
equal( el.outerWidth( 129, true ).width(), expected + 5, "test border-box innerWidth(int, true) by roundtripping" );
equal( el.height( 101 ).height(), expected + 1, "test border-box height(int) by roundtripping" );
equal( el.innerHeight( 108 ).height(), expected + 2, "test border-box innerHeight(int) by roundtripping" );
equal( el.outerHeight( 117 ).height(), expected + 3, "test border-box outerHeight(int) by roundtripping" );
equal( el.outerHeight( 118, false ).height(), expected + 4, "test border-box outerHeight(int, false) by roundtripping" );
equal( el.outerHeight( 129, true ).height(), expected + 5, "test border-box innerHeight(int, true) by roundtripping" );
});
testIframe( "dimensions/documentSmall", "window vs. small document", function( jQuery, window, document ) {
// this test is practically tautological, but there is a bug in IE8
// with no simple workaround, so this test exposes the bug and works around it
if ( document.body.offsetWidth >= document.documentElement.offsetWidth ) {
expect( 2 );
equal( jQuery( document ).height(), jQuery( window ).height(), "document height matches window height" );
equal( jQuery( document ).width(), jQuery( window ).width(), "document width matches window width" );
} else {
// all tests should have at least one assertion
expect( 1 );
ok( true, "skipping test (conditions not satisfied)" );
}
});
testIframe( "dimensions/documentLarge", "window vs. large document", function( jQuery, window, document ) {
expect(2);
ok( jQuery( document ).height() > jQuery( window ).height(), "document height is larger than window height" );
ok( jQuery( document ).width() > jQuery( window ).width(), "document width is larger than window width" );
});
}

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,7 @@
module("exports", { teardown: moduleTeardown });
test("amdModule", function() {
expect(1);
equal( jQuery, amdDefined, "Make sure defined module matches jQuery" );
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,549 @@
(function() {
if ( !jQuery.fn.offset ) {
return;
}
var supportsScroll, supportsFixedPosition,
forceScroll = jQuery("<div/>").css({ width: 2000, height: 2000 }),
checkSupport = function() {
// Only run once
checkSupport = false;
var checkFixed = jQuery("<div/>").css({ position: "fixed", top: "20px" }).appendTo("#qunit-fixture");
// Must append to body because #qunit-fixture is hidden and elements inside it don't have a scrollTop
forceScroll.appendTo("body");
window.scrollTo( 200, 200 );
supportsScroll = document.documentElement.scrollTop || document.body.scrollTop;
forceScroll.detach();
// Safari subtracts parent border width here (which is 5px)
supportsFixedPosition = checkFixed[0].offsetTop === 20 || checkFixed[0].offsetTop === 15;
checkFixed.remove();
};
module("offset", { setup: function(){
if ( typeof checkSupport === "function" ) {
checkSupport();
}
// Force a scroll value on the main window to ensure incorrect results
// if offset is using the scroll offset of the parent window
forceScroll.appendTo("body");
window.scrollTo( 1, 1 );
forceScroll.detach();
}, teardown: moduleTeardown });
/*
Closure-compiler will roll static methods off of the jQuery object and so they will
not be passed with the jQuery object across the windows. To differentiate this, the
testIframe callbacks use the "$" symbol to refer to the jQuery object passed from
the iframe window and the "jQuery" symbol is used to access any static methods.
*/
test("empty set", function() {
expect(2);
strictEqual( jQuery().offset(), undefined, "offset() returns undefined for empty set (#11962)" );
strictEqual( jQuery().position(), undefined, "position() returns undefined for empty set (#11962)" );
});
test("object without getBoundingClientRect", function() {
expect(2);
// Simulates a browser without gBCR on elements, we just want to return 0,0
var result = jQuery({ ownerDocument: document }).offset();
equal( result.top, 0, "Check top" );
equal( result.left, 0, "Check left" );
});
test("disconnected node", function() {
expect(2);
var result = jQuery( document.createElement("div") ).offset();
equal( result.top, 0, "Check top" );
equal( result.left, 0, "Check left" );
});
testIframe("offset/absolute", "absolute", function($, iframe) {
expect(4);
var doc = iframe.document,
tests;
// get offset
tests = [
{ "id": "#absolute-1", "top": 1, "left": 1 }
];
jQuery.each( tests, function() {
equal( jQuery( this["id"], doc ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" );
equal( jQuery( this["id"], doc ).offset().left, this["left"], "jQuery('" + this["id"] + "').offset().left" );
});
// get position
tests = [
{ "id": "#absolute-1", "top": 0, "left": 0 }
];
jQuery.each( tests, function() {
equal( jQuery( this["id"], doc ).position().top, this["top"], "jQuery('" + this["id"] + "').position().top" );
equal( jQuery( this["id"], doc ).position().left, this["left"], "jQuery('" + this["id"] + "').position().left" );
});
});
testIframe("offset/absolute", "absolute", function( $ ) {
expect(178);
// get offset tests
var tests = [
{ "id": "#absolute-1", "top": 1, "left": 1 },
{ "id": "#absolute-1-1", "top": 5, "left": 5 },
{ "id": "#absolute-1-1-1", "top": 9, "left": 9 },
{ "id": "#absolute-2", "top": 20, "left": 20 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" );
equal( $( this["id"] ).offset().left, this["left"], "jQuery('" + this["id"] + "').offset().left" );
});
// get position
tests = [
{ "id": "#absolute-1", "top": 0, "left": 0 },
{ "id": "#absolute-1-1", "top": 1, "left": 1 },
{ "id": "#absolute-1-1-1", "top": 1, "left": 1 },
{ "id": "#absolute-2", "top": 19, "left": 19 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["id"] + "').position().top" );
equal( $( this["id"] ).position().left, this["left"], "jQuery('" + this["id"] + "').position().left" );
});
// test #5781
var offset = $( "#positionTest" ).offset({ "top": 10, "left": 10 }).offset();
equal( offset.top, 10, "Setting offset on element with position absolute but 'auto' values." );
equal( offset.left, 10, "Setting offset on element with position absolute but 'auto' values." );
// set offset
tests = [
{ "id": "#absolute-2", "top": 30, "left": 30 },
{ "id": "#absolute-2", "top": 10, "left": 10 },
{ "id": "#absolute-2", "top": -1, "left": -1 },
{ "id": "#absolute-2", "top": 19, "left": 19 },
{ "id": "#absolute-1-1-1", "top": 15, "left": 15 },
{ "id": "#absolute-1-1-1", "top": 5, "left": 5 },
{ "id": "#absolute-1-1-1", "top": -1, "left": -1 },
{ "id": "#absolute-1-1-1", "top": 9, "left": 9 },
{ "id": "#absolute-1-1", "top": 10, "left": 10 },
{ "id": "#absolute-1-1", "top": 0, "left": 0 },
{ "id": "#absolute-1-1", "top": -1, "left": -1 },
{ "id": "#absolute-1-1", "top": 5, "left": 5 },
{ "id": "#absolute-1", "top": 2, "left": 2 },
{ "id": "#absolute-1", "top": 0, "left": 0 },
{ "id": "#absolute-1", "top": -1, "left": -1 },
{ "id": "#absolute-1", "top": 1, "left": 1 }
];
jQuery.each( tests, function() {
$( this["id"] ).offset({ "top": this["top"], "left": this["left"] });
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset({ top: " + this["top"] + " })" );
equal( $( this["id"] ).offset().left, this["left"], "jQuery('" + this["id"] + "').offset({ left: " + this["left"] + " })" );
var top = this["top"], left = this["left"];
$( this["id"] ).offset(function(i, val){
equal( val.top, top, "Verify incoming top position." );
equal( val.left, left, "Verify incoming top position." );
return { "top": top + 1, "left": left + 1 };
});
equal( $( this["id"] ).offset().top, this["top"] + 1, "jQuery('" + this["id"] + "').offset({ top: " + (this["top"] + 1) + " })" );
equal( $( this["id"] ).offset().left, this["left"] + 1, "jQuery('" + this["id"] + "').offset({ left: " + (this["left"] + 1) + " })" );
$( this["id"] )
.offset({ "left": this["left"] + 2 })
.offset({ "top": this["top"] + 2 });
equal( $( this["id"] ).offset().top, this["top"] + 2, "Setting one property at a time." );
equal( $( this["id"] ).offset().left, this["left"] + 2, "Setting one property at a time." );
$( this["id"] ).offset({ "top": this["top"], "left": this["left"], "using": function( props ) {
$( this ).css({
"top": props.top + 1,
"left": props.left + 1
});
}});
equal( $( this["id"] ).offset().top, this["top"] + 1, "jQuery('" + this["id"] + "').offset({ top: " + (this["top"] + 1) + ", using: fn })" );
equal( $( this["id"] ).offset().left, this["left"] + 1, "jQuery('" + this["id"] + "').offset({ left: " + (this["left"] + 1) + ", using: fn })" );
});
});
testIframe("offset/relative", "relative", function( $ ) {
expect(60);
// IE is collapsing the top margin of 1px; detect and adjust accordingly
var ie = $("#relative-1").offset().top === 6;
// get offset
var tests = [
{ "id": "#relative-1", "top": ie ? 6 : 7, "left": 7 },
{ "id": "#relative-1-1", "top": ie ? 13 : 15, "left": 15 },
{ "id": "#relative-2", "top": ie ? 141 : 142, "left": 27 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" );
equal( $( this["id"] ).offset().left, this["left"], "jQuery('" + this["id"] + "').offset().left" );
});
// get position
tests = [
{ "id": "#relative-1", "top": ie ? 5 : 6, "left": 6 },
{ "id": "#relative-1-1", "top": ie ? 4 : 5, "left": 5 },
{ "id": "#relative-2", "top": ie ? 140 : 141, "left": 26 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["id"] + "').position().top" );
equal( $( this["id"] ).position().left, this["left"], "jQuery('" + this["id"] + "').position().left" );
});
// set offset
tests = [
{ "id": "#relative-2", "top": 200, "left": 50 },
{ "id": "#relative-2", "top": 100, "left": 10 },
{ "id": "#relative-2", "top": -5, "left": -5 },
{ "id": "#relative-2", "top": 142, "left": 27 },
{ "id": "#relative-1-1", "top": 100, "left": 100 },
{ "id": "#relative-1-1", "top": 5, "left": 5 },
{ "id": "#relative-1-1", "top": -1, "left": -1 },
{ "id": "#relative-1-1", "top": 15, "left": 15 },
{ "id": "#relative-1", "top": 100, "left": 100 },
{ "id": "#relative-1", "top": 0, "left": 0 },
{ "id": "#relative-1", "top": -1, "left": -1 },
{ "id": "#relative-1", "top": 7, "left": 7 }
];
jQuery.each( tests, function() {
$( this["id"] ).offset({ "top": this["top"], "left": this["left"] });
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset({ top: " + this["top"] + " })" );
equal( $( this["id"] ).offset().left, this["left"], "jQuery('" + this["id"] + "').offset({ left: " + this["left"] + " })" );
$( this["id"] ).offset({ "top": this["top"], "left": this["left"], "using": function( props ) {
$( this ).css({
"top": props.top + 1,
"left": props.left + 1
});
}});
equal( $( this["id"] ).offset().top, this["top"] + 1, "jQuery('" + this["id"] + "').offset({ top: " + (this["top"] + 1) + ", using: fn })" );
equal( $( this["id"] ).offset().left, this["left"] + 1, "jQuery('" + this["id"] + "').offset({ left: " + (this["left"] + 1) + ", using: fn })" );
});
});
testIframe("offset/static", "static", function( $ ) {
// IE is collapsing the top margin of 1px; detect and adjust accordingly
var ie = $("#static-1").offset().top === 6;
expect( 80 );
// get offset
var tests = [
{ "id": "#static-1", "top": ie ? 6 : 7, "left": 7 },
{ "id": "#static-1-1", "top": ie ? 13 : 15, "left": 15 },
{ "id": "#static-1-1-1", "top": ie ? 20 : 23, "left": 23 },
{ "id": "#static-2", "top": ie ? 121 : 122, left: 7 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" );
equal( $( this["id"] ).offset().left, this["left"], "jQuery('" + this["id"] + "').offset().left" );
});
// get position
tests = [
{ "id": "#static-1", "top": ie ? 5 : 6, "left": 6 },
{ "id": "#static-1-1", "top": ie ? 12 : 14, "left": 14 },
{ "id": "#static-1-1-1", "top": ie ? 19 : 22, "left": 22 },
{ "id": "#static-2", "top": ie ? 120 : 121, "left": 6 }
];
jQuery.each( tests, function() {
equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["top"] + "').position().top" );
equal( $( this["id"] ).position().left, this["left"], "jQuery('" + this["left"] +"').position().left" );
});
// set offset
tests = [
{ "id": "#static-2", "top": 200, "left": 200 },
{ "id": "#static-2", "top": 100, "left": 100 },
{ "id": "#static-2", "top": -2, "left": -2 },
{ "id": "#static-2", "top": 121, "left": 6 },
{ "id": "#static-1-1-1", "top": 50, "left": 50 },
{ "id": "#static-1-1-1", "top": 10, "left": 10 },
{ "id": "#static-1-1-1", "top": -1, "left": -1 },
{ "id": "#static-1-1-1", "top": 22, "left": 22 },
{ "id": "#static-1-1", "top": 25, "left": 25 },
{ "id": "#static-1-1", "top": 10, "left": 10 },
{ "id": "#static-1-1", "top": -3, "left": -3 },
{ "id": "#static-1-1", "top": 14, "left": 14 },
{ "id": "#static-1", "top": 30, "left": 30 },
{ "id": "#static-1", "top": 2, "left": 2 },
{ "id": "#static-1", "top": -2, "left": -2 },
{ "id": "#static-1", "top": 7, "left": 7 }
];
jQuery.each( tests, function() {
$( this["id"] ).offset({ "top": this["top"], "left": this["left"] });
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset({ top: " + this["top"] + " })" );
equal( $( this["id"] ).offset().left, this["left"], "jQuery('" + this["id"] + "').offset({ left: " + this["left"] + " })" );
$( this["id"] ).offset({ "top": this["top"], "left": this["left"], "using": function( props ) {
$( this ).css({
"top": props.top + 1,
"left": props.left + 1
});
}});
equal( $( this["id"] ).offset().top, this["top"] + 1, "jQuery('" + this["id"] + "').offset({ top: " + (this["top"] + 1) + ", using: fn })" );
equal( $( this["id"] ).offset().left, this["left"] + 1, "jQuery('" + this["id"] + "').offset({ left: " + (this["left"] + 1) + ", using: fn })" );
});
});
testIframe("offset/fixed", "fixed", function( $ ) {
// IE is collapsing the top margin of 1px; detect and adjust accordingly
var ie = $("#fixed-1").position().top === 2;
expect(34);
var tests = [
{
"id": "#fixed-1",
"offsetTop": 1001,
"offsetLeft": 1001,
"positionTop": ie ? 2 : 0,
"positionLeft": ie ? 2 : 0
},
{
"id": "#fixed-2",
"offsetTop": 1021,
"offsetLeft": 1021,
"positionTop": ie ? 22 : 20,
"positionLeft": ie ? 22 : 20
}
];
jQuery.each( tests, function() {
if ( !window.supportsScroll ) {
ok( true, "Browser doesn't support scroll position." );
ok( true, "Browser doesn't support scroll position." );
ok( true, "Browser doesn't support scroll position." );
ok( true, "Browser doesn't support scroll position." );
} else if ( window.supportsFixedPosition ) {
equal( $( this["id"] ).offset().top, this["offsetTop"], "jQuery('" + this["id"] + "').offset().top" );
equal( $( this["id"] ).position().top, this["positionTop"], "jQuery('" + this["id"] + "').position().top" );
equal( $( this["id"] ).offset().left, this["offsetLeft"], "jQuery('" + this["id"] + "').offset().left" );
equal( $( this["id"] ).position().left, this["positionLeft"], "jQuery('" + this["id"] + "').position().left" );
} else {
// need to have same number of assertions
ok( true, "Fixed position is not supported" );
ok( true, "Fixed position is not supported" );
ok( true, "Fixed position is not supported" );
ok( true, "Fixed position is not supported" );
}
});
tests = [
{ "id": "#fixed-1", "top": 100, "left": 100 },
{ "id": "#fixed-1", "top": 0, "left": 0 },
{ "id": "#fixed-1", "top": -4, "left": -4 },
{ "id": "#fixed-2", "top": 200, "left": 200 },
{ "id": "#fixed-2", "top": 0, "left": 0 },
{ "id": "#fixed-2", "top": -5, "left": -5 }
];
jQuery.each( tests, function() {
if ( window.supportsFixedPosition ) {
$( this["id"] ).offset({ "top": this["top"], "left": this["left"] });
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset({ top: " + this["top"] + " })" );
equal( $( this["id"] ).offset().left, this["left"], "jQuery('" + this["id"] + "').offset({ left: " + this["left"] + " })" );
$( this["id"] ).offset({ "top": this["top"], "left": this["left"], "using": function( props ) {
$( this ).css({
"top": props.top + 1,
"left": props.left + 1
});
}});
equal( $( this["id"] ).offset().top, this["top"] + 1, "jQuery('" + this["id"] + "').offset({ top: " + (this["top"] + 1) + ", using: fn })" );
equal( $( this["id"] ).offset().left, this["left"] + 1, "jQuery('" + this["id"] + "').offset({ left: " + (this["left"] + 1) + ", using: fn })" );
} else {
// need to have same number of assertions
ok( true, "Fixed position is not supported" );
ok( true, "Fixed position is not supported" );
ok( true, "Fixed position is not supported" );
ok( true, "Fixed position is not supported" );
}
});
// Bug 8316
var $noTopLeft = $("#fixed-no-top-left");
if ( window.supportsFixedPosition ) {
equal( $noTopLeft.offset().top, 1007, "Check offset top for fixed element with no top set" );
equal( $noTopLeft.offset().left, 1007, "Check offset left for fixed element with no left set" );
} else {
// need to have same number of assertions
ok( true, "Fixed position is not supported" );
ok( true, "Fixed position is not supported" );
}
});
testIframe("offset/table", "table", function( $ ) {
expect(4);
equal( $("#table-1").offset().top, 6, "jQuery('#table-1').offset().top" );
equal( $("#table-1").offset().left, 6, "jQuery('#table-1').offset().left" );
equal( $("#th-1").offset().top, 10, "jQuery('#th-1').offset().top" );
equal( $("#th-1").offset().left, 10, "jQuery('#th-1').offset().left" );
});
testIframe("offset/scroll", "scroll", function( $, win ) {
expect(24);
// If we're going to bastardize the tests, let's just DO it
var ie = /msie [678]/i.test( navigator.userAgent );
if ( ie ) {
ok( true, "TestSwarm's iframe has hosed this test in oldIE, we surrender" );
} else {
equal( $("#scroll-1").offset().top, 7, "jQuery('#scroll-1').offset().top" );
}
equal( $("#scroll-1").offset().left, 7, "jQuery('#scroll-1').offset().left" );
if ( ie ) {
ok( true, "TestSwarm's iframe has hosed this test in oldIE, we surrender" );
} else {
equal( $("#scroll-1-1").offset().top, 11, "jQuery('#scroll-1-1').offset().top" );
}
equal( $("#scroll-1-1").offset().left, 11, "jQuery('#scroll-1-1').offset().left" );
// scroll offset tests .scrollTop/Left
equal( $("#scroll-1").scrollTop(), 5, "jQuery('#scroll-1').scrollTop()" );
equal( $("#scroll-1").scrollLeft(), 5, "jQuery('#scroll-1').scrollLeft()" );
equal( $("#scroll-1-1").scrollTop(), 0, "jQuery('#scroll-1-1').scrollTop()" );
equal( $("#scroll-1-1").scrollLeft(), 0, "jQuery('#scroll-1-1').scrollLeft()" );
// scroll method chaining
equal( $("#scroll-1").scrollTop(undefined).scrollTop(), 5, ".scrollTop(undefined) is chainable (#5571)" );
equal( $("#scroll-1").scrollLeft(undefined).scrollLeft(), 5, ".scrollLeft(undefined) is chainable (#5571)" );
win.name = "test";
if ( !window.supportsScroll ) {
ok( true, "Browser doesn't support scroll position." );
ok( true, "Browser doesn't support scroll position." );
ok( true, "Browser doesn't support scroll position." );
ok( true, "Browser doesn't support scroll position." );
} else {
equal( $(win).scrollTop(), 1000, "jQuery(window).scrollTop()" );
equal( $(win).scrollLeft(), 1000, "jQuery(window).scrollLeft()" );
equal( $(win.document).scrollTop(), 1000, "jQuery(document).scrollTop()" );
equal( $(win.document).scrollLeft(), 1000, "jQuery(document).scrollLeft()" );
}
// test jQuery using parent window/document
// jQuery reference here is in the iframe
window.scrollTo(0,0);
equal( $(window).scrollTop(), 0, "jQuery(window).scrollTop() other window" );
equal( $(window).scrollLeft(), 0, "jQuery(window).scrollLeft() other window" );
equal( $(document).scrollTop(), 0, "jQuery(window).scrollTop() other document" );
equal( $(document).scrollLeft(), 0, "jQuery(window).scrollLeft() other document" );
// Tests scrollTop/Left with empty jquery objects
notEqual( $().scrollTop(100), null, "jQuery().scrollTop(100) testing setter on empty jquery object" );
notEqual( $().scrollLeft(100), null, "jQuery().scrollLeft(100) testing setter on empty jquery object" );
notEqual( $().scrollTop(null), null, "jQuery().scrollTop(null) testing setter on empty jquery object" );
notEqual( $().scrollLeft(null), null, "jQuery().scrollLeft(null) testing setter on empty jquery object" );
strictEqual( $().scrollTop(), null, "jQuery().scrollTop(100) testing setter on empty jquery object" );
strictEqual( $().scrollLeft(), null, "jQuery().scrollLeft(100) testing setter on empty jquery object" );
});
testIframe("offset/body", "body", function( $ ) {
expect(4);
equal( $("body").offset().top, 1, "jQuery('#body').offset().top" );
equal( $("body").offset().left, 1, "jQuery('#body').offset().left" );
equal( $("#firstElement").position().left, 5, "$('#firstElement').position().left" );
equal( $("#firstElement").position().top, 5, "$('#firstElement').position().top" );
});
test("chaining", function() {
expect(3);
var coords = { "top": 1, "left": 1 };
equal( jQuery("#absolute-1").offset(coords).selector, "#absolute-1", "offset(coords) returns jQuery object" );
equal( jQuery("#non-existent").offset(coords).selector, "#non-existent", "offset(coords) with empty jQuery set returns jQuery object" );
equal( jQuery("#absolute-1").offset(undefined).selector, "#absolute-1", "offset(undefined) returns jQuery object (#5571)" );
});
test("offsetParent", function(){
expect(13);
var body = jQuery("body").offsetParent();
equal( body.length, 1, "Only one offsetParent found." );
equal( body[0], document.documentElement, "The html element is the offsetParent of the body." );
var header = jQuery("#qunit").offsetParent();
equal( header.length, 1, "Only one offsetParent found." );
equal( header[0], document.documentElement, "The html element is the offsetParent of #qunit." );
var div = jQuery("#nothiddendivchild").offsetParent();
equal( div.length, 1, "Only one offsetParent found." );
equal( div[0], document.getElementById("qunit-fixture"), "The #qunit-fixture is the offsetParent of #nothiddendivchild." );
jQuery("#nothiddendiv").css("position", "relative");
div = jQuery("#nothiddendivchild").offsetParent();
equal( div.length, 1, "Only one offsetParent found." );
equal( div[0], jQuery("#nothiddendiv")[0], "The div is the offsetParent." );
div = jQuery("body, #nothiddendivchild").offsetParent();
equal( div.length, 2, "Two offsetParent found." );
equal( div[0], document.documentElement, "The html element is the offsetParent of the body." );
equal( div[1], jQuery("#nothiddendiv")[0], "The div is the offsetParent." );
var area = jQuery("#imgmap area").offsetParent();
equal( area[0], document.documentElement, "The html element is the offsetParent of the body." );
div = jQuery("<div>").css({ "position": "absolute" }).appendTo("body");
equal( div.offsetParent()[0], document.documentElement, "Absolutely positioned div returns html as offset parent, see #12139" );
div.remove();
});
test("fractions (see #7730 and #7885)", function() {
expect(2);
jQuery("body").append("<div id='fractions'/>");
var expected = { "top": 1000, "left": 1000 };
var div = jQuery("#fractions");
div.css({
"position": "absolute",
"left": "1000.7432222px",
"top": "1000.532325px",
"width": 100,
"height": 100
});
div.offset(expected);
var result = div.offset();
equal( result.top, expected.top, "Check top" );
equal( result.left, expected.left, "Check left" );
div.remove();
});
})();

View File

@@ -0,0 +1,316 @@
module( "queue", { teardown: moduleTeardown });
test( "queue() with other types", 14, function() {
var counter = 0;
stop();
var $div = jQuery({}),
defer;
$div.promise( "foo" ).done(function() {
equal( counter, 0, "Deferred for collection with no queue is automatically resolved" );
});
$div
.queue("foo",function(){
equal( ++counter, 1, "Dequeuing" );
jQuery.dequeue(this,"foo");
})
.queue("foo",function(){
equal( ++counter, 2, "Dequeuing" );
jQuery(this).dequeue("foo");
})
.queue("foo",function(){
equal( ++counter, 3, "Dequeuing" );
})
.queue("foo",function(){
equal( ++counter, 4, "Dequeuing" );
});
defer = $div.promise("foo").done(function() {
equal( counter, 4, "Testing previous call to dequeue in deferred" );
start();
});
equal( $div.queue("foo").length, 4, "Testing queue length" );
equal( $div.queue("foo", undefined).queue("foo").length, 4, ".queue('name',undefined) does nothing but is chainable (#5571)");
$div.dequeue("foo");
equal( counter, 3, "Testing previous call to dequeue" );
equal( $div.queue("foo").length, 1, "Testing queue length" );
$div.dequeue("foo");
equal( counter, 4, "Testing previous call to dequeue" );
equal( $div.queue("foo").length, 0, "Testing queue length" );
$div.dequeue("foo");
equal( counter, 4, "Testing previous call to dequeue" );
equal( $div.queue("foo").length, 0, "Testing queue length" );
});
test("queue(name) passes in the next item in the queue as a parameter", function() {
expect(2);
var div = jQuery({});
var counter = 0;
div.queue("foo", function(next) {
equal(++counter, 1, "Dequeueing");
next();
}).queue("foo", function(next) {
equal(++counter, 2, "Next was called");
next();
}).queue("bar", function() {
equal(++counter, 3, "Other queues are not triggered by next()");
});
div.dequeue("foo");
});
test("queue() passes in the next item in the queue as a parameter to fx queues", function() {
expect(3);
stop();
var div = jQuery({});
var counter = 0;
div.queue(function(next) {
equal(++counter, 1, "Dequeueing");
var self = this;
setTimeout(function() { next(); }, 500);
}).queue(function(next) {
equal(++counter, 2, "Next was called");
next();
}).queue("bar", function() {
equal(++counter, 3, "Other queues are not triggered by next()");
});
jQuery.when( div.promise("fx"), div ).done(function() {
equal(counter, 2, "Deferreds resolved");
start();
});
});
test("callbacks keep their place in the queue", function() {
expect(5);
stop();
var div = jQuery("<div>"),
counter = 0;
div.queue(function( next ) {
equal( ++counter, 1, "Queue/callback order: first called" );
setTimeout( next, 200 );
}).delay( 100 ).queue(function( next ) {
equal( ++counter, 2, "Queue/callback order: second called" );
jQuery( this ).delay( 100 ).queue(function( next ) {
equal( ++counter, 4, "Queue/callback order: fourth called" );
next();
});
next();
}).queue(function( next ) {
equal( ++counter, 3, "Queue/callback order: third called" );
next();
});
div.promise("fx").done(function() {
equal(counter, 4, "Deferreds resolved");
start();
});
});
test("delay()", function() {
expect(2);
stop();
var foo = jQuery({}), run = 0;
foo.delay(100).queue(function(){
run = 1;
ok( true, "The function was dequeued." );
start();
});
equal( run, 0, "The delay delayed the next function from running." );
});
test("clearQueue(name) clears the queue", function() {
expect(2);
stop();
var div = jQuery({});
var counter = 0;
div.queue("foo", function(next) {
counter++;
jQuery(this).clearQueue("foo");
next();
}).queue("foo", function(next) {
counter++;
});
div.promise("foo").done(function() {
ok( true, "dequeue resolves the deferred" );
start();
});
div.dequeue("foo");
equal(counter, 1, "the queue was cleared");
});
test("clearQueue() clears the fx queue", function() {
expect(1);
var div = jQuery({});
var counter = 0;
div.queue(function(next) {
counter++;
var self = this;
setTimeout(function() { jQuery(self).clearQueue(); next(); }, 50);
}).queue(function(next) {
counter++;
});
equal(counter, 1, "the queue was cleared");
div.removeData();
});
asyncTest( "fn.promise() - called when fx queue is empty", 3, function() {
var foo = jQuery( "#foo" ).clone().andSelf(),
promised = false;
foo.queue( function( next ) {
// called twice!
ok( !promised, "Promised hasn't been called" );
setTimeout( next, 10 );
});
foo.promise().done( function() {
ok( promised = true, "Promised" );
start();
});
});
asyncTest( "fn.promise( \"queue\" ) - called whenever last queue function is dequeued", 5, function() {
var foo = jQuery( "#foo" ),
test;
foo.promise( "queue" ).done( function() {
strictEqual( test, undefined, "called immediately when queue was already empty" );
});
test = 1;
foo.queue( "queue", function( next ) {
strictEqual( test++, 1, "step one" );
setTimeout( next, 0 );
}).queue( "queue", function( next ) {
strictEqual( test++, 2, "step two" );
setTimeout( function() {
next();
strictEqual( test++, 4, "step four" );
start();
}, 10 );
}).promise( "queue" ).done( function() {
strictEqual( test++, 3, "step three" );
});
foo.dequeue( "queue" );
});
asyncTest( "fn.promise( \"queue\" ) - waits for animation to complete before resolving", 2, function() {
var foo = jQuery( "#foo" ),
test = 1;
foo.animate({
top: 100
}, {
duration: 1,
queue: "queue",
complete: function() {
strictEqual( test++, 1, "step one" );
}
}).dequeue( "queue" );
foo.promise( "queue" ).done( function() {
strictEqual( test++, 2, "step two" );
start();
});
});
test( ".promise(obj)", function() {
expect(2);
var obj = {};
var promise = jQuery( "#foo" ).promise( "promise", obj );
ok( jQuery.isFunction( promise.promise ), ".promise(type, obj) returns a promise" );
strictEqual( promise, obj, ".promise(type, obj) returns obj" );
});
if ( jQuery.fn.stop ) {
test("delay() can be stopped", function() {
expect( 3 );
stop();
var done = {};
jQuery({})
.queue( "alternate", function( next ) {
done.alt1 = true;
ok( true, "This first function was dequeued" );
next();
})
.delay( 1000, "alternate" )
.queue( "alternate", function() {
done.alt2 = true;
ok( true, "The function was dequeued immediately, the delay was stopped" );
})
.dequeue( "alternate" )
// stop( "alternate", false ) will NOT clear the queue, so it should automatically dequeue the next
.stop( "alternate", false, false )
// this test
.delay( 1 )
.queue(function() {
done.default1 = true;
ok( false, "This queue should never run" );
})
// stop( clearQueue ) should clear the queue
.stop( true, false );
deepEqual( done, { alt1: true, alt2: true }, "Queue ran the proper functions" );
setTimeout(function() {
start();
}, 1500 );
});
asyncTest( "queue stop hooks", 2, function() {
var foo = jQuery( "#foo" );
foo.queue( function( next, hooks ) {
hooks.stop = function( gotoEnd ) {
equal( !!gotoEnd, false, "Stopped without gotoEnd" );
};
});
foo.stop();
foo.queue( function( next, hooks ) {
hooks.stop = function( gotoEnd ) {
equal( gotoEnd, true, "Stopped with gotoEnd" );
start();
};
});
foo.stop( false, true );
});
} // if ( jQuery.fn.stop )

View File

@@ -0,0 +1,185 @@
module("selector", { teardown: moduleTeardown });
/**
* This test page is for selector tests that require jQuery in order to do the selection
*/
test("element - jQuery only", function() {
expect( 7 );
var fixture = document.getElementById("qunit-fixture");
deepEqual( jQuery("p", fixture).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a Node context." );
deepEqual( jQuery("p", "#qunit-fixture").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a selector context." );
deepEqual( jQuery("p", jQuery("#qunit-fixture")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a jQuery object context." );
deepEqual( jQuery("#qunit-fixture").find("p").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context via .find()." );
ok( jQuery("#length").length, "<input name=\"length\"> cannot be found under IE, see #945" );
ok( jQuery("#lengthtest input").length, "<input name=\"length\"> cannot be found under IE, see #945" );
// #7533
equal( jQuery("<div id=\"A'B~C.D[E]\"><p>foo</p></div>").find("p").length, 1, "Find where context root is a node and has an ID with CSS3 meta characters" );
});
test("class - jQuery only", function() {
expect( 4 );
deepEqual( jQuery(".blog", document.getElementsByTagName("p")).get(), q("mark", "simon"), "Finding elements with a context." );
deepEqual( jQuery(".blog", "p").get(), q("mark", "simon"), "Finding elements with a context." );
deepEqual( jQuery(".blog", jQuery("p")).get(), q("mark", "simon"), "Finding elements with a context." );
deepEqual( jQuery("p").find(".blog").get(), q("mark", "simon"), "Finding elements with a context." );
});
test("attributes - jQuery only", function() {
expect( 6 );
t( "Find elements with a tabindex attribute", "[tabindex]", ["listWithTabIndex", "foodWithNegativeTabIndex", "linkWithTabIndex", "linkWithNegativeTabIndex", "linkWithNoHrefWithTabIndex", "linkWithNoHrefWithNegativeTabIndex"] );
// #12523
deepEqual(
jQuery.find( "[title]", null, null, jQuery("#qunit-fixture a").get().concat( document.createTextNode("") ) ),
q("google"),
"Text nodes fail attribute tests without exception"
);
// #12600
ok(
jQuery("<select value='12600'><option value='option' selected='selected'></option><option value=''></option></select>")
.prop( "value", "option" )
.is(":input[value='12600']"),
":input[value=foo] selects select by attribute"
);
ok( jQuery("<input type='text' value='12600'/>").prop( "value", "option" ).is(":input[value='12600']"),
":input[value=foo] selects text input by attribute"
);
// #11115
ok( jQuery("<input type='checkbox' checked='checked'/>").prop( "checked", false ).is("[checked]"),
"[checked] selects by attribute (positive)"
);
ok( !jQuery("<input type='checkbox'/>").prop( "checked", true ).is("[checked]"),
"[checked] selects by attribute (negative)"
);
});
test("disconnected nodes", function() {
expect( 4 );
var $opt = jQuery("<option></option>").attr("value", "whipit").appendTo("#qunit-fixture").detach();
equal( $opt.val(), "whipit", "option value" );
equal( $opt.is(":selected"), false, "unselected option" );
$opt.prop("selected", true);
equal( $opt.is(":selected"), true, "selected option" );
var $div = jQuery("<div/>");
equal( $div.is("div"), true, "Make sure .is('nodeName') works on disconnected nodes." );
});
test("jQuery only - broken", 1, function() {
raises(function() {
// Setting context to null here somehow avoids QUnit's window.error handling
// making the e & e.message correct
// For whatever reason, without this,
// Sizzle.error will be called but no error will be seen in oldIE
jQuery.call( null, " <div/> " );
}, function( e ) {
return e.message.indexOf("Syntax error") >= 0;
}, "leading space invalid: $(' <div/> ')" );
});
testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQuery, window, document ) {
expect( 35 );
/**
* Returns an array of elements with the given IDs
* q & t are added here for the iFrame's context
*/
function q() {
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
* @example t("Check for something", "//[a]", ["foo", "baar"]);
* @param {String} a - Assertion name
* @param {String} b - Sizzle selector
* @param {Array} c - Array of ids to construct what is expected
*/
function t( a, b, c ) {
var f = jQuery(b).get(),
s = "",
i = 0;
for ( ; i < f.length; i++ ) {
s += (s && ",") + "'" + f[i].id + "'";
}
deepEqual(f, q.apply( q, c ), a + " (" + b + ")");
}
// ====== All known boolean attributes, including html5 booleans ======
// autobuffer, autofocus, autoplay, async, checked,
// compact, controls, declare, defer, disabled,
// formnovalidate, hidden, indeterminate (property only),
// ismap, itemscope, loop, multiple, muted, nohref, noresize,
// noshade, nowrap, novalidate, open, pubdate, readonly, required,
// reversed, scoped, seamless, selected, truespeed, visible (skipping visible attribute, which is on a barprop object)
t( "Attribute Exists", "[autobuffer]", ["video1"]);
t( "Attribute Exists", "[autofocus]", ["text1"]);
t( "Attribute Exists", "[autoplay]", ["video1"]);
t( "Attribute Exists", "[async]", ["script1"]);
t( "Attribute Exists", "[checked]", ["check1"]);
t( "Attribute Exists", "[compact]", ["dl"]);
t( "Attribute Exists", "[controls]", ["video1"]);
t( "Attribute Exists", "[declare]", ["object1"]);
t( "Attribute Exists", "[defer]", ["script1"]);
t( "Attribute Exists", "[disabled]", ["check1"]);
t( "Attribute Exists", "[formnovalidate]", ["form1"]);
t( "Attribute Exists", "[hidden]", ["div1"]);
t( "Attribute Exists", "[indeterminate]", []);
t( "Attribute Exists", "[ismap]", ["img1"]);
t( "Attribute Exists", "[itemscope]", ["div1"]);
// t( "Attribute Exists", "[loop]", ["video1"]); // IE 6/7 cannot differentiate here. loop is also used on img, input, and marquee tags as well as video/audio. getAttributeNode unfortunately also retrieves the property value.
t( "Attribute Exists", "[multiple]", ["select1"]);
t( "Attribute Exists", "[muted]", ["audio1"]);
// t( "Attribute Exists", "[nohref]", ["area1"]); // IE 6/7 keep this set to false regardless of presence. The attribute node is not retrievable.
t( "Attribute Exists", "[noresize]", ["textarea1"]);
t( "Attribute Exists", "[noshade]", ["hr1"]);
t( "Attribute Exists", "[nowrap]", ["td1", "div1"]);
t( "Attribute Exists", "[novalidate]", ["form1"]);
t( "Attribute Exists", "[open]", ["details1"]);
t( "Attribute Exists", "[pubdate]", ["article1"]);
t( "Attribute Exists", "[readonly]", ["text1"]);
t( "Attribute Exists", "[required]", ["text1"]);
t( "Attribute Exists", "[reversed]", ["ol1"]);
t( "Attribute Exists", "[scoped]", ["style1"]);
t( "Attribute Exists", "[seamless]", ["iframe1"]);
t( "Attribute Exists", "[selected]", ["option1"]);
t( "Attribute Exists", "[truespeed]", ["marquee1"]);
// Enumerated attributes (these are not boolean content attributes)
jQuery.expandedEach = jQuery.each;
jQuery.expandedEach([ "draggable", "contenteditable", "aria-disabled" ], function( i, val ) {
t( "Enumerated attribute", "[" + val + "]", ["div1"]);
});
t( "Enumerated attribute", "[spellcheck]", ["span1"]);
// t( "tabindex selector does not retrieve all elements in IE6/7(#8473)", "form, [tabindex]", ["form1", "text1"] ); // sigh, FF12 QSA mistakenly includes video elements even though they have no tabindex attribute (see https://bugzilla.mozilla.org/show_bug.cgi?id=618737)
t( "Improperly named form elements do not interfere with form selections (#9570)", "form[name='formName']", ["form1"] );
});
testIframe("selector/sizzle_cache", "Sizzle cache collides with multiple Sizzles on a page", function( jQuery, window, document ) {
var $cached = window["$cached"];
expect(3);
deepEqual( $cached(".test a").get(), [ document.getElementById("collision") ], "Select collision anchor with first sizzle" );
equal( jQuery(".evil a").length, 0, "Select nothing with second sizzle" );
equal( jQuery(".evil a").length, 0, "Select nothing again with second sizzle" );
});

View File

@@ -0,0 +1,146 @@
module("serialize", { teardown: moduleTeardown });
test("jQuery.param()", function() {
expect(22);
equal( !( jQuery.ajaxSettings && jQuery.ajaxSettings.traditional ), true, "traditional flag, falsy by default" );
var params = {"foo":"bar", "baz":42, "quux":"All your base are belong to us"};
equal( jQuery.param(params), "foo=bar&baz=42&quux=All+your+base+are+belong+to+us", "simple" );
params = {"string":"foo","null":null,"undefined":undefined};
equal( jQuery.param(params), "string=foo&null=&undefined=", "handle nulls and undefineds properly" );
params = {"someName": [1, 2, 3], "regularThing": "blah" };
equal( jQuery.param(params), "someName%5B%5D=1&someName%5B%5D=2&someName%5B%5D=3&regularThing=blah", "with array" );
params = {"foo": ["a", "b", "c"]};
equal( jQuery.param(params), "foo%5B%5D=a&foo%5B%5D=b&foo%5B%5D=c", "with array of strings" );
params = {"foo": ["baz", 42, "All your base are belong to us"] };
equal( jQuery.param(params), "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All+your+base+are+belong+to+us", "more array" );
params = {"foo": { "bar": "baz", "beep": 42, "quux": "All your base are belong to us" } };
equal( jQuery.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" );
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
equal( decodeURIComponent( jQuery.param(params) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=&i[]=10&i[]=11&j=true&k=false&l[]=&l[]=0&m=cowboy+hat?", "huge structure" );
params = { "a": [ 0, [ 1, 2 ], [ 3, [ 4, 5 ], [ 6 ] ], { "b": [ 7, [ 8, 9 ], [ { "c": 10, "d": 11 } ], [ [ 12 ] ], [ [ [ 13 ] ] ], { "e": { "f": { "g": [ 14, [ 15 ] ] } } }, 16 ] }, 17 ] };
equal( decodeURIComponent( jQuery.param(params) ), "a[]=0&a[1][]=1&a[1][]=2&a[2][]=3&a[2][1][]=4&a[2][1][]=5&a[2][2][]=6&a[3][b][]=7&a[3][b][1][]=8&a[3][b][1][]=9&a[3][b][2][0][c]=10&a[3][b][2][0][d]=11&a[3][b][3][0][]=12&a[3][b][4][0][0][]=13&a[3][b][5][e][f][g][]=14&a[3][b][5][e][f][g][1][]=15&a[3][b][]=16&a[]=17", "nested arrays" );
params = { "a":[1,2], "b":{ "c":3, "d":[4,5], "e":{ "x":[6], "y":7, "z":[8,9] }, "f":true, "g":false, "h":undefined }, "i":[10,11], "j":true, "k":false, "l":[undefined,0], "m":"cowboy hat?" };
equal( jQuery.param(params,true), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=&l=0&m=cowboy+hat%3F", "huge structure, forced traditional" );
equal( decodeURIComponent( jQuery.param({ "a": [1,2,3], "b[]": [4,5,6], "c[d]": [7,8,9], "e": { "f": [10], "g": [11,12], "h": 13 } }) ), "a[]=1&a[]=2&a[]=3&b[]=4&b[]=5&b[]=6&c[d][]=7&c[d][]=8&c[d][]=9&e[f][]=10&e[g][]=11&e[g][]=12&e[h]=13", "Make sure params are not double-encoded." );
// #7945
equal( jQuery.param({"jquery": "1.4.2"}), "jquery=1.4.2", "Check that object with a jQuery property get serialized correctly" );
var settings = { traditional: true };
if ( jQuery.ajaxSettings ) {
jQuery.ajaxSetup( settings );
} else {
jQuery.ajaxSettings = settings;
}
params = {"foo":"bar", "baz":42, "quux":"All your base are belong to us"};
equal( jQuery.param(params), "foo=bar&baz=42&quux=All+your+base+are+belong+to+us", "simple" );
params = {"someName": [1, 2, 3], "regularThing": "blah" };
equal( jQuery.param(params), "someName=1&someName=2&someName=3&regularThing=blah", "with array" );
params = {"foo": ["a", "b", "c"]};
equal( jQuery.param(params), "foo=a&foo=b&foo=c", "with array of strings" );
params = {"foo[]":["baz", 42, "All your base are belong to us"]};
equal( jQuery.param(params), "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All+your+base+are+belong+to+us", "more array" );
params = {"foo[bar]":"baz", "foo[beep]":42, "foo[quux]":"All your base are belong to us"};
equal( jQuery.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" );
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
equal( jQuery.param(params), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=&l=0&m=cowboy+hat%3F", "huge structure" );
params = { "a": [ 0, [ 1, 2 ], [ 3, [ 4, 5 ], [ 6 ] ], { "b": [ 7, [ 8, 9 ], [ { "c": 10, d: 11 } ], [ [ 12 ] ], [ [ [ 13 ] ] ], { "e": { "f": { "g": [ 14, [ 15 ] ] } } }, 16 ] }, 17 ] };
equal( jQuery.param(params), "a=0&a=1%2C2&a=3%2C4%2C5%2C6&a=%5Bobject+Object%5D&a=17", "nested arrays (not possible when jQuery.param.traditional == true)" );
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
equal( decodeURIComponent( jQuery.param(params,false) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=&i[]=10&i[]=11&j=true&k=false&l[]=&l[]=0&m=cowboy+hat?", "huge structure, forced not traditional" );
params = { "param1": null };
equal( jQuery.param(params,false), "param1=", "Make sure that null params aren't traversed." );
params = {"test": {"length": 3, "foo": "bar"} };
equal( jQuery.param( params, false ), "test%5Blength%5D=3&test%5Bfoo%5D=bar", "Sub-object with a length property" );
if ( jQuery.ajaxSettings === settings ) {
delete jQuery.ajaxSettings;
} else {
jQuery.ajaxSetup({ traditional: false });
}
});
test("jQuery.param() Constructed prop values", function() {
expect( 4 );
/** @constructor */
function Record() {
this["prop"] = "val";
}
var MyString = String,
MyNumber = Number,
params = { "test": new MyString("foo") };
equal( jQuery.param( params, false ), "test=foo", "Do not mistake new String() for a plain object" );
params = { "test": new MyNumber(5) };
equal( jQuery.param( params, false ), "test=5", "Do not mistake new Number() for a plain object" );
params = { "test": new Date() };
ok( jQuery.param( params, false ), "(Non empty string returned) Do not mistake new Date() for a plain object" );
// should allow non-native constructed objects
params = { "test": new Record() };
equal( jQuery.param( params, false ), jQuery.param({ "test": { "prop": "val" } }), "Allow non-native constructed objects" );
});
test("serialize()", function() {
expect(5);
// Add html5 elements only for serialize because selector can't yet find them on non-html5 browsers
jQuery("#search").after(
"<input type='email' id='html5email' name='email' value='dave@jquery.com' />" +
"<input type='number' id='html5number' name='number' value='43' />" +
"<input type='file' name='fileupload' />"
);
equal( jQuery("#form").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3",
"Check form serialization as query string");
equal( jQuery("#form :input").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3",
"Check input serialization as query string");
equal( jQuery("#testForm").serialize(),
"T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Check form serialization as query string");
equal( jQuery("#testForm :input").serialize(),
"T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Check input serialization as query string");
equal( jQuery("#form, #testForm").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Multiple form serialization as query string");
/* Temporarily disabled. Opera 10 has problems with form serialization.
equal( jQuery("#form, #testForm :input").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Mixed form/input serialization as query string");
*/
jQuery("#html5email, #html5number").remove();
});

View File

@@ -0,0 +1,384 @@
module("support", { teardown: moduleTeardown });
test("boxModel", function() {
expect( 1 );
equal( jQuery.support.boxModel, document.compatMode === "CSS1Compat" , "jQuery.support.boxModel is sort of tied to quirks mode but unstable since 1.8" );
});
test( "zoom of doom (#13089)", function() {
expect( 1 );
if ( jQuery.support.inlineBlockNeedsLayout ) {
ok( document.body.style.zoom, "Added a zoom to the body (#11048, #12869)" );
} else {
ok( !document.body.style.zoom, "No zoom added to the body" );
}
});
if ( jQuery.css ) {
testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9239)", "support/bodyBackground.html", function( color, support ) {
expect( 2 );
var i,
passed = true,
okValue = {
"#000000": true,
"rgb(0, 0, 0)": true
};
ok( okValue[ color ], "color was not reset (" + color + ")" );
for ( i in jQuery.support ) {
if ( jQuery.support[ i ] !== support[ i ] ) {
passed = false;
strictEqual( jQuery.support[ i ], support[ i ], "Support property " + i + " is different" );
}
}
for ( i in support ) {
if ( !( i in jQuery.support ) ) {
passed = false;
strictEqual( jQuery.support[ i ], support[ i ], "Unexpected property: " + i );
}
}
ok( passed, "Same support properties" );
});
}
testIframeWithCallback( "A background on the testElement does not cause IE8 to crash (#9823)", "support/testElementCrash.html", function() {
expect(1);
ok( true, "IE8 does not crash" );
});
testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlocks", "support/shrinkWrapBlocks.html", function( shrinkWrapBlocks ) {
expect( 1 );
strictEqual( shrinkWrapBlocks, jQuery.support.shrinkWrapBlocks, "jQuery.support.shrinkWrapBlocks properties are the same" );
});
(function() {
var expected,
userAgent = window.navigator.userAgent;
// These tests do not have to stay
// They are here to help with upcoming support changes for 1.8
if ( /chrome/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
"htmlSerialize":true,
"style":true,
"hrefNormalized":true,
"opacity":true,
"cssFloat":true,
"checkOn":true,
"optSelected":true,
"getSetAttribute":true,
"enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,
"focusinBubbles":false,
"deleteExpando":true,
"noCloneEvent":true,
"inlineBlockNeedsLayout":false,
"shrinkWrapBlocks":false,
"reliableMarginRight":true,
"noCloneChecked":true,
"optDisabled":true,
"radioValue":true,
"checkClone":true,
"appendChecked":true,
"boxModel":true,
"reliableHiddenOffsets":true,
"ajax":true,
"cors":true,
"doesNotIncludeMarginInBodyOffset":true,
"clearCloneStyle": true
};
} else if ( /opera.*version\/12\.1/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
"htmlSerialize":true,
"style":true,
"hrefNormalized":true,
"opacity":true,
"cssFloat":true,
"checkOn":true,
"optSelected":true,
"getSetAttribute":true,
"enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,
"focusinBubbles":false,
"deleteExpando":true,
"noCloneEvent":true,
"inlineBlockNeedsLayout":false,
"shrinkWrapBlocks":false,
"reliableMarginRight":true,
"noCloneChecked":true,
"optDisabled":true,
"radioValue":false,
"checkClone":true,
"appendChecked":true,
"boxModel":true,
"reliableHiddenOffsets":true,
"ajax":true,
"cors":true,
"doesNotIncludeMarginInBodyOffset":true,
"clearCloneStyle": true
};
} else if ( /msie 10\.0/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
"htmlSerialize":true,
"style":true,
"hrefNormalized":true,
"opacity":true,
"cssFloat":true,
"checkOn":true,
"optSelected":false,
"getSetAttribute":true,
"enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,
"focusinBubbles":true,
"deleteExpando":true,
"noCloneEvent":true,
"inlineBlockNeedsLayout":false,
"shrinkWrapBlocks":false,
"reliableMarginRight":true,
"noCloneChecked":false,
"optDisabled":true,
"radioValue":false,
"checkClone":true,
"appendChecked":true,
"boxModel":true,
"reliableHiddenOffsets":true,
"ajax":true,
"cors":true,
"doesNotIncludeMarginInBodyOffset":true,
"clearCloneStyle": false
};
} else if ( /msie 9\.0/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
"htmlSerialize":true,
"style":true,
"hrefNormalized":true,
"opacity":true,
"cssFloat":true,
"checkOn":true,
"optSelected":false,
"getSetAttribute":true,
"enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,
"focusinBubbles":true,
"deleteExpando":true,
"noCloneEvent":true,
"inlineBlockNeedsLayout":false,
"shrinkWrapBlocks":false,
"reliableMarginRight":true,
"noCloneChecked":false,
"optDisabled":true,
"radioValue":false,
"checkClone":true,
"appendChecked":true,
"boxModel":true,
"reliableHiddenOffsets":true,
"ajax":true,
"cors":false,
"doesNotIncludeMarginInBodyOffset":true,
"clearCloneStyle": false
};
} else if ( /msie 8\.0/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":false,
"tbody":true,
"htmlSerialize":false,
"style":false,
"hrefNormalized":true,
"opacity":false,
"cssFloat":false,
"checkOn":true,
"optSelected":false,
"getSetAttribute":true,
"enctype":true,
"html5Clone":false,
"submitBubbles":false,
"changeBubbles":false,
"focusinBubbles":true,
"deleteExpando":false,
"noCloneEvent":false,
"inlineBlockNeedsLayout":false,
"shrinkWrapBlocks":false,
"reliableMarginRight":true,
"noCloneChecked":false,
"optDisabled":true,
"radioValue":false,
"checkClone":true,
"appendChecked":true,
"boxModel":true,
"reliableHiddenOffsets":false,
"ajax":true,
"cors":false,
"doesNotIncludeMarginInBodyOffset":true,
"clearCloneStyle": true
};
} else if ( /msie 7\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": false,
"boxModel": true,
"changeBubbles": false,
"checkClone": false,
"checkOn": true,
"cors": false,
"cssFloat": false,
"deleteExpando": false,
"doesNotIncludeMarginInBodyOffset": true,
"enctype": true,
"focusinBubbles": true,
"getSetAttribute": false,
"hrefNormalized": false,
"html5Clone": false,
"htmlSerialize": false,
"inlineBlockNeedsLayout": true,
"leadingWhitespace": false,
"noCloneChecked": false,
"noCloneEvent": false,
"opacity": false,
"optDisabled": true,
"optSelected": false,
"radioValue": false,
"reliableHiddenOffsets": false,
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"submitBubbles": false,
"tbody": false,
"style": false,
"clearCloneStyle": true
};
} else if ( /msie 6\.0/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":false,
"tbody":false,
"htmlSerialize":false,
"style":false,
"hrefNormalized":false,
"opacity":false,
"cssFloat":false,
"checkOn":true,
"optSelected":false,
"getSetAttribute":false,
"enctype":true,
"html5Clone":false,
"submitBubbles":false,
"changeBubbles":false,
"focusinBubbles":true,
"deleteExpando":false,
"noCloneEvent":false,
"inlineBlockNeedsLayout":true,
"shrinkWrapBlocks":true,
"reliableMarginRight":true,
"noCloneChecked":false,
"optDisabled":true,
"radioValue":false,
"checkClone":false,
"appendChecked":false,
"boxModel":true,
"reliableHiddenOffsets":false,
"ajax":true,
"cors":false,
"doesNotIncludeMarginInBodyOffset":true,
"clearCloneStyle": true
};
} else if ( /5\.1\.1 safari/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
"htmlSerialize":true,
"style":true,
"hrefNormalized":true,
"opacity":true,
"cssFloat":true,
"checkOn":false,
"optSelected":true,
"getSetAttribute":true,
"enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,
"focusinBubbles":false,
"deleteExpando":true,
"noCloneEvent":true,
"inlineBlockNeedsLayout":false,
"shrinkWrapBlocks":false,
"reliableMarginRight":true,
"noCloneChecked":true,
"optDisabled":true,
"radioValue":true,
"checkClone":false,
"appendChecked":false,
"boxModel":true,
"reliableHiddenOffsets":true,
"ajax":true,
"cors":true,
"doesNotIncludeMarginInBodyOffset":true,
"clearCloneStyle": true
};
} else if ( /firefox/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
"htmlSerialize":true,
"style":true,
"hrefNormalized":true,
"opacity":true,
"cssFloat":true,
"checkOn":true,
"optSelected":true,
"getSetAttribute":true,
"enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,
"focusinBubbles":false,
"deleteExpando":true,
"noCloneEvent":true,
"inlineBlockNeedsLayout":false,
"shrinkWrapBlocks":false,
"reliableMarginRight":true,
"noCloneChecked":true,
"optDisabled":true,
"radioValue":true,
"checkClone":true,
"appendChecked":true,
"boxModel":true,
"reliableHiddenOffsets":true,
"ajax":true,
"cors":true,
"doesNotIncludeMarginInBodyOffset":true,
"clearCloneStyle": true
};
}
if ( expected ) {
test("Verify that the support tests resolve as expected per browser", function() {
expect( 31 );
for ( var i in expected ) {
if ( jQuery.ajax || i !== "ajax" && i !== "cors" ) {
equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
} else {
ok( true, "no ajax; skipping jQuery.support['" + i + "']" );
}
}
});
}
})();

View File

@@ -0,0 +1,667 @@
module("traversing", { teardown: moduleTeardown });
test( "find(String)", function() {
expect( 7 );
equal( "Yahoo", jQuery("#foo").find(".blogTest").text(), "Check for find" );
// using contents will get comments regular, text, and comment nodes
var j = jQuery("#nonnodes").contents();
equal( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" );
equal( j.find("div").andSelf().length, 3, "Check node,textnode,comment to find zero divs, but preserves pushStack" );
deepEqual( jQuery("#qunit-fixture").find("> div").get(), q( "foo", "nothiddendiv", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" );
deepEqual( jQuery("#qunit-fixture").find("> #foo, > #moretests").get(), q( "foo", "moretests" ), "find child elements" );
deepEqual( jQuery("#qunit-fixture").find("> #foo > p").get(), q( "sndp", "en", "sap" ), "find child elements" );
deepEqual( jQuery("#siblingTest, #siblingfirst").find("+ *").get(), q( "siblingnext", "fx-test-group" ), "ensure document order" );
});
test( "find(node|jQuery object)", function() {
expect( 12 );
var $foo = jQuery("#foo"),
$blog = jQuery(".blogTest"),
$first = jQuery("#first"),
$two = $blog.add( $first ),
$fooTwo = $foo.add( $blog );
equal( $foo.find( $blog ).text(), "Yahoo", "Find with blog jQuery object" );
equal( $foo.find( $blog[ 0 ] ).text(), "Yahoo", "Find with blog node" );
equal( $foo.find( $first ).length, 0, "#first is not in #foo" );
equal( $foo.find( $first[ 0 ]).length, 0, "#first not in #foo (node)" );
ok( $foo.find( $two ).is(".blogTest"), "Find returns only nodes within #foo" );
ok( $fooTwo.find( $blog ).is(".blogTest"), "Blog is part of the collection, but also within foo" );
ok( $fooTwo.find( $blog[ 0 ] ).is(".blogTest"), "Blog is part of the collection, but also within foo(node)" );
equal( $two.find( $foo ).length, 0, "Foo is not in two elements" );
equal( $two.find( $foo[ 0 ] ).length, 0, "Foo is not in two elements(node)" );
equal( $two.find( $first ).length, 0, "first is in the collection and not within two" );
equal( $two.find( $first ).length, 0, "first is in the collection and not within two(node)" );
equal( $two.find( $foo[ 0 ] ).andSelf().length, 2, "find preserves the pushStack, see #12009" );
});
test("is(String|undefined)", function() {
expect(30);
ok( jQuery("#form").is("form"), "Check for element: A form must be a form" );
ok( !jQuery("#form").is("div"), "Check for element: A form is not a div" );
ok( jQuery("#mark").is(".blog"), "Check for class: Expected class 'blog'" );
ok( !jQuery("#mark").is(".link"), "Check for class: Did not expect class 'link'" );
ok( jQuery("#simon").is(".blog.link"), "Check for multiple classes: Expected classes 'blog' and 'link'" );
ok( !jQuery("#simon").is(".blogTest"), "Check for multiple classes: Expected classes 'blog' and 'link', but not 'blogTest'" );
ok( jQuery("#en").is("[lang=\"en\"]"), "Check for attribute: Expected attribute lang to be 'en'" );
ok( !jQuery("#en").is("[lang=\"de\"]"), "Check for attribute: Expected attribute lang to be 'en', not 'de'" );
ok( jQuery("#text1").is("[type=\"text\"]"), "Check for attribute: Expected attribute type to be 'text'" );
ok( !jQuery("#text1").is("[type=\"radio\"]"), "Check for attribute: Expected attribute type to be 'text', not 'radio'" );
ok( jQuery("#text2").is(":disabled"), "Check for pseudoclass: Expected to be disabled" );
ok( !jQuery("#text1").is(":disabled"), "Check for pseudoclass: Expected not disabled" );
ok( jQuery("#radio2").is(":checked"), "Check for pseudoclass: Expected to be checked" );
ok( !jQuery("#radio1").is(":checked"), "Check for pseudoclass: Expected not checked" );
ok( jQuery("#foo").is(":has(p)"), "Check for child: Expected a child 'p' element" );
ok( !jQuery("#foo").is(":has(ul)"), "Check for child: Did not expect 'ul' element" );
ok( jQuery("#foo").is(":has(p):has(a):has(code)"), "Check for childs: Expected 'p', 'a' and 'code' child elements" );
ok( !jQuery("#foo").is(":has(p):has(a):has(code):has(ol)"), "Check for childs: Expected 'p', 'a' and 'code' child elements, but no 'ol'" );
ok( !jQuery("#foo").is(0), "Expected false for an invalid expression - 0" );
ok( !jQuery("#foo").is(null), "Expected false for an invalid expression - null" );
ok( !jQuery("#foo").is(""), "Expected false for an invalid expression - \"\"" );
ok( !jQuery("#foo").is(undefined), "Expected false for an invalid expression - undefined" );
ok( !jQuery("#foo").is({ plain: "object" }), "Check passing invalid object" );
// test is() with comma-seperated expressions
ok( jQuery("#en").is("[lang=\"en\"],[lang=\"de\"]"), "Comma-seperated; Check for lang attribute: Expect en or de" );
ok( jQuery("#en").is("[lang=\"de\"],[lang=\"en\"]"), "Comma-seperated; Check for lang attribute: Expect en or de" );
ok( jQuery("#en").is("[lang=\"en\"] , [lang=\"de\"]"), "Comma-seperated; Check for lang attribute: Expect en or de" );
ok( jQuery("#en").is("[lang=\"de\"] , [lang=\"en\"]"), "Comma-seperated; Check for lang attribute: Expect en or de" );
ok( !jQuery(window).is("a"), "Checking is on a window does not throw an exception(#10178)" );
ok( !jQuery(document).is("a"), "Checking is on a document does not throw an exception(#10178)" );
ok( jQuery("#option1b").is("#select1 option:not(:first)"), "POS inside of :not() (#10970)" );
});
test("is(jQuery)", function() {
expect(21);
ok( jQuery("#form").is( jQuery("form") ), "Check for element: A form is a form" );
ok( !jQuery("#form").is( jQuery("div") ), "Check for element: A form is not a div" );
ok( jQuery("#mark").is( jQuery(".blog") ), "Check for class: Expected class 'blog'" );
ok( !jQuery("#mark").is( jQuery(".link") ), "Check for class: Did not expect class 'link'" );
ok( jQuery("#simon").is( jQuery(".blog.link") ), "Check for multiple classes: Expected classes 'blog' and 'link'" );
ok( !jQuery("#simon").is( jQuery(".blogTest") ), "Check for multiple classes: Expected classes 'blog' and 'link', but not 'blogTest'" );
ok( jQuery("#en").is( jQuery("[lang=\"en\"]") ), "Check for attribute: Expected attribute lang to be 'en'" );
ok( !jQuery("#en").is( jQuery("[lang=\"de\"]") ), "Check for attribute: Expected attribute lang to be 'en', not 'de'" );
ok( jQuery("#text1").is( jQuery("[type=\"text\"]") ), "Check for attribute: Expected attribute type to be 'text'" );
ok( !jQuery("#text1").is( jQuery("[type=\"radio\"]") ), "Check for attribute: Expected attribute type to be 'text', not 'radio'" );
ok( !jQuery("#text1").is( jQuery("input:disabled") ), "Check for pseudoclass: Expected not disabled" );
ok( jQuery("#radio2").is( jQuery("input:checked") ), "Check for pseudoclass: Expected to be checked" );
ok( !jQuery("#radio1").is( jQuery("input:checked") ), "Check for pseudoclass: Expected not checked" );
ok( jQuery("#foo").is( jQuery("div:has(p)") ), "Check for child: Expected a child 'p' element" );
ok( !jQuery("#foo").is( jQuery("div:has(ul)") ), "Check for child: Did not expect 'ul' element" );
// Some raw elements
ok( jQuery("#form").is( jQuery("form")[0] ), "Check for element: A form is a form" );
ok( !jQuery("#form").is( jQuery("div")[0] ), "Check for element: A form is not a div" );
ok( jQuery("#mark").is( jQuery(".blog")[0] ), "Check for class: Expected class 'blog'" );
ok( !jQuery("#mark").is( jQuery(".link")[0] ), "Check for class: Did not expect class 'link'" );
ok( jQuery("#simon").is( jQuery(".blog.link")[0] ), "Check for multiple classes: Expected classes 'blog' and 'link'" );
ok( !jQuery("#simon").is( jQuery(".blogTest")[0] ), "Check for multiple classes: Expected classes 'blog' and 'link', but not 'blogTest'" );
});
test("is() with positional selectors", function() {
expect(23);
var html = jQuery(
"<p id='posp'><a class='firsta' href='#'><em>first</em></a><a class='seconda' href='#'><b>test</b></a><em></em></p>"
).appendTo( "body" ),
isit = function(sel, match, expect) {
equal( jQuery( sel ).is( match ), expect, "jQuery('" + sel + "').is('" + match + "')" );
};
isit( "#posp", "#posp:first", true );
isit( "#posp", "#posp:eq(2)", false );
isit( "#posp", "#posp a:first", false );
isit( "#posp .firsta", "#posp a:first", true );
isit( "#posp .firsta", "#posp a:last", false );
isit( "#posp .firsta", "#posp a:even", true );
isit( "#posp .firsta", "#posp a:odd", false );
isit( "#posp .firsta", "#posp a:eq(0)", true );
isit( "#posp .firsta", "#posp a:eq(9)", false );
isit( "#posp .firsta", "#posp em:eq(0)", false );
isit( "#posp .firsta", "#posp em:first", false );
isit( "#posp .firsta", "#posp:first", false );
isit( "#posp .seconda", "#posp a:first", false );
isit( "#posp .seconda", "#posp a:last", true );
isit( "#posp .seconda", "#posp a:gt(0)", true );
isit( "#posp .seconda", "#posp a:lt(5)", true );
isit( "#posp .seconda", "#posp a:lt(1)", false );
isit( "#posp em", "#posp a:eq(0) em", true );
isit( "#posp em", "#posp a:lt(1) em", true );
isit( "#posp em", "#posp a:gt(1) em", false );
isit( "#posp em", "#posp a:first em", true );
isit( "#posp em", "#posp a em:last", true );
isit( "#posp em", "#posp a em:eq(2)", false );
html.remove();
});
test("index()", function() {
expect( 2 );
equal( jQuery("#text2").index(), 2, "Returns the index of a child amongst its siblings" );
equal( jQuery("<div/>").index(), -1, "Node without parent returns -1" );
});
test("index(Object|String|undefined)", function() {
expect(16);
var elements = jQuery([window, document]),
inputElements = jQuery("#radio1,#radio2,#check1,#check2");
// Passing a node
equal( elements.index(window), 0, "Check for index of elements" );
equal( elements.index(document), 1, "Check for index of elements" );
equal( inputElements.index(document.getElementById("radio1")), 0, "Check for index of elements" );
equal( inputElements.index(document.getElementById("radio2")), 1, "Check for index of elements" );
equal( inputElements.index(document.getElementById("check1")), 2, "Check for index of elements" );
equal( inputElements.index(document.getElementById("check2")), 3, "Check for index of elements" );
equal( inputElements.index(window), -1, "Check for not found index" );
equal( inputElements.index(document), -1, "Check for not found index" );
// Passing a jQuery object
// enabled since [5500]
equal( elements.index( elements ), 0, "Pass in a jQuery object" );
equal( elements.index( elements.eq(1) ), 1, "Pass in a jQuery object" );
equal( jQuery("#form :radio").index( jQuery("#radio2") ), 1, "Pass in a jQuery object" );
// Passing a selector or nothing
// enabled since [6330]
equal( jQuery("#text2").index(), 2, "Check for index amongst siblings" );
equal( jQuery("#form").children().eq(4).index(), 4, "Check for index amongst siblings" );
equal( jQuery("#radio2").index("#form :radio") , 1, "Check for index within a selector" );
equal( jQuery("#form :radio").index( jQuery("#radio2") ), 1, "Check for index within a selector" );
equal( jQuery("#radio2").index("#form :text") , -1, "Check for index not found within a selector" );
});
test("filter(Selector|undefined)", function() {
expect(9);
deepEqual( jQuery("#form input").filter(":checked").get(), q("radio2", "check1"), "filter(String)" );
deepEqual( jQuery("p").filter("#ap, #sndp").get(), q("ap", "sndp"), "filter('String, String')" );
deepEqual( jQuery("p").filter("#ap,#sndp").get(), q("ap", "sndp"), "filter('String,String')" );
deepEqual( jQuery("p").filter(null).get(), [], "filter(null) should return an empty jQuery object");
deepEqual( jQuery("p").filter(undefined).get(), [], "filter(undefined) should return an empty jQuery object");
deepEqual( jQuery("p").filter(0).get(), [], "filter(0) should return an empty jQuery object");
deepEqual( jQuery("p").filter("").get(), [], "filter('') should return an empty jQuery object");
// using contents will get comments regular, text, and comment nodes
var j = jQuery("#nonnodes").contents();
equal( j.filter("span").length, 1, "Check node,textnode,comment to filter the one span" );
equal( j.filter("[name]").length, 0, "Check node,textnode,comment to filter the one span" );
});
test("filter(Function)", function() {
expect(2);
deepEqual( jQuery("#qunit-fixture p").filter(function() {
return !jQuery("a", this).length;
}).get(), q("sndp", "first"), "filter(Function)" );
deepEqual( jQuery("#qunit-fixture p").filter(function(i, elem) { return !jQuery("a", elem).length; }).get(), q("sndp", "first"), "filter(Function) using arg" );
});
test("filter(Element)", function() {
expect(1);
var element = document.getElementById("text1");
deepEqual( jQuery("#form input").filter(element).get(), q("text1"), "filter(Element)" );
});
test("filter(Array)", function() {
expect(1);
var elements = [ document.getElementById("text1") ];
deepEqual( jQuery("#form input").filter(elements).get(), q("text1"), "filter(Element)" );
});
test("filter(jQuery)", function() {
expect(1);
var elements = jQuery("#text1");
deepEqual( jQuery("#form input").filter(elements).get(), q("text1"), "filter(Element)" );
});
test("filter() with positional selectors", function() {
expect(19);
var html = jQuery( "" +
"<p id='posp'>" +
"<a class='firsta' href='#'>" +
"<em>first</em>" +
"</a>" +
"<a class='seconda' href='#'>" +
"<b>test</b>" +
"</a>" +
"<em></em>" +
"</p>" ).appendTo( "body" ),
filterit = function(sel, filter, length) {
equal( jQuery( sel ).filter( filter ).length, length, "jQuery( " + sel + " ).filter( " + filter + " )" );
};
filterit( "#posp", "#posp:first", 1);
filterit( "#posp", "#posp:eq(2)", 0 );
filterit( "#posp", "#posp a:first", 0 );
// Keep in mind this is within the selection and
// not in relation to other elements (.is() is a different story)
filterit( "#posp .firsta", "#posp a:first", 1 );
filterit( "#posp .firsta", "#posp a:last", 1 );
filterit( "#posp .firsta", "#posp a:last-child", 0 );
filterit( "#posp .firsta", "#posp a:even", 1 );
filterit( "#posp .firsta", "#posp a:odd", 0 );
filterit( "#posp .firsta", "#posp a:eq(0)", 1 );
filterit( "#posp .firsta", "#posp a:eq(9)", 0 );
filterit( "#posp .firsta", "#posp em:eq(0)", 0 );
filterit( "#posp .firsta", "#posp em:first", 0 );
filterit( "#posp .firsta", "#posp:first", 0 );
filterit( "#posp .seconda", "#posp a:first", 1 );
filterit( "#posp .seconda", "#posp em:first", 0 );
filterit( "#posp .seconda", "#posp a:last", 1 );
filterit( "#posp .seconda", "#posp a:gt(0)", 0 );
filterit( "#posp .seconda", "#posp a:lt(5)", 1 );
filterit( "#posp .seconda", "#posp a:lt(1)", 1 );
html.remove();
});
test("closest()", function() {
expect( 14 );
deepEqual( jQuery("body").closest("body").get(), q("body"), "closest(body)" );
deepEqual( jQuery("body").closest("html").get(), q("html"), "closest(html)" );
deepEqual( jQuery("body").closest("div").get(), [], "closest(div)" );
deepEqual( jQuery("#qunit-fixture").closest("span,#html").get(), q("html"), "closest(span,#html)" );
deepEqual( jQuery("#qunit-fixture").closest("div:first").get(), [], "closest(div:first)" );
deepEqual( jQuery("#qunit-fixture div").closest("body:first div:last").get(), q("fx-tests"), "closest(body:first div:last)" );
// Test .closest() limited by the context
var jq = jQuery("#nothiddendivchild");
deepEqual( jq.closest("html", document.body).get(), [], "Context limited." );
deepEqual( jq.closest("body", document.body).get(), [], "Context limited." );
deepEqual( jq.closest("#nothiddendiv", document.body).get(), q("nothiddendiv"), "Context not reached." );
//Test that .closest() returns unique'd set
equal( jQuery("#qunit-fixture p").closest("#qunit-fixture").length, 1, "Closest should return a unique set" );
// Test on disconnected node
equal( jQuery("<div><p></p></div>").find("p").closest("table").length, 0, "Make sure disconnected closest work." );
// Bug #7369
equal( jQuery("<div foo='bar'></div>").closest("[foo]").length, 1, "Disconnected nodes with attribute selector" );
equal( jQuery("<div>text</div>").closest("[lang]").length, 0, "Disconnected nodes with text and non-existent attribute selector" );
ok( !jQuery(document).closest("#foo").length, "Calling closest on a document fails silently" );
});
test("closest(jQuery)", function() {
expect(8);
var $child = jQuery("#nothiddendivchild"),
$parent = jQuery("#nothiddendiv"),
$sibling = jQuery("#foo"),
$body = jQuery("body");
ok( $child.closest( $parent ).is("#nothiddendiv"), "closest( jQuery('#nothiddendiv') )" );
ok( $child.closest( $parent[0] ).is("#nothiddendiv"), "closest( jQuery('#nothiddendiv') ) :: node" );
ok( $child.closest( $child ).is("#nothiddendivchild"), "child is included" );
ok( $child.closest( $child[0] ).is("#nothiddendivchild"), "child is included :: node" );
equal( $child.closest( document.createElement("div") ).length, 0, "created element is not related" );
equal( $child.closest( $sibling ).length, 0, "Sibling not a parent of child" );
equal( $child.closest( $sibling[0] ).length, 0, "Sibling not a parent of child :: node" );
ok( $child.closest( $body.add($parent) ).is("#nothiddendiv"), "Closest ancestor retrieved." );
});
test("not(Selector|undefined)", function() {
expect(11);
equal( jQuery("#qunit-fixture > p#ap > a").not("#google").length, 2, "not('selector')" );
deepEqual( jQuery("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );
deepEqual( jQuery("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" );
deepEqual(
jQuery("#form option").not("option.emptyopt:contains('Nothing'),optgroup *,[value='1']").get(),
q("option1c", "option1d", "option2c", "option2d", "option3c", "option3d", "option3e", "option4d", "option4e", "option5a", "option5b"),
"not('complex selector')"
);
deepEqual( jQuery("#ap *").not("code").get(), q("google", "groups", "anchor1", "mark"), "not('tag selector')" );
deepEqual( jQuery("#ap *").not("code, #mark").get(), q("google", "groups", "anchor1"), "not('tag, ID selector')" );
deepEqual( jQuery("#ap *").not("#mark, code").get(), q("google", "groups", "anchor1"), "not('ID, tag selector')");
var all = jQuery("p").get();
deepEqual( jQuery("p").not(null).get(), all, "not(null) should have no effect");
deepEqual( jQuery("p").not(undefined).get(), all, "not(undefined) should have no effect");
deepEqual( jQuery("p").not(0).get(), all, "not(0) should have no effect");
deepEqual( jQuery("p").not("").get(), all, "not('') should have no effect");
});
test("not(Element)", function() {
expect(1);
var selects = jQuery("#form select");
deepEqual( selects.not( selects[1] ).get(), q("select1", "select3", "select4", "select5"), "filter out DOM element");
});
test("not(Function)", function() {
expect(1);
deepEqual( jQuery("#qunit-fixture p").not(function() { return jQuery("a", this).length; }).get(), q("sndp", "first"), "not(Function)" );
});
test("not(Array)", function() {
expect(2);
equal( jQuery("#qunit-fixture > p#ap > a").not(document.getElementById("google")).length, 2, "not(DOMElement)" );
equal( jQuery("p").not(document.getElementsByTagName("p")).length, 0, "not(Array-like DOM collection)" );
});
test("not(jQuery)", function() {
expect( 1 );
deepEqual( jQuery("p").not(jQuery("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" );
});
test("has(Element)", function() {
expect(3);
var obj = jQuery("#qunit-fixture").has(jQuery("#sndp")[0]);
deepEqual( obj.get(), q("qunit-fixture"), "Keeps elements that have the element as a descendant" );
var detached = jQuery("<a><b><i/></b></a>");
deepEqual( detached.has( detached.find("i")[0] ).get(), detached.get(), "...Even when detached" );
var multipleParent = jQuery("#qunit-fixture, #header").has(jQuery("#sndp")[0]);
deepEqual( obj.get(), q("qunit-fixture"), "Does not include elements that do not have the element as a descendant" );
});
test("has(Selector)", function() {
expect( 5 );
var obj = jQuery("#qunit-fixture").has("#sndp");
deepEqual( obj.get(), q("qunit-fixture"), "Keeps elements that have any element matching the selector as a descendant" );
var detached = jQuery("<a><b><i/></b></a>");
deepEqual( detached.has("i").get(), detached.get(), "...Even when detached" );
var multipleParent = jQuery("#qunit-fixture, #header").has("#sndp");
deepEqual( multipleParent.get(), q("qunit-fixture"), "Does not include elements that do not have the element as a descendant" );
multipleParent = jQuery("#select1, #select2, #select3").has("#option1a, #option3a");
deepEqual( multipleParent.get(), q("select1", "select3"), "Multiple contexts are checks correctly" );
var multipleHas = jQuery("#qunit-fixture").has("#sndp, #first");
deepEqual( multipleHas.get(), q("qunit-fixture"), "Only adds elements once" );
});
test("has(Arrayish)", function() {
expect(4);
var simple = jQuery("#qunit-fixture").has(jQuery("#sndp"));
deepEqual( simple.get(), q("qunit-fixture"), "Keeps elements that have any element in the jQuery list as a descendant" );
var detached = jQuery("<a><b><i/></b></a>");
deepEqual( detached.has( detached.find("i") ).get(), detached.get(), "...Even when detached" );
var multipleParent = jQuery("#qunit-fixture, #header").has(jQuery("#sndp"));
deepEqual( multipleParent.get(), q("qunit-fixture"), "Does not include elements that do not have an element in the jQuery list as a descendant" );
var multipleHas = jQuery("#qunit-fixture").has(jQuery("#sndp, #first"));
deepEqual( simple.get(), q("qunit-fixture"), "Only adds elements once" );
});
test("addBack()", function() {
expect(5);
deepEqual( jQuery("#en").siblings().addBack().get(), q("sndp", "en", "sap"), "Check for siblings and self" );
deepEqual( jQuery("#foo").children().addBack().get(), q("foo", "sndp", "en", "sap"), "Check for children and self" );
deepEqual( jQuery("#sndp, #en").parent().addBack().get(), q("foo","sndp","en"), "Check for parent and self" );
deepEqual( jQuery("#groups").parents("p, div").addBack().get(), q("qunit-fixture", "ap", "groups"), "Check for parents and self" );
deepEqual( jQuery("#select1 > option").filter(":first-child").addBack(":last-child").get(), q("option1a", "option1d"), "Should contain the last elems plus the *filtered* prior set elements" );
});
test("siblings([String])", function() {
expect(7);
deepEqual( jQuery("#en").siblings().get(), q("sndp", "sap"), "Check for siblings" );
deepEqual( jQuery("#sndp").siblings(":has(code)").get(), q("sap"), "Check for filtered siblings (has code child element)" );
deepEqual( jQuery("#sndp").siblings(":has(a)").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
deepEqual( jQuery("#foo").siblings("form, b").get(), q("form", "floatTest", "lengthtest", "name-tests", "testForm"), "Check for multiple filters" );
var set = q("sndp", "en", "sap");
deepEqual( jQuery("#en, #sndp").siblings().get(), set, "Check for unique results from siblings" );
deepEqual( jQuery("#option5a").siblings("option[data-attr]").get(), q("option5c"), "Has attribute selector in siblings (#9261)" );
equal( jQuery("<a/>").siblings().length, 0, "Detached elements have no siblings (#11370)" );
});
test("children([String])", function() {
expect(3);
deepEqual( jQuery("#foo").children().get(), q("sndp", "en", "sap"), "Check for children" );
deepEqual( jQuery("#foo").children(":has(code)").get(), q("sndp", "sap"), "Check for filtered children" );
deepEqual( jQuery("#foo").children("#en, #sap").get(), q("en", "sap"), "Check for multiple filters" );
});
test("parent([String])", function() {
expect(5);
equal( jQuery("#groups").parent()[0].id, "ap", "Simple parent check" );
equal( jQuery("#groups").parent("p")[0].id, "ap", "Filtered parent check" );
equal( jQuery("#groups").parent("div").length, 0, "Filtered parent check, no match" );
equal( jQuery("#groups").parent("div, p")[0].id, "ap", "Check for multiple filters" );
deepEqual( jQuery("#en, #sndp").parent().get(), q("foo"), "Check for unique results from parent" );
});
test("parents([String])", function() {
expect(5);
equal( jQuery("#groups").parents()[0].id, "ap", "Simple parents check" );
equal( jQuery("#groups").parents("p")[0].id, "ap", "Filtered parents check" );
equal( jQuery("#groups").parents("div")[0].id, "qunit-fixture", "Filtered parents check2" );
deepEqual( jQuery("#groups").parents("p, div").get(), q("ap", "qunit-fixture"), "Check for multiple filters" );
deepEqual( jQuery("#en, #sndp").parents().get(), q("foo", "qunit-fixture", "dl", "body", "html"), "Check for unique results from parents" );
});
test("parentsUntil([String])", function() {
expect(9);
var parents = jQuery("#groups").parents();
deepEqual( jQuery("#groups").parentsUntil().get(), parents.get(), "parentsUntil with no selector (nextAll)" );
deepEqual( jQuery("#groups").parentsUntil(".foo").get(), parents.get(), "parentsUntil with invalid selector (nextAll)" );
deepEqual( jQuery("#groups").parentsUntil("#html").get(), parents.not(":last").get(), "Simple parentsUntil check" );
equal( jQuery("#groups").parentsUntil("#ap").length, 0, "Simple parentsUntil check" );
deepEqual( jQuery("#groups").parentsUntil("#html, #body").get(), parents.slice( 0, 3 ).get(), "Less simple parentsUntil check" );
deepEqual( jQuery("#groups").parentsUntil("#html", "div").get(), jQuery("#qunit-fixture").get(), "Filtered parentsUntil check" );
deepEqual( jQuery("#groups").parentsUntil("#html", "p,div,dl").get(), parents.slice( 0, 3 ).get(), "Multiple-filtered parentsUntil check" );
equal( jQuery("#groups").parentsUntil("#html", "span").length, 0, "Filtered parentsUntil check, no match" );
deepEqual( jQuery("#groups, #ap").parentsUntil("#html", "p,div,dl").get(), parents.slice( 0, 3 ).get(), "Multi-source, multiple-filtered parentsUntil check" );
});
test("next([String])", function() {
expect(5);
equal( jQuery("#ap").next()[0].id, "foo", "Simple next check" );
equal( jQuery("#ap").next("div")[0].id, "foo", "Filtered next check" );
equal( jQuery("#ap").next("p").length, 0, "Filtered next check, no match" );
equal( jQuery("#ap").next("div, p")[0].id, "foo", "Multiple filters" );
equal( jQuery("body").next().length, 0, "Simple next check, no match" );
});
test("prev([String])", function() {
expect(4);
equal( jQuery("#foo").prev()[0].id, "ap", "Simple prev check" );
equal( jQuery("#foo").prev("p")[0].id, "ap", "Filtered prev check" );
equal( jQuery("#foo").prev("div").length, 0, "Filtered prev check, no match" );
equal( jQuery("#foo").prev("p, div")[0].id, "ap", "Multiple filters" );
});
test("nextAll([String])", function() {
expect(4);
var elems = jQuery("#form").children();
deepEqual( jQuery("#label-for").nextAll().get(), elems.not(":first").get(), "Simple nextAll check" );
deepEqual( jQuery("#label-for").nextAll("input").get(), elems.not(":first").filter("input").get(), "Filtered nextAll check" );
deepEqual( jQuery("#label-for").nextAll("input,select").get(), elems.not(":first").filter("input,select").get(), "Multiple-filtered nextAll check" );
deepEqual( jQuery("#label-for, #hidden1").nextAll("input,select").get(), elems.not(":first").filter("input,select").get(), "Multi-source, multiple-filtered nextAll check" );
});
test("prevAll([String])", function() {
expect(4);
var elems = jQuery( jQuery("#form").children().slice(0, 12).get().reverse() );
deepEqual( jQuery("#area1").prevAll().get(), elems.get(), "Simple prevAll check" );
deepEqual( jQuery("#area1").prevAll("input").get(), elems.filter("input").get(), "Filtered prevAll check" );
deepEqual( jQuery("#area1").prevAll("input,select").get(), elems.filter("input,select").get(), "Multiple-filtered prevAll check" );
deepEqual( jQuery("#area1, #hidden1").prevAll("input,select").get(), elems.filter("input,select").get(), "Multi-source, multiple-filtered prevAll check" );
});
test("nextUntil([String])", function() {
expect(11);
var elems = jQuery("#form").children().slice( 2, 12 );
deepEqual( jQuery("#text1").nextUntil().get(), jQuery("#text1").nextAll().get(), "nextUntil with no selector (nextAll)" );
deepEqual( jQuery("#text1").nextUntil(".foo").get(), jQuery("#text1").nextAll().get(), "nextUntil with invalid selector (nextAll)" );
deepEqual( jQuery("#text1").nextUntil("#area1").get(), elems.get(), "Simple nextUntil check" );
equal( jQuery("#text1").nextUntil("#text2").length, 0, "Simple nextUntil check" );
deepEqual( jQuery("#text1").nextUntil("#area1, #radio1").get(), jQuery("#text1").next().get(), "Less simple nextUntil check" );
deepEqual( jQuery("#text1").nextUntil("#area1", "input").get(), elems.not("button").get(), "Filtered nextUntil check" );
deepEqual( jQuery("#text1").nextUntil("#area1", "button").get(), elems.not("input").get(), "Filtered nextUntil check" );
deepEqual( jQuery("#text1").nextUntil("#area1", "button,input").get(), elems.get(), "Multiple-filtered nextUntil check" );
equal( jQuery("#text1").nextUntil("#area1", "div").length, 0, "Filtered nextUntil check, no match" );
deepEqual( jQuery("#text1, #hidden1").nextUntil("#area1", "button,input").get(), elems.get(), "Multi-source, multiple-filtered nextUntil check" );
deepEqual( jQuery("#text1").nextUntil("[class=foo]").get(), jQuery("#text1").nextAll().get(), "Non-element nodes must be skipped, since they have no attributes" );
});
test("prevUntil([String])", function() {
expect(10);
var elems = jQuery("#area1").prevAll();
deepEqual( jQuery("#area1").prevUntil().get(), elems.get(), "prevUntil with no selector (prevAll)" );
deepEqual( jQuery("#area1").prevUntil(".foo").get(), elems.get(), "prevUntil with invalid selector (prevAll)" );
deepEqual( jQuery("#area1").prevUntil("label").get(), elems.not(":last").get(), "Simple prevUntil check" );
equal( jQuery("#area1").prevUntil("#button").length, 0, "Simple prevUntil check" );
deepEqual( jQuery("#area1").prevUntil("label, #search").get(), jQuery("#area1").prev().get(), "Less simple prevUntil check" );
deepEqual( jQuery("#area1").prevUntil("label", "input").get(), elems.not(":last").not("button").get(), "Filtered prevUntil check" );
deepEqual( jQuery("#area1").prevUntil("label", "button").get(), elems.not(":last").not("input").get(), "Filtered prevUntil check" );
deepEqual( jQuery("#area1").prevUntil("label", "button,input").get(), elems.not(":last").get(), "Multiple-filtered prevUntil check" );
equal( jQuery("#area1").prevUntil("label", "div").length, 0, "Filtered prevUntil check, no match" );
deepEqual( jQuery("#area1, #hidden1").prevUntil("label", "button,input").get(), elems.not(":last").get(), "Multi-source, multiple-filtered prevUntil check" );
});
test("contents()", function() {
expect(12);
equal( jQuery("#ap").contents().length, 9, "Check element contents" );
ok( jQuery("#iframe").contents()[0], "Check existance of IFrame document" );
var ibody = jQuery("#loadediframe").contents()[0].body;
ok( ibody, "Check existance of IFrame body" );
equal( jQuery("span", ibody).text(), "span text", "Find span in IFrame and check its text" );
jQuery(ibody).append("<div>init text</div>");
equal( jQuery("div", ibody).length, 2, "Check the original div and the new div are in IFrame" );
equal( jQuery("div:last", ibody).text(), "init text", "Add text to div in IFrame" );
jQuery("div:last", ibody).text("div text");
equal( jQuery("div:last", ibody).text(), "div text", "Add text to div in IFrame" );
jQuery("div:last", ibody).remove();
equal( jQuery("div", ibody).length, 1, "Delete the div and check only one div left in IFrame" );
equal( jQuery("div", ibody).text(), "span text", "Make sure the correct div is still left after deletion in IFrame" );
jQuery("<table/>", ibody).append("<tr><td>cell</td></tr>").appendTo(ibody);
jQuery("table", ibody).remove();
equal( jQuery("div", ibody).length, 1, "Check for JS error on add and delete of a table in IFrame" );
// using contents will get comments regular, text, and comment nodes
var c = jQuery("#nonnodes").contents().contents();
equal( c.length, 1, "Check node,textnode,comment contents is just one" );
equal( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" );
});
test("add(String|Element|Array|undefined)", function() {
expect( 15 );
deepEqual( jQuery("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
deepEqual( jQuery("#sndp").add( jQuery("#en")[0] ).add( jQuery("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" );
// We no longer support .add(form.elements), unfortunately.
// There is no way, in browsers, to reliably determine the difference
// between form.elements and form - and doing .add(form) and having it
// add the form elements is way to unexpected, so this gets the boot.
// ok( jQuery([]).add(jQuery("#form")[0].elements).length >= 13, "Check elements from array" );
// For the time being, we're discontinuing support for jQuery(form.elements) since it's ambiguous in IE
// use jQuery([]).add(form.elements) instead.
//equal( jQuery([]).add(jQuery("#form")[0].elements).length, jQuery(jQuery("#form")[0].elements).length, "Array in constructor must equals array in add()" );
var divs = jQuery("<div/>").add("#sndp");
ok( divs[0].parentNode, "Sort with the disconnected node last (started with disconnected first)." );
divs = jQuery("#sndp").add("<div/>");
ok( !divs[1].parentNode, "Sort with the disconnected node last." );
var tmp = jQuery("<div/>");
var x = jQuery([]).add(jQuery("<p id='x1'>xxx</p>").appendTo(tmp)).add(jQuery("<p id='x2'>xxx</p>").appendTo(tmp));
equal( x[0].id, "x1", "Check on-the-fly element1" );
equal( x[1].id, "x2", "Check on-the-fly element2" );
x = jQuery([]).add(jQuery("<p id='x1'>xxx</p>").appendTo(tmp)[0]).add(jQuery("<p id='x2'>xxx</p>").appendTo(tmp)[0]);
equal( x[0].id, "x1", "Check on-the-fly element1" );
equal( x[1].id, "x2", "Check on-the-fly element2" );
x = jQuery([]).add(jQuery("<p id='x1'>xxx</p>")).add(jQuery("<p id='x2'>xxx</p>"));
equal( x[0].id, "x1", "Check on-the-fly element1" );
equal( x[1].id, "x2", "Check on-the-fly element2" );
x = jQuery([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");
equal( x[0].id, "x1", "Check on-the-fly element1" );
equal( x[1].id, "x2", "Check on-the-fly element2" );
var notDefined;
equal( jQuery([]).add(notDefined).length, 0, "Check that undefined adds nothing" );
equal( jQuery([]).add( document.getElementById("form") ).length, 1, "Add a form" );
equal( jQuery([]).add( document.getElementById("select1") ).length, 1, "Add a select" );
});
test("add(String, Context)", function() {
expect(6);
deepEqual( jQuery( "#firstp" ).add( "#ap" ).get(), q( "firstp", "ap" ), "Add selector to selector " );
deepEqual( jQuery( document.getElementById("firstp") ).add( "#ap" ).get(), q( "firstp", "ap" ), "Add gEBId to selector" );
deepEqual( jQuery( document.getElementById("firstp") ).add( document.getElementById("ap") ).get(), q( "firstp", "ap" ), "Add gEBId to gEBId" );
var ctx = document.getElementById("firstp");
deepEqual( jQuery( "#firstp" ).add( "#ap", ctx ).get(), q( "firstp" ), "Add selector to selector " );
deepEqual( jQuery( document.getElementById("firstp") ).add( "#ap", ctx ).get(), q( "firstp" ), "Add gEBId to selector, not in context" );
deepEqual( jQuery( document.getElementById("firstp") ).add( "#ap", document.getElementsByTagName("body")[0] ).get(), q( "firstp", "ap" ), "Add gEBId to selector, in context" );
});
test("eq('-1') #10616", function() {
expect(3);
var $divs = jQuery( "div" );
equal( $divs.eq( -1 ).length, 1, "The number -1 returns a selection that has length 1" );
equal( $divs.eq( "-1" ).length, 1, "The string '-1' returns a selection that has length 1" );
deepEqual( $divs.eq( "-1" ), $divs.eq( -1 ), "String and number -1 match" );
});
test("index(no arg) #10977", function() {
expect(1);
var $list = jQuery("<ul id='indextest'><li>THIS ONE</li><li class='one'>a</li><li class='two'>b</li><li class='three'>c</li></ul>");
jQuery("#qunit-fixture").append( $list );
strictEqual ( jQuery( "#indextest li:not(.one,.two)" ).index() , 0, "No Argument Index Check" );
$list.remove();
});

View File

@@ -0,0 +1,5 @@
<?php
# Load and run the test suite as a proper XHTML page
header("Content-type: application/xhtml+xml");
readfile("index.html");
?>