2009-09-29 20:06:16 +02:00
|
|
|
var jQuery = this.jQuery || "jQuery", // For testing .noConflict()
|
|
|
|
$ = this.$ || "$",
|
|
|
|
originaljQuery = jQuery,
|
2011-01-05 22:26:05 +01:00
|
|
|
original$ = $;
|
2009-09-29 20:11:10 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an array of elements with the given IDs, eg.
|
|
|
|
* @example q("main", "foo", "bar")
|
|
|
|
* @result [<div id="main">, <span id="foo">, <input id="bar">]
|
|
|
|
*/
|
|
|
|
function q() {
|
|
|
|
var r = [];
|
|
|
|
|
|
|
|
for ( var i = 0; 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"]);
|
|
|
|
* @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baa
|
|
|
|
r'
|
|
|
|
*/
|
|
|
|
function t(a,b,c) {
|
2009-09-29 23:22:35 +02:00
|
|
|
var f = jQuery(b).get(), s = "";
|
2009-09-29 20:11:10 +02:00
|
|
|
|
|
|
|
for ( var i = 0; i < f.length; i++ ) {
|
|
|
|
s += (s && ",") + '"' + f[i].id + '"';
|
|
|
|
}
|
|
|
|
|
2009-09-29 23:22:35 +02:00
|
|
|
same(f, q.apply(q,c), a + " (" + b + ")");
|
2009-09-29 20:11:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add random number to url to stop IE from 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);
|
|
|
|
}
|