]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/space-pen/node_modules/jquery/src/sizzle/test/data/testinit.js
1c49c7abadd1eba13afbcc609ab95e287f3e950c
2 jQuery
= this.jQuery
|| "jQuery", // For testing .noConflict()
4 originaljQuery
= jQuery
,
8 // Config parameter to force basic code paths
9 QUnit
.config
.urlConfig
.push({
11 label: "Bypass optimizations",
12 tooltip: "Force use of the most basic code by disabling native querySelectorAll; contains; compareDocumentPosition"
14 if ( QUnit
.urlParams
.basic
) {
15 document
.querySelectorAll
= null;
16 document
.documentElement
.contains
= null;
17 document
.documentElement
.compareDocumentPosition
= null;
18 // Return array of length two to pass assertion
19 // But support should be false as its not native
20 document
.getElementsByClassName = function() { return [ 0, 1 ]; };
25 * Returns an array of elements with the given IDs
26 * @example q("main", "foo", "bar")
27 * @result [<div id="main">, <span id="foo">, <input id="bar">]
33 for ( ; i
< arguments
.length
; i
++ ) {
34 r
.push( document
.getElementById( arguments
[i
] ) );
40 * Asserts that a select matches the given IDs
41 * @param {String} a - Assertion name
42 * @param {String} b - Sizzle selector
43 * @param {String} c - Array of ids to construct what is expected
44 * @example t("Check for something", "//[a]", ["foo", "baar"]);
45 * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
47 function t( a
, b
, c
) {
52 for ( ; i
< f
.length
; i
++ ) {
53 s
+= ( s
&& "," ) + '"' + f
[ i
].id
+ '"';
56 deepEqual(f
, q
.apply( q
, c
), a
+ " (" + b
+ ")");
60 * Add random number to url to stop caching
62 * @example url("data/test.html")
63 * @result "data/test.html?10538358428943"
65 * @example url("data/test.php?foo=bar")
66 * @result "data/test.php?foo=bar&10538358345554"
68 function url( value
) {
69 return value
+ (/\?/.test(value
) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math
.random()*100000);
72 var createWithFriesXML = function() {
73 var string
= '<?xml version="1.0" encoding="UTF-8"?> \
74 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" \
75 xmlns:xsd="http://www.w3.org/2001/XMLSchema" \
76 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> \
78 <jsconf xmlns="http://www.example.com/ns1"> \
79 <response xmlns:ab="http://www.example.com/ns2"> \
81 <component id="seite1" class="component"> \
82 <properties xmlns:cd="http://www.example.com/ns3"> \
83 <property name="prop1"> \
87 <property name="prop2"> \
88 <thing att="something" /> \
90 <foo_bar>foo</foo_bar> \
99 return jQuery
.parseXML( string
);
102 fireNative
= document
.createEvent
?
103 function( node
, type
) {
104 var event
= document
.createEvent("HTMLEvents");
105 event
.initEvent( type
, true, true );
106 node
.dispatchEvent( event
);
108 function( node
, type
) {
109 var event
= document
.createEventObject();
110 node
.fireEvent( "on" + type
, event
);
113 function testIframeWithCallback( title
, fileName
, func
) {
114 test( title
, function() {
118 window
.iframeCallback = function() {
121 setTimeout(function() {
122 window
.iframeCallback
= undefined;
124 func
.apply( self
, args
);
125 func = function() {};
129 iframe
= jQuery( "<div/>" ).css({ position: "absolute", width: "500px", left: "-600px" })
130 .append( jQuery( "<iframe/>" ).attr( "src", url( "./data/" + fileName
) ) )
131 .appendTo( "#qunit-fixture" );
134 window
.iframeCallback
= undefined;
136 function moduleTeardown() {}