jquery_1.7.2+dfsg/ 0000755 0001750 0001750 00000000000 11757032444 013036 5 ustar metal metal jquery_1.7.2+dfsg/Makefile 0000644 0001750 0001750 00000006746 11756724363 014522 0 ustar metal metal SRC_DIR = src
TEST_DIR = test
BUILD_DIR = build
PREFIX = .
DIST_DIR = ${PREFIX}/dist
JS_ENGINE ?= `which node nodejs 2>/dev/null`
COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js
BASE_FILES = ${SRC_DIR}/core.js\
${SRC_DIR}/callbacks.js\
${SRC_DIR}/deferred.js\
${SRC_DIR}/support.js\
${SRC_DIR}/data.js\
${SRC_DIR}/queue.js\
${SRC_DIR}/attributes.js\
${SRC_DIR}/event.js\
${SRC_DIR}/selector.js\
${SRC_DIR}/traversing.js\
${SRC_DIR}/manipulation.js\
${SRC_DIR}/css.js\
${SRC_DIR}/ajax.js\
${SRC_DIR}/ajax/jsonp.js\
${SRC_DIR}/ajax/script.js\
${SRC_DIR}/ajax/xhr.js\
${SRC_DIR}/effects.js\
${SRC_DIR}/offset.js\
${SRC_DIR}/dimensions.js\
${SRC_DIR}/exports.js
MODULES = ${SRC_DIR}/intro.js\
${BASE_FILES}\
${SRC_DIR}/outro.js
JQ = ${DIST_DIR}/jquery.js
JQ_MIN = ${DIST_DIR}/jquery.min.js
SIZZLE_DIR = ${SRC_DIR}/sizzle
JQ_VER = $(shell cat version.txt)
VER = sed "s/@VERSION/${JQ_VER}/"
DATE=$(shell git log -1 --pretty=format:%ad)
all: update_submodules core
core: jquery min hint size
@@echo "jQuery build complete."
${DIST_DIR}:
@@mkdir -p ${DIST_DIR}
jquery: ${JQ}
${JQ}: ${MODULES} | ${DIST_DIR}
@@echo "Building" ${JQ}
@@cat ${MODULES} | \
sed 's/.function..jQuery...{//' | \
sed 's/}...jQuery..;//' | \
sed 's/@DATE/'"${DATE}"'/' | \
${VER} > ${JQ};
${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js
@@echo "Building selector code from Sizzle"
@@sed '/EXPOSE/r src/sizzle-jquery.js' ${SIZZLE_DIR}/sizzle.js | grep -v window.Sizzle > ${SRC_DIR}/selector.js
hint: jquery
@@if test ! -z ${JS_ENGINE}; then \
echo "Checking jQuery against JSHint..."; \
${JS_ENGINE} build/jshint-check.js; \
else \
echo "You must have NodeJS installed in order to test jQuery against JSHint."; \
fi
size: jquery min
@@if test ! -z ${JS_ENGINE}; then \
gzip -c ${JQ_MIN} > ${JQ_MIN}.gz; \
wc -c ${JQ} ${JQ_MIN} ${JQ_MIN}.gz | ${JS_ENGINE} ${BUILD_DIR}/sizer.js; \
rm ${JQ_MIN}.gz; \
else \
echo "You must have NodeJS installed in order to size jQuery."; \
fi
freq: jquery min
@@if test ! -z ${JS_ENGINE}; then \
${JS_ENGINE} ${BUILD_DIR}/freq.js; \
else \
echo "You must have NodeJS installed to report the character frequency of minified jQuery."; \
fi
min: jquery ${JQ_MIN}
${JQ_MIN}: ${JQ}
@@if test ! -z ${JS_ENGINE}; then \
echo "Minifying jQuery" ${JQ_MIN}; \
${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \
${POST_COMPILER} ${JQ_MIN}.tmp; \
rm -f ${JQ_MIN}.tmp; \
else \
echo "You must have NodeJS installed in order to minify jQuery."; \
fi
clean:
@@echo "Removing Distribution directory:" ${DIST_DIR}
@@rm -rf ${DIST_DIR}
@@echo "Removing built copy of Sizzle"
@@rm -f src/selector.js
distclean: clean
@@echo "Removing submodules"
@@rm -rf test/qunit src/sizzle
# change pointers for submodules and update them to what is specified in jQuery
# --merge doesn't work when doing an initial clone, thus test if we have non-existing
# submodules, then do an real update
update_submodules:
@@if [ -d .git ]; then \
if git submodule status | grep -q -E '^-'; then \
git submodule update --init --recursive; \
else \
git submodule update --init --recursive --merge; \
fi; \
fi;
# update the submodules to the latest at the most logical branch
pull_submodules:
@@git submodule foreach "git pull \$$(git config remote.origin.url)"
@@git submodule summary
pull: pull_submodules
@@git pull ${REMOTE} ${BRANCH}
.PHONY: all jquery hint min clean distclean update_submodules pull_submodules pull core
jquery_1.7.2+dfsg/test/ 0000755 0001750 0001750 00000000000 11757032022 014005 5 ustar metal metal jquery_1.7.2+dfsg/test/qunit/ 0000755 0001750 0001750 00000000000 11757032022 015145 5 ustar metal metal jquery_1.7.2+dfsg/test/qunit/.gitignore 0000644 0001750 0001750 00000000060 11757032022 017131 0 ustar metal metal .project
*~
*.diff
*.patch
.DS_Store
.settings
jquery_1.7.2+dfsg/test/qunit/test/ 0000755 0001750 0001750 00000000000 11757032022 016124 5 ustar metal metal jquery_1.7.2+dfsg/test/qunit/test/logs.html 0000644 0001750 0001750 00000001006 11757032022 017753 0 ustar metal metal
QUnit Test Suite
QUnit Test Suite
test markup
jquery_1.7.2+dfsg/test/qunit/test/logs.js 0000644 0001750 0001750 00000005073 11757032022 017433 0 ustar metal metal // TODO disable reordering for this suite!
var begin = 0,
moduleStart = 0,
moduleDone = 0,
testStart = 0,
testDone = 0,
log = 0,
moduleContext,
moduleDoneContext,
testContext,
testDoneContext,
logContext;
QUnit.begin(function() {
begin++;
});
QUnit.done(function() {
});
QUnit.moduleStart(function(context) {
moduleStart++;
moduleContext = context;
});
QUnit.moduleDone(function(context) {
moduleDone++;
moduleDoneContext = context;
});
QUnit.testStart(function(context) {
testStart++;
testContext = context;
});
QUnit.testDone(function(context) {
testDone++;
testDoneContext = context;
});
QUnit.log(function(context) {
log++;
logContext = context;
});
var logs = ["begin", "testStart", "testDone", "log", "moduleStart", "moduleDone", "done"];
for (var i = 0; i < logs.length; i++) {
(function() {
var log = logs[i];
QUnit[log](function() {
console.log(log, arguments);
});
})();
}
module("logs1");
test("test1", 13, function() {
equal(begin, 1);
equal(moduleStart, 1);
equal(testStart, 1);
equal(testDone, 0);
equal(moduleDone, 0);
deepEqual(logContext, {
result: true,
message: undefined,
actual: 0,
expected: 0
});
equal("foo", "foo", "msg");
deepEqual(logContext, {
result: true,
message: "msg",
actual: "foo",
expected: "foo"
});
strictEqual(testDoneContext, undefined);
deepEqual(testContext, {
module: "logs1",
name: "test1"
});
strictEqual(moduleDoneContext, undefined);
deepEqual(moduleContext, {
name: "logs1"
});
equal(log, 12);
});
test("test2", 10, function() {
equal(begin, 1);
equal(moduleStart, 1);
equal(testStart, 2);
equal(testDone, 1);
equal(moduleDone, 0);
deepEqual(testDoneContext, {
module: "logs1",
name: "test1",
failed: 0,
passed: 13,
total: 13
});
deepEqual(testContext, {
module: "logs1",
name: "test2"
});
strictEqual(moduleDoneContext, undefined);
deepEqual(moduleContext, {
name: "logs1"
});
equal(log, 22);
});
module("logs2");
test("test1", 9, function() {
equal(begin, 1);
equal(moduleStart, 2);
equal(testStart, 3);
equal(testDone, 2);
equal(moduleDone, 1);
deepEqual(testContext, {
module: "logs2",
name: "test1"
});
deepEqual(moduleDoneContext, {
name: "logs1",
failed: 0,
passed: 23,
total: 23
});
deepEqual(moduleContext, {
name: "logs2"
});
equal(log, 31);
});
test("test2", 8, function() {
equal(begin, 1);
equal(moduleStart, 2);
equal(testStart, 4);
equal(testDone, 3);
equal(moduleDone, 1);
deepEqual(testContext, {
module: "logs2",
name: "test2"
});
deepEqual(moduleContext, {
name: "logs2"
});
equal(log, 39);
});
jquery_1.7.2+dfsg/test/qunit/test/same.js 0000644 0001750 0001750 00000154630 11757032022 017420 0 ustar metal metal module("equiv");
test("Primitive types and constants", function () {
equal(QUnit.equiv(null, null), true, "null");
equal(QUnit.equiv(null, {}), false, "null");
equal(QUnit.equiv(null, undefined), false, "null");
equal(QUnit.equiv(null, 0), false, "null");
equal(QUnit.equiv(null, false), false, "null");
equal(QUnit.equiv(null, ''), false, "null");
equal(QUnit.equiv(null, []), false, "null");
equal(QUnit.equiv(undefined, undefined), true, "undefined");
equal(QUnit.equiv(undefined, null), false, "undefined");
equal(QUnit.equiv(undefined, 0), false, "undefined");
equal(QUnit.equiv(undefined, false), false, "undefined");
equal(QUnit.equiv(undefined, {}), false, "undefined");
equal(QUnit.equiv(undefined, []), false, "undefined");
equal(QUnit.equiv(undefined, ""), false, "undefined");
// Nan usually doest not equal to Nan using the '==' operator.
// Only isNaN() is able to do it.
equal(QUnit.equiv(0/0, 0/0), true, "NaN"); // NaN VS NaN
equal(QUnit.equiv(1/0, 2/0), true, "Infinity"); // Infinity VS Infinity
equal(QUnit.equiv(-1/0, 2/0), false, "-Infinity, Infinity"); // -Infinity VS Infinity
equal(QUnit.equiv(-1/0, -2/0), true, "-Infinity, -Infinity"); // -Infinity VS -Infinity
equal(QUnit.equiv(0/0, 1/0), false, "NaN, Infinity"); // Nan VS Infinity
equal(QUnit.equiv(1/0, 0/0), false, "NaN, Infinity"); // Nan VS Infinity
equal(QUnit.equiv(0/0, null), false, "NaN");
equal(QUnit.equiv(0/0, undefined), false, "NaN");
equal(QUnit.equiv(0/0, 0), false, "NaN");
equal(QUnit.equiv(0/0, false), false, "NaN");
equal(QUnit.equiv(0/0, function () {}), false, "NaN");
equal(QUnit.equiv(1/0, null), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, undefined), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, 0), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, 1), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, false), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, true), false, "NaN, Infinity");
equal(QUnit.equiv(1/0, function () {}), false, "NaN, Infinity");
equal(QUnit.equiv(0, 0), true, "number");
equal(QUnit.equiv(0, 1), false, "number");
equal(QUnit.equiv(1, 0), false, "number");
equal(QUnit.equiv(1, 1), true, "number");
equal(QUnit.equiv(1.1, 1.1), true, "number");
equal(QUnit.equiv(0.0000005, 0.0000005), true, "number");
equal(QUnit.equiv(0, ''), false, "number");
equal(QUnit.equiv(0, '0'), false, "number");
equal(QUnit.equiv(1, '1'), false, "number");
equal(QUnit.equiv(0, false), false, "number");
equal(QUnit.equiv(1, true), false, "number");
equal(QUnit.equiv(true, true), true, "boolean");
equal(QUnit.equiv(true, false), false, "boolean");
equal(QUnit.equiv(false, true), false, "boolean");
equal(QUnit.equiv(false, 0), false, "boolean");
equal(QUnit.equiv(false, null), false, "boolean");
equal(QUnit.equiv(false, undefined), false, "boolean");
equal(QUnit.equiv(true, 1), false, "boolean");
equal(QUnit.equiv(true, null), false, "boolean");
equal(QUnit.equiv(true, undefined), false, "boolean");
equal(QUnit.equiv('', ''), true, "string");
equal(QUnit.equiv('a', 'a'), true, "string");
equal(QUnit.equiv("foobar", "foobar"), true, "string");
equal(QUnit.equiv("foobar", "foo"), false, "string");
equal(QUnit.equiv('', 0), false, "string");
equal(QUnit.equiv('', false), false, "string");
equal(QUnit.equiv('', null), false, "string");
equal(QUnit.equiv('', undefined), false, "string");
// Short annotation VS new annotation
equal(QUnit.equiv(0, new Number()), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Number(), 0), true, "short annotation VS new annotation");
equal(QUnit.equiv(1, new Number(1)), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Number(1), 1), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Number(0), 1), false, "short annotation VS new annotation");
equal(QUnit.equiv(0, new Number(1)), false, "short annotation VS new annotation");
equal(QUnit.equiv(new String(), ""), true, "short annotation VS new annotation");
equal(QUnit.equiv("", new String()), true, "short annotation VS new annotation");
equal(QUnit.equiv(new String("My String"), "My String"), true, "short annotation VS new annotation");
equal(QUnit.equiv("My String", new String("My String")), true, "short annotation VS new annotation");
equal(QUnit.equiv("Bad String", new String("My String")), false, "short annotation VS new annotation");
equal(QUnit.equiv(new String("Bad String"), "My String"), false, "short annotation VS new annotation");
equal(QUnit.equiv(false, new Boolean()), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Boolean(), false), true, "short annotation VS new annotation");
equal(QUnit.equiv(true, new Boolean(true)), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Boolean(true), true), true, "short annotation VS new annotation");
equal(QUnit.equiv(true, new Boolean(1)), true, "short annotation VS new annotation");
equal(QUnit.equiv(false, new Boolean(false)), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Boolean(false), false), true, "short annotation VS new annotation");
equal(QUnit.equiv(false, new Boolean(0)), true, "short annotation VS new annotation");
equal(QUnit.equiv(true, new Boolean(false)), false, "short annotation VS new annotation");
equal(QUnit.equiv(new Boolean(false), true), false, "short annotation VS new annotation");
equal(QUnit.equiv(new Object(), {}), true, "short annotation VS new annotation");
equal(QUnit.equiv({}, new Object()), true, "short annotation VS new annotation");
equal(QUnit.equiv(new Object(), {a:1}), false, "short annotation VS new annotation");
equal(QUnit.equiv({a:1}, new Object()), false, "short annotation VS new annotation");
equal(QUnit.equiv({a:undefined}, new Object()), false, "short annotation VS new annotation");
equal(QUnit.equiv(new Object(), {a:undefined}), false, "short annotation VS new annotation");
});
test("Objects Basics.", function() {
equal(QUnit.equiv({}, {}), true);
equal(QUnit.equiv({}, null), false);
equal(QUnit.equiv({}, undefined), false);
equal(QUnit.equiv({}, 0), false);
equal(QUnit.equiv({}, false), false);
// This test is a hard one, it is very important
// REASONS:
// 1) They are of the same type "object"
// 2) [] instanceof Object is true
// 3) Their properties are the same (doesn't exists)
equal(QUnit.equiv({}, []), false);
equal(QUnit.equiv({a:1}, {a:1}), true);
equal(QUnit.equiv({a:1}, {a:"1"}), false);
equal(QUnit.equiv({a:[]}, {a:[]}), true);
equal(QUnit.equiv({a:{}}, {a:null}), false);
equal(QUnit.equiv({a:1}, {}), false);
equal(QUnit.equiv({}, {a:1}), false);
// Hard ones
equal(QUnit.equiv({a:undefined}, {}), false);
equal(QUnit.equiv({}, {a:undefined}), false);
equal(QUnit.equiv(
{
a: [{ bar: undefined }]
},
{
a: [{ bat: undefined }]
}
), false);
// Objects with no prototype, created via Object.create(null), are used e.g. as dictionaries.
// Being able to test equivalence against object literals is quite useful.
if (typeof Object.create === 'function') {
equal(QUnit.equiv(Object.create(null), {}), true, "empty object without prototype VS empty object");
var nonEmptyWithNoProto = Object.create(null);
nonEmptyWithNoProto.foo = "bar";
equal(QUnit.equiv(nonEmptyWithNoProto, { foo: "bar" }), true, "object without prototype VS object");
}
});
test("Arrays Basics.", function() {
equal(QUnit.equiv([], []), true);
// May be a hard one, can invoke a crash at execution.
// because their types are both "object" but null isn't
// like a true object, it doesn't have any property at all.
equal(QUnit.equiv([], null), false);
equal(QUnit.equiv([], undefined), false);
equal(QUnit.equiv([], false), false);
equal(QUnit.equiv([], 0), false);
equal(QUnit.equiv([], ""), false);
// May be a hard one, but less hard
// than {} with [] (note the order)
equal(QUnit.equiv([], {}), false);
equal(QUnit.equiv([null],[]), false);
equal(QUnit.equiv([undefined],[]), false);
equal(QUnit.equiv([],[null]), false);
equal(QUnit.equiv([],[undefined]), false);
equal(QUnit.equiv([null],[undefined]), false);
equal(QUnit.equiv([[]],[[]]), true);
equal(QUnit.equiv([[],[],[]],[[],[],[]]), true);
equal(QUnit.equiv(
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]),
true);
equal(QUnit.equiv(
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), // shorter
false);
equal(QUnit.equiv(
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[{}]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],
[[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), // deepest element not an array
false);
// same multidimensional
equal(QUnit.equiv(
[1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,[
[6,7,8,9, [
[
1,2,3,4,[
2,3,4,[
1,2,[
1,2,3,4,[
1,2,3,4,5,6,7,8,9,[
0
],1,2,3,4,5,6,7,8,9
],5,6,7,8,9
],4,5,6,7,8,9
],5,6,7,8,9
],5,6,7
]
]
]
]
]]],
[1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,[
[6,7,8,9, [
[
1,2,3,4,[
2,3,4,[
1,2,[
1,2,3,4,[
1,2,3,4,5,6,7,8,9,[
0
],1,2,3,4,5,6,7,8,9
],5,6,7,8,9
],4,5,6,7,8,9
],5,6,7,8,9
],5,6,7
]
]
]
]
]]]),
true, "Multidimensional");
// different multidimensional
equal(QUnit.equiv(
[1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,[
[6,7,8,9, [
[
1,2,3,4,[
2,3,4,[
1,2,[
1,2,3,4,[
1,2,3,4,5,6,7,8,9,[
0
],1,2,3,4,5,6,7,8,9
],5,6,7,8,9
],4,5,6,7,8,9
],5,6,7,8,9
],5,6,7
]
]
]
]
]]],
[1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,[
[6,7,8,9, [
[
1,2,3,4,[
2,3,4,[
1,2,[
'1',2,3,4,[ // string instead of number
1,2,3,4,5,6,7,8,9,[
0
],1,2,3,4,5,6,7,8,9
],5,6,7,8,9
],4,5,6,7,8,9
],5,6,7,8,9
],5,6,7
]
]
]
]
]]]),
false, "Multidimensional");
// different multidimensional
equal(QUnit.equiv(
[1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,[
[6,7,8,9, [
[
1,2,3,4,[
2,3,4,[
1,2,[
1,2,3,4,[
1,2,3,4,5,6,7,8,9,[
0
],1,2,3,4,5,6,7,8,9
],5,6,7,8,9
],4,5,6,7,8,9
],5,6,7,8,9
],5,6,7
]
]
]
]
]]],
[1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,6,7,8,9, [
1,2,3,4,5,[
[6,7,8,9, [
[
1,2,3,4,[
2,3,[ // missing an element (4)
1,2,[
1,2,3,4,[
1,2,3,4,5,6,7,8,9,[
0
],1,2,3,4,5,6,7,8,9
],5,6,7,8,9
],4,5,6,7,8,9
],5,6,7,8,9
],5,6,7
]
]
]
]
]]]),
false, "Multidimensional");
});
test("Functions.", function() {
var f0 = function () {};
var f1 = function () {};
// f2 and f3 have the same code, formatted differently
var f2 = function () {var i = 0;};
var f3 = function () {
var i = 0 // this comment and no semicoma as difference
};
equal(QUnit.equiv(function() {}, function() {}), false, "Anonymous functions"); // exact source code
equal(QUnit.equiv(function() {}, function() {return true;}), false, "Anonymous functions");
equal(QUnit.equiv(f0, f0), true, "Function references"); // same references
equal(QUnit.equiv(f0, f1), false, "Function references"); // exact source code, different references
equal(QUnit.equiv(f2, f3), false, "Function references"); // equivalent source code, different references
equal(QUnit.equiv(f1, f2), false, "Function references"); // different source code, different references
equal(QUnit.equiv(function() {}, true), false);
equal(QUnit.equiv(function() {}, undefined), false);
equal(QUnit.equiv(function() {}, null), false);
equal(QUnit.equiv(function() {}, {}), false);
});
test("Date instances.", function() {
// Date, we don't need to test Date.parse() because it returns a number.
// Only test the Date instances by setting them a fix date.
// The date use is midnight January 1, 1970
var d1 = new Date();
d1.setTime(0); // fix the date
var d2 = new Date();
d2.setTime(0); // fix the date
var d3 = new Date(); // The very now
// Anyway their types differs, just in case the code fails in the order in which it deals with date
equal(QUnit.equiv(d1, 0), false); // d1.valueOf() returns 0, but d1 and 0 are different
// test same values date and different instances equality
equal(QUnit.equiv(d1, d2), true);
// test different date and different instances difference
equal(QUnit.equiv(d1, d3), false);
});
test("RegExp.", function() {
// Must test cases that imply those traps:
// var a = /./;
// a instanceof Object; // Oops
// a instanceof RegExp; // Oops
// typeof a === "function"; // Oops, false in IE and Opera, true in FF and Safari ("object")
// Tests same regex with same modifiers in different order
var r = /foo/;
var r5 = /foo/gim;
var r6 = /foo/gmi;
var r7 = /foo/igm;
var r8 = /foo/img;
var r9 = /foo/mig;
var r10 = /foo/mgi;
var ri1 = /foo/i;
var ri2 = /foo/i;
var rm1 = /foo/m;
var rm2 = /foo/m;
var rg1 = /foo/g;
var rg2 = /foo/g;
equal(QUnit.equiv(r5, r6), true, "Modifier order");
equal(QUnit.equiv(r5, r7), true, "Modifier order");
equal(QUnit.equiv(r5, r8), true, "Modifier order");
equal(QUnit.equiv(r5, r9), true, "Modifier order");
equal(QUnit.equiv(r5, r10), true, "Modifier order");
equal(QUnit.equiv(r, r5), false, "Modifier");
equal(QUnit.equiv(ri1, ri2), true, "Modifier");
equal(QUnit.equiv(r, ri1), false, "Modifier");
equal(QUnit.equiv(ri1, rm1), false, "Modifier");
equal(QUnit.equiv(r, rm1), false, "Modifier");
equal(QUnit.equiv(rm1, ri1), false, "Modifier");
equal(QUnit.equiv(rm1, rm2), true, "Modifier");
equal(QUnit.equiv(rg1, rm1), false, "Modifier");
equal(QUnit.equiv(rm1, rg1), false, "Modifier");
equal(QUnit.equiv(rg1, rg2), true, "Modifier");
// Different regex, same modifiers
var r11 = /[a-z]/gi;
var r13 = /[0-9]/gi; // oops! different
equal(QUnit.equiv(r11, r13), false, "Regex pattern");
var r14 = /0/ig;
var r15 = /"0"/ig; // oops! different
equal(QUnit.equiv(r14, r15), false, "Regex pattern");
var r1 = /[\n\r\u2028\u2029]/g;
var r2 = /[\n\r\u2028\u2029]/g;
var r3 = /[\n\r\u2028\u2028]/g; // differs from r1
var r4 = /[\n\r\u2028\u2029]/; // differs from r1
equal(QUnit.equiv(r1, r2), true, "Regex pattern");
equal(QUnit.equiv(r1, r3), false, "Regex pattern");
equal(QUnit.equiv(r1, r4), false, "Regex pattern");
// More complex regex
var regex1 = "^[-_.a-z0-9]+@([-_a-z0-9]+\\.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$";
var regex2 = "^[-_.a-z0-9]+@([-_a-z0-9]+\\.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$";
// regex 3 is different: '.' not escaped
var regex3 = "^[-_.a-z0-9]+@([-_a-z0-9]+.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$";
var r21 = new RegExp(regex1);
var r22 = new RegExp(regex2);
var r23 = new RegExp(regex3); // diff from r21, not same pattern
var r23a = new RegExp(regex3, "gi"); // diff from r23, not same modifier
var r24a = new RegExp(regex3, "ig"); // same as r23a
equal(QUnit.equiv(r21, r22), true, "Complex Regex");
equal(QUnit.equiv(r21, r23), false, "Complex Regex");
equal(QUnit.equiv(r23, r23a), false, "Complex Regex");
equal(QUnit.equiv(r23a, r24a), true, "Complex Regex");
// typeof r1 is "function" in some browsers and "object" in others so we must cover this test
var re = / /;
equal(QUnit.equiv(re, function () {}), false, "Regex internal");
equal(QUnit.equiv(re, {}), false, "Regex internal");
});
test("Complex Objects.", function() {
function fn1() {
return "fn1";
}
function fn2() {
return "fn2";
}
// Try to invert the order of some properties to make sure it is covered.
// It can failed when properties are compared between unsorted arrays.
equal(QUnit.equiv(
{
a: 1,
b: null,
c: [{}],
d: {
a: 3.14159,
b: false,
c: {
e: fn1,
f: [[[]]],
g: {
j: {
k: {
n: {
r: "r",
s: [1,2,3],
t: undefined,
u: 0,
v: {
w: {
x: {
y: "Yahoo!",
z: null
}
}
}
},
q: [],
p: 1/0,
o: 99
},
l: undefined,
m: null
}
},
d: 0,
i: true,
h: "false"
}
},
e: undefined,
g: "",
h: "h",
f: {},
i: []
},
{
a: 1,
b: null,
c: [{}],
d: {
b: false,
a: 3.14159,
c: {
d: 0,
e: fn1,
f: [[[]]],
g: {
j: {
k: {
n: {
r: "r",
t: undefined,
u: 0,
s: [1,2,3],
v: {
w: {
x: {
z: null,
y: "Yahoo!"
}
}
}
},
o: 99,
p: 1/0,
q: []
},
l: undefined,
m: null
}
},
i: true,
h: "false"
}
},
e: undefined,
g: "",
f: {},
h: "h",
i: []
}
), true);
equal(QUnit.equiv(
{
a: 1,
b: null,
c: [{}],
d: {
a: 3.14159,
b: false,
c: {
d: 0,
e: fn1,
f: [[[]]],
g: {
j: {
k: {
n: {
//r: "r", // different: missing a property
s: [1,2,3],
t: undefined,
u: 0,
v: {
w: {
x: {
y: "Yahoo!",
z: null
}
}
}
},
o: 99,
p: 1/0,
q: []
},
l: undefined,
m: null
}
},
h: "false",
i: true
}
},
e: undefined,
f: {},
g: "",
h: "h",
i: []
},
{
a: 1,
b: null,
c: [{}],
d: {
a: 3.14159,
b: false,
c: {
d: 0,
e: fn1,
f: [[[]]],
g: {
j: {
k: {
n: {
r: "r",
s: [1,2,3],
t: undefined,
u: 0,
v: {
w: {
x: {
y: "Yahoo!",
z: null
}
}
}
},
o: 99,
p: 1/0,
q: []
},
l: undefined,
m: null
}
},
h: "false",
i: true
}
},
e: undefined,
f: {},
g: "",
h: "h",
i: []
}
), false);
equal(QUnit.equiv(
{
a: 1,
b: null,
c: [{}],
d: {
a: 3.14159,
b: false,
c: {
d: 0,
e: fn1,
f: [[[]]],
g: {
j: {
k: {
n: {
r: "r",
s: [1,2,3],
t: undefined,
u: 0,
v: {
w: {
x: {
y: "Yahoo!",
z: null
}
}
}
},
o: 99,
p: 1/0,
q: []
},
l: undefined,
m: null
}
},
h: "false",
i: true
}
},
e: undefined,
f: {},
g: "",
h: "h",
i: []
},
{
a: 1,
b: null,
c: [{}],
d: {
a: 3.14159,
b: false,
c: {
d: 0,
e: fn1,
f: [[[]]],
g: {
j: {
k: {
n: {
r: "r",
s: [1,2,3],
//t: undefined, // different: missing a property with an undefined value
u: 0,
v: {
w: {
x: {
y: "Yahoo!",
z: null
}
}
}
},
o: 99,
p: 1/0,
q: []
},
l: undefined,
m: null
}
},
h: "false",
i: true
}
},
e: undefined,
f: {},
g: "",
h: "h",
i: []
}
), false);
equal(QUnit.equiv(
{
a: 1,
b: null,
c: [{}],
d: {
a: 3.14159,
b: false,
c: {
d: 0,
e: fn1,
f: [[[]]],
g: {
j: {
k: {
n: {
r: "r",
s: [1,2,3],
t: undefined,
u: 0,
v: {
w: {
x: {
y: "Yahoo!",
z: null
}
}
}
},
o: 99,
p: 1/0,
q: []
},
l: undefined,
m: null
}
},
h: "false",
i: true
}
},
e: undefined,
f: {},
g: "",
h: "h",
i: []
},
{
a: 1,
b: null,
c: [{}],
d: {
a: 3.14159,
b: false,
c: {
d: 0,
e: fn1,
f: [[[]]],
g: {
j: {
k: {
n: {
r: "r",
s: [1,2,3],
t: undefined,
u: 0,
v: {
w: {
x: {
y: "Yahoo!",
z: null
}
}
}
},
o: 99,
p: 1/0,
q: {} // different was []
},
l: undefined,
m: null
}
},
h: "false",
i: true
}
},
e: undefined,
f: {},
g: "",
h: "h",
i: []
}
), false);
var same1 = {
a: [
"string", null, 0, "1", 1, {
prop: null,
foo: [1,2,null,{}, [], [1,2,3]],
bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "è€� 汉è¯ä¸å˜åœ¨ 港澳和海外的å�Žäººåœˆä¸ 贵州 我去了书店 现在尚有争",
b: "b",
c: fn1
};
var same2 = {
a: [
"string", null, 0, "1", 1, {
prop: null,
foo: [1,2,null,{}, [], [1,2,3]],
bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "è€� 汉è¯ä¸å˜åœ¨ 港澳和海外的å�Žäººåœˆä¸ 贵州 我去了书店 现在尚有争",
b: "b",
c: fn1
};
var diff1 = {
a: [
"string", null, 0, "1", 1, {
prop: null,
foo: [1,2,null,{}, [], [1,2,3,4]], // different: 4 was add to the array
bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "è€� 汉è¯ä¸å˜åœ¨ 港澳和海外的å�Žäººåœˆä¸ 贵州 我去了书店 现在尚有争",
b: "b",
c: fn1
};
var diff2 = {
a: [
"string", null, 0, "1", 1, {
prop: null,
foo: [1,2,null,{}, [], [1,2,3]],
newprop: undefined, // different: newprop was added
bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "è€� 汉è¯ä¸å˜åœ¨ 港澳和海外的å�Žäººåœˆä¸ 贵州 我去了书店 现在尚有争",
b: "b",
c: fn1
};
var diff3 = {
a: [
"string", null, 0, "1", 1, {
prop: null,
foo: [1,2,null,{}, [], [1,2,3]],
bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ α" // different: missing last char
],
unicode: "è€� 汉è¯ä¸å˜åœ¨ 港澳和海外的å�Žäººåœˆä¸ 贵州 我去了书店 现在尚有争",
b: "b",
c: fn1
};
var diff4 = {
a: [
"string", null, 0, "1", 1, {
prop: null,
foo: [1,2,undefined,{}, [], [1,2,3]], // different: undefined instead of null
bar: undefined
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "è€� 汉è¯ä¸å˜åœ¨ 港澳和海外的å�Žäººåœˆä¸ 贵州 我去了书店 现在尚有争",
b: "b",
c: fn1
};
var diff5 = {
a: [
"string", null, 0, "1", 1, {
prop: null,
foo: [1,2,null,{}, [], [1,2,3]],
bat: undefined // different: property name not "bar"
}, 3, "Hey!", "Κάνε πάντα γνω�ίζουμε ας των, μηχανής επιδιό�θωσης επιδιο�θώσεις ώς μια. Κλπ ας"
],
unicode: "è€� 汉è¯ä¸å˜åœ¨ 港澳和海外的å�Žäººåœˆä¸ 贵州 我去了书店 现在尚有争",
b: "b",
c: fn1
};
equal(QUnit.equiv(same1, same2), true);
equal(QUnit.equiv(same2, same1), true);
equal(QUnit.equiv(same2, diff1), false);
equal(QUnit.equiv(diff1, same2), false);
equal(QUnit.equiv(same1, diff1), false);
equal(QUnit.equiv(same1, diff2), false);
equal(QUnit.equiv(same1, diff3), false);
equal(QUnit.equiv(same1, diff3), false);
equal(QUnit.equiv(same1, diff4), false);
equal(QUnit.equiv(same1, diff5), false);
equal(QUnit.equiv(diff5, diff1), false);
});
test("Complex Arrays.", function() {
function fn() {
}
equal(QUnit.equiv(
[1, 2, 3, true, {}, null, [
{
a: ["", '1', 0]
},
5, 6, 7
], "foo"],
[1, 2, 3, true, {}, null, [
{
a: ["", '1', 0]
},
5, 6, 7
], "foo"]),
true);
equal(QUnit.equiv(
[1, 2, 3, true, {}, null, [
{
a: ["", '1', 0]
},
5, 6, 7
], "foo"],
[1, 2, 3, true, {}, null, [
{
b: ["", '1', 0] // not same property name
},
5, 6, 7
], "foo"]),
false);
var a = [{
b: fn,
c: false,
"do": "reserved word",
"for": {
ar: [3,5,9,"hey!", [], {
ar: [1,[
3,4,6,9, null, [], []
]],
e: fn,
f: undefined
}]
},
e: 0.43445
}, 5, "string", 0, fn, false, null, undefined, 0, [
4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0
], [], [[[], "foo", null, {
n: 1/0,
z: {
a: [3,4,5,6,"yep!", undefined, undefined],
b: {}
}
}, {}]]];
equal(QUnit.equiv(a,
[{
b: fn,
c: false,
"do": "reserved word",
"for": {
ar: [3,5,9,"hey!", [], {
ar: [1,[
3,4,6,9, null, [], []
]],
e: fn,
f: undefined
}]
},
e: 0.43445
}, 5, "string", 0, fn, false, null, undefined, 0, [
4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0
], [], [[[], "foo", null, {
n: 1/0,
z: {
a: [3,4,5,6,"yep!", undefined, undefined],
b: {}
}
}, {}]]]), true);
equal(QUnit.equiv(a,
[{
b: fn,
c: false,
"do": "reserved word",
"for": {
ar: [3,5,9,"hey!", [], {
ar: [1,[
3,4,6,9, null, [], []
]],
e: fn,
f: undefined
}]
},
e: 0.43445
}, 5, "string", 0, fn, false, null, undefined, 0, [
4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[2]]]], "3"], {}, 1/0 // different: [[[[[2]]]]] instead of [[[[[3]]]]]
], [], [[[], "foo", null, {
n: 1/0,
z: {
a: [3,4,5,6,"yep!", undefined, undefined],
b: {}
}
}, {}]]]), false);
equal(QUnit.equiv(a,
[{
b: fn,
c: false,
"do": "reserved word",
"for": {
ar: [3,5,9,"hey!", [], {
ar: [1,[
3,4,6,9, null, [], []
]],
e: fn,
f: undefined
}]
},
e: 0.43445
}, 5, "string", 0, fn, false, null, undefined, 0, [
4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0
], [], [[[], "foo", null, {
n: -1/0, // different, -Infinity instead of Infinity
z: {
a: [3,4,5,6,"yep!", undefined, undefined],
b: {}
}
}, {}]]]), false);
equal(QUnit.equiv(a,
[{
b: fn,
c: false,
"do": "reserved word",
"for": {
ar: [3,5,9,"hey!", [], {
ar: [1,[
3,4,6,9, null, [], []
]],
e: fn,
f: undefined
}]
},
e: 0.43445
}, 5, "string", 0, fn, false, null, undefined, 0, [
4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0
], [], [[[], "foo", { // different: null is missing
n: 1/0,
z: {
a: [3,4,5,6,"yep!", undefined, undefined],
b: {}
}
}, {}]]]), false);
equal(QUnit.equiv(a,
[{
b: fn,
c: false,
"do": "reserved word",
"for": {
ar: [3,5,9,"hey!", [], {
ar: [1,[
3,4,6,9, null, [], []
]],
e: fn
// different: missing property f: undefined
}]
},
e: 0.43445
}, 5, "string", 0, fn, false, null, undefined, 0, [
4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0
], [], [[[], "foo", null, {
n: 1/0,
z: {
a: [3,4,5,6,"yep!", undefined, undefined],
b: {}
}
}, {}]]]), false);
});
test("Prototypal inheritance", function() {
function Gizmo(id) {
this.id = id;
}
function Hoozit(id) {
this.id = id;
}
Hoozit.prototype = new Gizmo();
var gizmo = new Gizmo("ok");
var hoozit = new Hoozit("ok");
// Try this test many times after test on instances that hold function
// to make sure that our code does not mess with last object constructor memoization.
equal(QUnit.equiv(function () {}, function () {}), false);
// Hoozit inherit from Gizmo
// hoozit instanceof Hoozit; // true
// hoozit instanceof Gizmo; // true
equal(QUnit.equiv(hoozit, gizmo), true);
Gizmo.prototype.bar = true; // not a function just in case we skip them
// Hoozit inherit from Gizmo
// They are equivalent
equal(QUnit.equiv(hoozit, gizmo), true);
// Make sure this is still true !important
// The reason for this is that I forgot to reset the last
// caller to where it were called from.
equal(QUnit.equiv(function () {}, function () {}), false);
// Make sure this is still true !important
equal(QUnit.equiv(hoozit, gizmo), true);
Hoozit.prototype.foo = true; // not a function just in case we skip them
// Gizmo does not inherit from Hoozit
// gizmo instanceof Gizmo; // true
// gizmo instanceof Hoozit; // false
// They are not equivalent
equal(QUnit.equiv(hoozit, gizmo), false);
// Make sure this is still true !important
equal(QUnit.equiv(function () {}, function () {}), false);
});
test("Instances", function() {
function A() {}
var a1 = new A();
var a2 = new A();
function B() {
this.fn = function () {};
}
var b1 = new B();
var b2 = new B();
equal(QUnit.equiv(a1, a2), true, "Same property, same constructor");
// b1.fn and b2.fn are functions but they are different references
// But we decided to skip function for instances.
equal(QUnit.equiv(b1, b2), true, "Same property, same constructor");
equal(QUnit.equiv(a1, b1), false, "Same properties but different constructor"); // failed
function Car(year) {
var privateVar = 0;
this.year = year;
this.isOld = function() {
return year > 10;
};
}
function Human(year) {
var privateVar = 1;
this.year = year;
this.isOld = function() {
return year > 80;
};
}
var car = new Car(30);
var carSame = new Car(30);
var carDiff = new Car(10);
var human = new Human(30);
var diff = {
year: 30
};
var same = {
year: 30,
isOld: function () {}
};
equal(QUnit.equiv(car, car), true);
equal(QUnit.equiv(car, carDiff), false);
equal(QUnit.equiv(car, carSame), true);
equal(QUnit.equiv(car, human), false);
});
test("Complex Instances Nesting (with function value in literals and/or in nested instances)", function() {
function A(fn) {
this.a = {};
this.fn = fn;
this.b = {a: []};
this.o = {};
this.fn1 = fn;
}
function B(fn) {
this.fn = fn;
this.fn1 = function () {};
this.a = new A(function () {});
}
function fnOutside() {
}
function C(fn) {
function fnInside() {
}
this.x = 10;
this.fn = fn;
this.fn1 = function () {};
this.fn2 = fnInside;
this.fn3 = {
a: true,
b: fnOutside // ok make reference to a function in all instances scope
};
this.o1 = {};
// This function will be ignored.
// Even if it is not visible for all instances (e.g. locked in a closures),
// it is from a property that makes part of an instance (e.g. from the C constructor)
this.b1 = new B(function () {});
this.b2 = new B({
x: {
b2: new B(function() {})
}
});
}
function D(fn) {
function fnInside() {
}
this.x = 10;
this.fn = fn;
this.fn1 = function () {};
this.fn2 = fnInside;
this.fn3 = {
a: true,
b: fnOutside, // ok make reference to a function in all instances scope
// This function won't be ingored.
// It isn't visible for all C insances
// and it is not in a property of an instance. (in an Object instances e.g. the object literal)
c: fnInside
};
this.o1 = {};
// This function will be ignored.
// Even if it is not visible for all instances (e.g. locked in a closures),
// it is from a property that makes part of an instance (e.g. from the C constructor)
this.b1 = new B(function () {});
this.b2 = new B({
x: {
b2: new B(function() {})
}
});
}
function E(fn) {
function fnInside() {
}
this.x = 10;
this.fn = fn;
this.fn1 = function () {};
this.fn2 = fnInside;
this.fn3 = {
a: true,
b: fnOutside // ok make reference to a function in all instances scope
};
this.o1 = {};
// This function will be ignored.
// Even if it is not visible for all instances (e.g. locked in a closures),
// it is from a property that makes part of an instance (e.g. from the C constructor)
this.b1 = new B(function () {});
this.b2 = new B({
x: {
b1: new B({a: function() {}}),
b2: new B(function() {})
}
});
}
var a1 = new A(function () {});
var a2 = new A(function () {});
equal(QUnit.equiv(a1, a2), true);
equal(QUnit.equiv(a1, a2), true); // different instances
var b1 = new B(function () {});
var b2 = new B(function () {});
equal(QUnit.equiv(b1, b2), true);
var c1 = new C(function () {});
var c2 = new C(function () {});
equal(QUnit.equiv(c1, c2), true);
var d1 = new D(function () {});
var d2 = new D(function () {});
equal(QUnit.equiv(d1, d2), false);
var e1 = new E(function () {});
var e2 = new E(function () {});
equal(QUnit.equiv(e1, e2), false);
});
test('object with references to self wont loop', function(){
var circularA = {
abc:null
}, circularB = {
abc:null
};
circularA.abc = circularA;
circularB.abc = circularB;
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object (ambigous test)");
circularA.def = 1;
circularB.def = 1;
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object (ambigous test)");
circularA.def = 1;
circularB.def = 0;
equal(QUnit.equiv(circularA, circularB), false, "Should not repeat test on object (unambigous test)");
});
test('array with references to self wont loop', function(){
var circularA = [],
circularB = [];
circularA.push(circularA);
circularB.push(circularB);
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on array (ambigous test)");
circularA.push( 'abc' );
circularB.push( 'abc' );
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on array (ambigous test)");
circularA.push( 'hello' );
circularB.push( 'goodbye' );
equal(QUnit.equiv(circularA, circularB), false, "Should not repeat test on array (unambigous test)");
});
test('mixed object/array with references to self wont loop', function(){
var circularA = [{abc:null}],
circularB = [{abc:null}];
circularA[0].abc = circularA;
circularB[0].abc = circularB;
circularA.push(circularA);
circularB.push(circularB);
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object/array (ambigous test)");
circularA[0].def = 1;
circularB[0].def = 1;
equal(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object/array (ambigous test)");
circularA[0].def = 1;
circularB[0].def = 0;
equal(QUnit.equiv(circularA, circularB), false, "Should not repeat test on object/array (unambigous test)");
});
test("Test that must be done at the end because they extend some primitive's prototype", function() {
// Try that a function looks like our regular expression.
// This tests if we check that a and b are really both instance of RegExp
Function.prototype.global = true;
Function.prototype.multiline = true;
Function.prototype.ignoreCase = false;
Function.prototype.source = "my regex";
var re = /my regex/gm;
equal(QUnit.equiv(re, function () {}), false, "A function that looks that a regex isn't a regex");
// This test will ensures it works in both ways, and ALSO especially that we can make differences
// between RegExp and Function constructor because typeof on a RegExpt instance is "function"
equal(QUnit.equiv(function () {}, re), false, "Same conversely, but ensures that function and regexp are distinct because their constructor are different");
});
jquery_1.7.2+dfsg/test/qunit/test/index.html 0000644 0001750 0001750 00000001201 11757032022 020113 0 ustar metal metal
QUnit Test Suite
QUnit Test Suite
test markup
jquery_1.7.2+dfsg/test/qunit/test/swarminject.js 0000755 0001750 0001750 00000000516 11757032022 021015 0 ustar metal metal // load testswarm agent
(function() {
var url = window.location.search;
url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) );
if ( !url || url.indexOf("http") !== 0 ) {
return;
}
document.write("");
})();
jquery_1.7.2+dfsg/test/qunit/test/test.js 0000644 0001750 0001750 00000026711 11757032022 017450 0 ustar metal metal test("module without setup/teardown (default)", function() {
expect(1);
ok(true);
});
test("expect in test", 3, function() {
ok(true);
ok(true);
ok(true);
});
test("expect in test", 1, function() {
ok(true);
});
module("setup test", {
setup: function() {
ok(true);
}
});
test("module with setup", function() {
expect(2);
ok(true);
});
test("module with setup, expect in test call", 2, function() {
ok(true);
});
var state;
module("setup/teardown test", {
setup: function() {
state = true;
ok(true);
},
teardown: function() {
ok(true);
}
});
test("module with setup/teardown", function() {
expect(3);
ok(true);
});
module("setup/teardown test 2");
test("module without setup/teardown", function() {
expect(1);
ok(true);
});
if (typeof setTimeout !== 'undefined') {
state = 'fail';
module("teardown and stop", {
teardown: function() {
equal(state, "done", "Test teardown.");
}
});
test("teardown must be called after test ended", function() {
expect(1);
stop();
setTimeout(function() {
state = "done";
start();
}, 13);
});
test("parameter passed to stop increments semaphore n times", function() {
expect(1);
stop(3);
setTimeout(function() {
state = "not enough starts";
start(), start();
}, 13);
setTimeout(function() {
state = "done";
start();
}, 15);
});
test("parameter passed to start decrements semaphore n times", function() {
expect(1);
stop(), stop(), stop();
setTimeout(function() {
state = "done";
start(3);
}, 18);
});
module("async setup test", {
setup: function() {
stop();
setTimeout(function(){
ok(true);
start();
}, 500);
}
});
asyncTest("module with async setup", function() {
expect(2);
ok(true);
start();
});
module("async teardown test", {
teardown: function() {
stop();
setTimeout(function(){
ok(true);
start();
}, 500);
}
});
asyncTest("module with async teardown", function() {
expect(2);
ok(true);
start();
});
module("asyncTest");
asyncTest("asyncTest", function() {
expect(2);
ok(true);
setTimeout(function() {
state = "done";
ok(true);
start();
}, 13);
});
asyncTest("asyncTest", 2, function() {
ok(true);
setTimeout(function() {
state = "done";
ok(true);
start();
}, 13);
});
test("sync", 2, function() {
stop();
setTimeout(function() {
ok(true);
start();
}, 13);
stop();
setTimeout(function() {
ok(true);
start();
}, 125);
});
test("test synchronous calls to stop", 2, function() {
stop();
setTimeout(function(){
ok(true, 'first');
start();
stop();
setTimeout(function(){
ok(true, 'second');
start();
}, 150);
}, 150);
});
}
module("save scope", {
setup: function() {
this.foo = "bar";
},
teardown: function() {
deepEqual(this.foo, "bar");
}
});
test("scope check", function() {
expect(2);
deepEqual(this.foo, "bar");
});
module("simple testEnvironment setup", {
foo: "bar",
bugid: "#5311" // example of meta-data
});
test("scope check", function() {
deepEqual(this.foo, "bar");
});
test("modify testEnvironment",function() {
this.foo="hamster";
});
test("testEnvironment reset for next test",function() {
deepEqual(this.foo, "bar");
});
module("testEnvironment with object", {
options:{
recipe:"soup",
ingredients:["hamster","onions"]
}
});
test("scope check", function() {
deepEqual(this.options, {recipe:"soup",ingredients:["hamster","onions"]}) ;
});
test("modify testEnvironment",function() {
// since we do a shallow copy, the testEnvironment can be modified
this.options.ingredients.push("carrots");
});
test("testEnvironment reset for next test",function() {
deepEqual(this.options, {recipe:"soup",ingredients:["hamster","onions","carrots"]}, "Is this a bug or a feature? Could do a deep copy") ;
});
module("testEnvironment tests");
function makeurl() {
var testEnv = QUnit.current_testEnvironment;
var url = testEnv.url || 'http://example.com/search';
var q = testEnv.q || 'a search test';
return url + '?q='+encodeURIComponent(q);
}
test("makeurl working",function() {
equal( QUnit.current_testEnvironment, this, 'The current testEnvironment is global');
equal( makeurl(), 'http://example.com/search?q=a%20search%20test', 'makeurl returns a default url if nothing specified in the testEnvironment');
});
module("testEnvironment with makeurl settings", {
url: 'http://google.com/',
q: 'another_search_test'
});
test("makeurl working with settings from testEnvironment", function() {
equal( makeurl(), 'http://google.com/?q=another_search_test', 'rather than passing arguments, we use test metadata to form the url');
});
test("each test can extend the module testEnvironment", {
q:'hamstersoup'
}, function() {
equal( makeurl(), 'http://google.com/?q=hamstersoup', 'url from module, q from test');
});
module("jsDump");
test("jsDump output", function() {
equal( QUnit.jsDump.parse([1, 2]), "[\n 1,\n 2\n]" );
equal( QUnit.jsDump.parse({top: 5, left: 0}), "{\n \"top\": 5,\n \"left\": 0\n}" );
if (typeof document !== 'undefined' && document.getElementById("qunit-header")) {
equal( QUnit.jsDump.parse(document.getElementById("qunit-header")), "" );
equal( QUnit.jsDump.parse(document.getElementsByTagName("h1")), "[\n \n]" );
}
});
module("assertions");
test("raises",function() {
function CustomError( message ) {
this.message = message;
}
CustomError.prototype.toString = function() {
return this.message;
};
raises(
function() {
throw "error"
}
);
raises(
function() {
throw "error"
},
'raises with just a message, no expected'
);
raises(
function() {
throw new CustomError();
},
CustomError,
'raised error is an instance of CustomError'
);
raises(
function() {
throw new CustomError("some error description");
},
/description/,
"raised error message contains 'description'"
);
raises(
function() {
throw new CustomError("some error description");
},
function( err ) {
if ( (err instanceof CustomError) && /description/.test(err) ) {
return true;
}
},
"custom validation function"
);
});
if (typeof document !== "undefined") {
module("fixture");
test("setup", function() {
document.getElementById("qunit-fixture").innerHTML = "foobar";
});
test("basics", function() {
equal( document.getElementById("qunit-fixture").innerHTML, "test markup", "automatically reset" );
});
}
module("custom assertions");
(function() {
function mod2(value, expected, message) {
var actual = value % 2;
QUnit.push(actual == expected, actual, expected, message);
}
test("mod2", function() {
mod2(2, 0, "2 % 2 == 0");
mod2(3, 1, "3 % 2 == 1");
})
})();
module("recursions");
function Wrap(x) {
this.wrap = x;
if (x == undefined) this.first = true;
}
function chainwrap(depth, first, prev) {
depth = depth || 0;
var last = prev || new Wrap();
first = first || last;
if (depth == 1) {
first.wrap = last;
}
if (depth > 1) {
last = chainwrap(depth-1, first, new Wrap(last));
}
return last;
}
test("check jsDump recursion", function() {
expect(4);
var noref = chainwrap(0);
var nodump = QUnit.jsDump.parse(noref);
equal(nodump, '{\n "wrap": undefined,\n "first": true\n}');
var selfref = chainwrap(1);
var selfdump = QUnit.jsDump.parse(selfref);
equal(selfdump, '{\n "wrap": recursion(-1),\n "first": true\n}');
var parentref = chainwrap(2);
var parentdump = QUnit.jsDump.parse(parentref);
equal(parentdump, '{\n "wrap": {\n "wrap": recursion(-2),\n "first": true\n }\n}');
var circref = chainwrap(10);
var circdump = QUnit.jsDump.parse(circref);
ok(new RegExp("recursion\\(-10\\)").test(circdump), "(" +circdump + ") should show -10 recursion level");
});
test("check (deep-)equal recursion", function() {
var noRecursion = chainwrap(0);
equal(noRecursion, noRecursion, "I should be equal to me.");
deepEqual(noRecursion, noRecursion, "... and so in depth.");
var selfref = chainwrap(1);
equal(selfref, selfref, "Even so if I nest myself.");
deepEqual(selfref, selfref, "... into the depth.");
var circref = chainwrap(10);
equal(circref, circref, "Or hide that through some levels of indirection.");
deepEqual(circref, circref, "... and checked on all levels!");
});
test('Circular reference with arrays', function() {
// pure array self-ref
var arr = [];
arr.push(arr);
var arrdump = QUnit.jsDump.parse(arr);
equal(arrdump, '[\n recursion(-1)\n]');
equal(arr, arr[0], 'no endless stack when trying to dump arrays with circular ref');
// mix obj-arr circular ref
var obj = {};
var childarr = [obj];
obj.childarr = childarr;
var objdump = QUnit.jsDump.parse(obj);
var childarrdump = QUnit.jsDump.parse(childarr);
equal(objdump, '{\n "childarr": [\n recursion(-2)\n ]\n}');
equal(childarrdump, '[\n {\n "childarr": recursion(-2)\n }\n]');
equal(obj.childarr, childarr, 'no endless stack when trying to dump array/object mix with circular ref');
equal(childarr[0], obj, 'no endless stack when trying to dump array/object mix with circular ref');
});
test('Circular reference - test reported by soniciq in #105', function() {
var MyObject = function() {};
MyObject.prototype.parent = function(obj) {
if (obj === undefined) { return this._parent; }
this._parent = obj;
};
MyObject.prototype.children = function(obj) {
if (obj === undefined) { return this._children; }
this._children = obj;
};
var a = new MyObject(),
b = new MyObject();
var barr = [b];
a.children(barr);
b.parent(a);
equal(a.children(), barr);
deepEqual(a.children(), [b]);
});
(function() {
var reset = QUnit.reset;
function afterTest() {
ok( false, "reset should not modify test status" );
}
module("reset");
test("reset runs assertions", function() {
QUnit.reset = function() {
afterTest();
reset.apply( this, arguments );
};
});
test("reset runs assertions2", function() {
QUnit.reset = reset;
});
})();
if (typeof setTimeout !== 'undefined') {
function testAfterDone(){
var testName = "ensure has correct number of assertions";
function secondAfterDoneTest(){
QUnit.config.done = [];
//QUnit.done = function(){};
//because when this does happen, the assertion count parameter doesn't actually
//work we use this test to check the assertion count.
module("check previous test's assertion counts");
test('count previous two test\'s assertions', function(){
var spans = document.getElementsByTagName('span'),
tests = [],
countNodes;
//find these two tests
for (var i = 0; i < spans.length; i++) {
if (spans[i].innerHTML.indexOf(testName) !== -1) {
tests.push(spans[i]);
}
}
//walk dom to counts
countNodes = tests[0].nextSibling.nextSibling.getElementsByTagName('b');
equal(countNodes[1].innerHTML, "99");
countNodes = tests[1].nextSibling.nextSibling.getElementsByTagName('b');
equal(countNodes[1].innerHTML, "99");
});
}
QUnit.config.done = [];
QUnit.done(secondAfterDoneTest);
module("Synchronous test after load of page");
asyncTest('Async test', function(){
start();
for (var i = 1; i < 100; i++) {
ok(i);
}
});
test(testName, 99, function(){
for (var i = 1; i < 100; i++) {
ok(i);
}
});
//we need two of these types of tests in order to ensure that assertions
//don't move between tests.
test(testName + ' 2', 99, function(){
for (var i = 1; i < 100; i++) {
ok(i);
}
});
}
QUnit.done(testAfterDone);
}
jquery_1.7.2+dfsg/test/qunit/test/headless.html 0000644 0001750 0001750 00000001245 11757032022 020604 0 ustar metal metal
QUnit Test Suite
test markup
jquery_1.7.2+dfsg/test/qunit/History.md 0000644 0001750 0001750 00000064637 11757032022 017150 0 ustar metal metal
1.2.0 / 2011-11-24
==================
* remove uses of equals(), as it's deprecated in favor of equal()
* Code review of "Allow objects with no prototype to be tested against object literals."
* Allow objects with no prototype to tested against object literals.
* Fix IE8 "Member not found" error
* Using node-qunit port, the start/stop function are not exposed so we need to prefix any call to them with 'QUnit'. Aka: start() -> QUnit.start()
* Remove the 'let teardown clean up globals test' - IE<9 doesn't support (==buggy) deleting window properties, and that's not worth the trouble, as everything else passes just fine. Fixes #155
* Fix globals in test.js, part 2
* Fix globals in test.js. ?tell wwalser to use ?noglobals everyonce in a while
* Extend readme regarding release process
1.1.0 / 2011-10-11
==================
* Fixes #134 - Add a window.onerror handler. Makes uncaught errors actually fail the testsuite, instead of going by unnoticed.
* Whitespace cleanup
* Merge remote branch 'trevorparscal/master'
* Fixed IE compatibility issues with using toString on NodeList objects, which in some browsers results in [object Object] rather than [object NodeList]. Now using duck typing for NodeList objects based on the presence of length, length being a number, presence of item method (which will be typeof string in IE and function in others, so we just check that it's not undefined) and that item(0) returns the same value as [0], unless it's empty, in which case item(0) will return 0, while [0] would return undefined. Tested in IE6, IE8, Firefox 6, Safari 5 and Chrome 16.
* Update readme with basic notes on releases
* More whitespace/parens cleanup
* Check if setTimeout is available before trying to delay running the next task. Fixes #160
* Whitespace/formatting fix, remove unnecessary parens
* Use alias for Object.prototype.toString
* Merge remote branch 'trevorparscal/master'
* Merge remote branch 'wwalser/recursionBug'
* Default 'expected' to null in asyncTest(), same as in test() itself.
* Whitespace cleanup
* Merge remote branch 'mmchaney/master'
* Merge remote branch 'Krinkle/master'
* Using === instead of ==
* Added more strict array type detection for dump output, and allowed NodeList objects to be output as arrays
* Bump post-release version
* Fixes a bug where after an async test, assertions could move between test cases because of internal state (config.current) being incorrectly set
* Simplified check for assertion count and adjusted whitespace
* Redo of fixing issue #156 (Support Object.prototype extending environment). * QUnit.diff: Throws exception without this if Object.prototype is set (Property 'length' of undefined. Since Object.prototype.foo doesn't have a property 'rows') * QUnit.url: Without this fix, if Object.prototype.foo is set, the url will be set to ?foo=...&the=rest. * saveGlobals: Without this fix, whenever a member is added to Object.prototype, saveGlobals will think it was a global variable in this loop. --- This time using the call method instead of obj.hasOwnProperty(key), which may fail if the object has that as it's own property (touché!).
* Handle expect(0) as expected, i.e. expect(0); ok(true, foo); will cause a test to fail
1.0.0 / 2011-10-06
==================
* Make QUnit work with TestSwarm
* Run other addons tests as composite addon demo. Need to move that to /test folder once this setup actually works
* Add-on: New assertion-type: step()
* added parameter to start and stop allowing a user to increment/decrement the semaphore more than once per call
* Update readmes with .md extension for GitHub to render them as markdown
* Update close-enough addon to include readme and match (new) naming convetions
* Merge remote branch 'righi/close-enough-addon'
* Canvas addon: Update file referneces
* Update canvas addon: Rename files and add README
* Merge remote branch 'wwalser/composite'
* Fix #142 - Backslash characters in messages should not be escaped
* Add module name to testStart and testDone callbacks
* Removed extra columns in object literals. Closes #153
* Remove dead links in comments.
* Merge remote branch 'wwalser/multipleCallbacks'
* Fixed syntax error and CommonJS incompatibilities in package.json
* Allow multiple callbacks to be registered.
* Add placeholder for when Safari may end up providing useful error handling
* changed file names to match addon naming convention
* Whitespace
* Created the composite addon.
* Using array and object literals.
* Issue #140: Make toggle system configurable.
* Merge remote branch 'tweetdeck/master'
* Adds the 'close enough' addon to determine if numbers are acceptably close enough in value.
* Fix recursion support in jsDump, along with tests. Fixes #63 and #100
* Adding a QUnit.config.altertitle flag which will allow users to opt-out of the functionality introduced in 60147ca0164e3d810b8a9bf46981c3d9cc569efc
* Refactor window.load handler into QUnit.load, makes it possible to call it manually.
* More whitespace cleanup
* Merge remote branch 'erikvold/one-chk-in-title'
* Whitespace
* Merge remote branch 'wwalser/syncStopCalls'
* Introducing the first QUnit addon, based on https://github.com/jquery/qunit/pull/84 - adds QUnit.pixelEqual assertion method, along with example tests.
* Remove config.hidepassed setting in test.js, wasn't intended to land in master.
* Expose QUnit.config.hidepassed setting. Overrides sessionStorage and enables enabling the feature programmatically. Fixes #133
* Fix formatting (css whitespace) for tracebacks.
* Expose extend, id, and addEvent methods.
* minor comment typo correction
* Ignore Eclipse WTP .settings
* Set 'The jQuery Project' as author in package.json
* Fixes a bug where synchronous calls to stop would cause tests to end before start was called again
* Point to planning testing wiki in readme
* only add one checkmark to the document.title
* Escape the stacktrace output before setting it as innerHTML, since it tends to contain `<` and `>` characters.
* Cleanup whitespace
* Run module.teardown before checking for pollution. Fixes #109 - noglobals should run after module teardown
* Fix accidental global variable "not"
* Update document.title status to use more robust unicode escape sequences, works even when served with non-utf-8-charset.
* Modify document.title when suite is done to show success/failure in tab, allows you to see the overall result without seeing the tab content.
* Merge pull request #107 from sexyprout/master
* Set a generic font
* Add/update headers
* Drop support for deprecated #main in favor of #qunit-fixture. If this breaks your testsuite, replace id="main" with id="qunit-fixture". Fixes #103
* Remove the same key as the one being set. Partial fix for #101
* Don't modify expected-count when checking pollution. The failing assertion isn't expected, so shouldn't be counted. And if expect wasn't used, the count is misleading.
* Fix order of noglobals check to produce correct introduced/delete error messages
* Prepend module name to sessionStorage keys to avoid conflicts
* Store filter-tests only when checked
* Write to sessionStorage only bad tests
* Moved QUnit.url() defintion after QUnit properties are merged into the global scope. Fixes #93 - QUnit url/extend function breaking urls in jQuery ajax test component
* Add a "Rerun" link to each test to replce the dblclick (still supported, for now).
* Fixed the regex for parsing the name of a test when double clicking to filter.
* Merge remote branch 'scottgonzalez/url'
* Added checkboxes to show which flags are currently on and allow toggling them.
* Retain all querystring parameters when filtering a test via double click.
* Added better querystring parsing. Now storing all querystring params in QUnit.urlParams so that we can carry the params forward when filtering to a specific test. This removes the ability to specify multiple filters.
* Make reordering optional (QUnit.config.reorder = false) and optimize "Hide passed tests" mode by also hiding "Running [testname]" entries.
* Added missing semicolons and wrapped undefined key in quotes.
* Optimize test hiding, add class on page load if stored in sessionStorage
* Optimize the hiding of passed tests.
* Position test results above test list, making it visible without ever having to scroll. Create a placeholder to avoid pushing down results later.
* Don't check for existing qunit-testresult element, it gets killed on init anyway.
* Added URL flag ?notrycatch (ala ?noglobals) for debugging exceptions. Won't try/catch test code, giving better debugging changes on the original exceptions. Fixes #72
* Always show quni-toolbar (if at all specified), persist checkbox via sessionStorage. Fixes #47
* Use non-html testname for calls to fail(). Fixes #77
* Overhaul of QUnit.callbacks. Consistent single argument with related properties, with additonal runtime property for QUnit.done
* Extended test/logs.html to capture more of the callbacks.
* Fixed moduleStart/Done callbacks. Added test/logs.html to test these callbacks. To be extended.
* Update copyright and license header. Fixes #61
* Formatting fix.
* Use a semaphore to synchronize stop() and start() calls. Fixes #76
* Merge branch 'master' of https://github.com/paulirish/qunit into paulirish-master
* Added two tests for previous QUnit.raises behaviour. For #69
* add optional 2. arg to QUnit.raises #69.
* fix references inside Complex Instances Nesting to what was originally intended.
* Qualify calls to ok() in raises() for compability with CLI enviroments.
* Fix done() handling, check for blocking, not block property
* Fix moduleStart/Done and done callbacks.
* Replacing sessionStorage test with the one from Modernizr/master (instead of current release). Here's hoping it'll work for some time.
* Updated test for availibility of sessionStorage, based on test from Modernizr. Fixes #64
* Defer test execution when previous run passed, persisted via sessionStorage. Fixes #49
* Refactored module handling and queuing to enable selective defer of test runs.
* Move assertions property from config to Test
* Move expected-tests property from config to Test
* Refactored test() method to delegate to a Test object to encapsulate all properties and methods of a single test, allowing further modifications.
* Adding output of sourcefile and linenumber of failed assertions (except ok()). Only limited cross-browser support for now. Fixes #60
* Drop 'hide missing tests' feature. Fixes #48
* Adding readme. Fixes #58
* Merge branch 'prettydiff'
* Improve jsDump output with formatted diffs.
* Cleanup whitespace
* Cleanup whitespace
* Added additional guards around browser specific code and cleaned up jsDump code
* Added guards around tests which are only for browsers
* cleaned up setTimeout undefined checking and double done on test finish
* fixing .gitignore
* making window setTimeout query more consistent
* Moved expect-code back to beginning of function, where it belongs. Fixes #52
* Bread crumb in header: Link to suite without filters, add link to current page based on the filter, if present. Fixes #50
* Make the toolbar element optional when checking for show/hide of test results. Fixes #46
* Adding headless.html to manually test logging and verify that QUnit works without output elements. Keeping #qunit-fixture as a few tests actually use that.
* Fix for QUnit.moduleDone, get rid of initial bogus log. Fixes #33
* Pass raw data (result, message, actual, expected) as third argument to QUnit.log. Fixes #32
* Dump full exception. Not pretty, but functional (see issue Pretty diff for pretty output). Fixes #31
* Don't let QUnit.reset() cause assertions to run. Manually applied from Scott Gonzalez branch. Fixes #34
* Added missing semicolons. Fixes #37
* Show okay/failed instead of undefined. Fixes #38
* Expose push as QUnit.push to build custom assertions. Fixes #39
* Respect filter pass selection when writing new results. Fixes #43
* Cleanup tests, removing asyncTest-undefined check and formatting
* Reset: Fall back to innerHTML when jQuery isn't available. Fixes #44
* Merge branch 'master' of github.com:jquery/qunit
* reset doesn't exist here - fixes #28.
* - less css cruft, better readability - replaced inline style for test counts with "counts" class - test counts now use a "failed"/"passed" vs "pass"/"fail", shorter/more distinct selectors - pulled all test counts styling together and up (they're always the same regardless of section pass/fail state)
* Adding .gitignore file
* Removing diff test - diffing works fine, as the browser collapses whitespace in its output, but the test can't do that and isn't worth fixing.
* Always synchronize the done-step (it'll set the timeout when necessary), fixes timing race conditions.
* Insert location.href as an anchor around the header. Fixes issue #29
* - kill double ;; in escapeHtml. oops
* Removed html escaping from QUnit.diff, as input is already escaped, only leads to double escaping. Replaced newlines with single whitespace.
* Optimized and cleaned up CSS file
* Making the reset-method non-global (only module, test and assertions should be global), and fixing the fixture reset by using jQuery's html() method again, doesn't work with innerHTML, yet
* Introducing #qunit-fixture element, deprecating the (never documented) #main element. Doesn't require inline styles and is now independent of jQuery.
* Ammending previous commit: Remove jQuery-core specific resets (will be replaced within jQuery testsuite). Fixes issue #19 - QUnit.reset() removes global jQuery ajax event handlers
* Remove jQuery-core specific resets (will be replaced within jQuery testsuite). Fixes issue #19 - QUnit.reset() removes global jQuery ajax event handlers
* Cleaning up rubble from the previous commit.
* Added raises assertion, reusing some of kennsnyder's code.
* Merged kensnyder's object detection code. Original message: Streamlined object detection and exposed QUnit.objectType as a function.
* Fixed some bad formatting.
* Move various QUnit properties below the globals-export to avoid init becoming a global method. Fixes issue #11 - Remove 'init' function from a global namespace
* Improved output when expected != actual: Output both only then, and add a diff. Fixes issue #10 - Show diff if equal() or deepEqual() failed
* Expand failed tests on load. Fixes issue #8 - Failed tests expanded on load
* Set location.search for url-filtering instead of location.href. Fixes issue #7 - Modify location.search instead of location.href on test double-click
* Add QUnit.begin() callback. Fixes issue #6 - Add 'start' callback.
* add css style for result (".test-actual") in passed tests
* Fixed output escaping by using leeoniya's custom escaping along with innerHTML. Also paves the way for outputting diffs.
* Cleanup
* Revert "Revert part of bad merge, back to using createTextNode"
* Revert part of bad merge, back to using createTextNode
* Fixed doubleclick-handler and filtering to rerun only a single test.
* Add ability to css style a test's messages, expected and actual results. Merged from Leon Sorokin (leeoniya).
* Remove space between module name and colon
* - removed "module" wording from reports (unneeded and cluttery) - added and modified css to make module & test names styleable
* Logging support for Each test can extend the module testEnvironment
* Fixing whitespace
* Update tests to use equal() and deepEqual() rather than the deprecated equals() and same()
* Consistent argument names for deepEqual
* Skip DOM part of jsDump test if using a SSJS environment without a DOM
* Improve async testing by creating the result element before running the test, updating it later. If the test fails, its clear which test is the culprit.
* Add autostart option to config. Set via QUnit.config.autostart = false; start later via QUnit.start()
* Expose QUnit.config, but don't make config a global
* Expose QUnit.config as global to make external workarounds easier
* Merge branch 'asyncsetup'
* Allowing async setup and teardown. Fixes http://github.com/jquery/qunit/issues#issue/20
* Always output expected and actual result (no reason not to). Fixes http://github.com/jquery/qunit/issues#issue/21
* More changes to the detection of types in jsDump's typeOf.
* Change the typeOf checks in QUnit to be more accurate.
* Added test for jsDump and modified its options to properly output results when document.createTextNode is used; currently tests for DOM elements cause a stackoverflow error in IEs, works fine, with the correct output, elsewhere
* Always use jsDump to output result objects into messages, making the output for passing assertions more useful
* Make it so that the display is updated, at least, once a second - also prevents scripts from executing for too long and causing problems.
* added tests and patch for qunit.equiv to avoid circular references in objects and arrays
* No reason to continue looping, we can stop at this point. Thanks to Chris Thatcher for the suggestion.
* Use createTextNode instead of innerHTML for showing test result since expected and actual might be something that looks like a tag.
* 'Test card' design added
* switched green to blue for top-level pass + reduced padding
* Bringing the QUnit API in line with the CommonJS API.
* Explicitly set list-style-position: inside on result LIs.
* Madness with border-radius.
* Corrected banner styles for new class names
* Added rounded corners and removed body rules for embedded tests
* Resolving merge conflicts.
* added colouring for value summary
* adding some extra text colours
* added styles for toolbar
* added new styles
* IE 6 and 7 weren't respecting the CSS rules for the banner, used a different technique instead.
* Went a bit further and made extra-sure that the target was specified correctly.
* Fixed problem where double-clicking an entry in IE caused an error to occur.
* Path for http://dev.jquery.com/ticket/5426 - fix the microformat test result
* Fixed test() to use 'expected' 2nd param
* Remove the named function expressions, to stop Safari 2 from freaking out. Fixes #5.
* Each test can extend the module testEnvironment
* Extra test for current test environment
* Make the current testEnvironment available to utility functions
* typeOf in QUnit.jsDump now uses QUnit.is
* hoozit in QUnit.equiv now uses QUnit.is
* Properly set label attributes.
* Some minor tweaks to RyanS' GETParams change.
* left a console.log in :(
* Took into account a fringe case when using qunit with testswarm. Trying to run all the tests with the extra url params from testswarm would make qunit look for a testsuite that did not exist
* need to set config.currentModule to have correct names and working filters
* Support logging of testEnvironment
* async tests aren't possible on rhino
* Fixed a missing QUnit.reset().
* The QUnit. prefix was missing from the uses of the start() method.
* Merged lifecycle object into testEnvironment
* "replacing totally wrong diff algorithm with a working one" Patch from kassens (manually applied).
* fixing jslint errors in test.js
* Fixed: testDone() was always called with 0 failures in CommonJS mode
* Fixed: moduleDone() was invoked on first call to module()
* Added a new asyncTest method - removes the need for having to call start() at the beginning of an asynchronous test.
* Added support for expected numbers in the test method.
* Fixed broken dynamic loading of tests (can now dynamically load tests and done still works properly).
* Simplified the logic for calling 'done' and pushing off new tests - was causing too many inconsistencies otherwise.
* Simplified the markup for the QUnit test test suite.
* Realized that it's really easy to handle the case where stop() has been called and then an exception is thrown.
* Added in better logging support. Now handle moduleStart/moduleDone and testStart/testDone. Also make sure that done only fires once at the end.
* Made it so that you can reset the suite to an initial state (at which point tests can be dynamically loaded and run, for example).
* Re-worked QUnit to handle dynamic loading of additional code (the 'done' code will be re-run after additional code is loaded).
* Removed the old SVN version stuff.
* Moved the QUnit source into a separate directory and updated the test suite/packages files.
* Added in CommonJS support for exporting the QUnit functionality.
* Missing quote from package.json.
* Fixed trailing comma in package.json.
* Added a CommonJS/Narwhal package.json file.
* Accidentally reverted the jsDump/equiv changes that had been made.
* Hide the filter toolbar if it's not needed. Also exposed the jsDump and equiv objects on QUnit.
* Retooled the QUnit CSS to be more generic.
* Renamed the QUnit files from testrunner/testsuite to QUnit.
* Expose QUnit.equiv and QUnit.jsDump in QUnit.
* Moved the QUnit test directory into the QUnit directory.
* Reworked the QUnit CSS (moved jQuery-specific stuff out, made all the other selectors more specific).
* Removed the #main reset for non-jQuery code (QUnit.reset can be overwritten with your own reset code).
* Moved the QUnit toolbar inline.
* Switched to using a qunit- prefix for special elements (banner, userAgent, and tests).
* Missed a case in QUnit where an element was assumed to exist.
* QUnit's isSet and isObj are no longer needed - you should use same instead.
* Make sure that QUnit's equiv entity escaping is enabled by default (otherwise the output gets kind of crazy).
* Refactored QUnit, completely reorganized the structure of the file. Additionally made it so that QUnit can run outside of a browser (inside Rhino, for example).
* Removed some legacy and jQuery-specific test methods.
* Added callbacks for tests and modules. It's now possible to reproduce the full display of the testrunner without using the regular rendering.
* QUnit no longer depends upon rendering the results (it can work simply by using the logging callbacks).
* Made QUnit no longer require jQuery (it is now a standalone, framework independent, test runner).
* Reverted the noglobals changed from QUnit - causing chaos in the jQuery test suite.
* qunit: removed noglobals flag, instead always check for globals after teardown; if a test has to introduce a global "myVar", use delete window.myVar in teardown or at the end of a test
* qunit: don't child selectors when IE should behave nicely, too
* qunit: improvment for the test-scope: create a new object and call setup, the test, and teardown in the scope of that object - allows you to provide test fixtures to each test without messing with global data; kudos to Martin Häcker for the contribution
* qunit: added missing semicolons
* qunit: fixed a semicolon, that should have been a comma
* QUnit: implemented error handling for Opera as proposed by #3628
* qunit: fix for http://dev.jquery.com/ticket/3215 changing wording of testresults, to something more positive (x of y passed, z failed)
* QUnit: testrunner.js: Ensures equality of types (String, Boolean, Number) declared with the 'new' prefix. See comments #3, #4 and #5 on http://philrathe.com/articles/equiv
* qunit: wrap name of test in span when a module is used for better styling
* qunit: auto-prepend default mark (#header, #banner, #userAgent, #tests) when not present
* Landing some changes to add logging to QUnit (so that it's easier to hook in to when a test finishes).
* Added checkbox for hiding missing tests (tests that fail with the text 'missing test - untested code is broken code')
* qunit: eol-style:native and mime-type
* HTML being injected for the test result wasn't valid HTML.
* qunit: setting mimetype for testsuite.css
* qunit: update to Ariel's noglobals patch to support async tests as well
* Landing Ariel's change - checks for global variable leakage.
* qunit: run module-teardown in its own synchronize block to synchronize with async tests (ugh)
* qunit: same: equiv - completely refactored in the testrunner.
* testrunner.js: - Update equiv to support Date and RegExp. - Change behavior when comparing function: - abort when in an instance of Object (when references comparison failed) - skip otherwise (like before)
* qunit: code refactoring and cleanup
* QUnit: update equiv to latest version, handling multiple arguments and NaN, see http://philrathe.com/articles/equiv
* QUnit: cleanup, deprecating compare, compare2 and serialArray: usage now throws an error with a helpful message
* QUnit: optional timeout argument for stop, while making tests undetermined, useful for debugging
* QUnit: added toolbar with "hide passed tests" checkbox to help focus on failed tests
* QUnit: minor output formatting
* QUnit: adding same-assertion for a recursive comparsion of primite values, arrays and objects, thanks to Philippe Rathé for the contribution, including tests
* QUnit: adding same-assertion for a recursive comparsion of primite values, arrays and objects, thanks to Philippe Rathé for the contribution, including tests
* QUnit: adding same-assertion for a recursive comparsion of primite values, arrays and objects, thanks to Philippe Rathé for the contribution, including tests
* qunit: use window.load to initialize tests, allowing other code to run on document-ready before starting to run tests
* qunit: allow either setup or teardown, instead of both or nothing
* qunit: make everything private by default, expose only public API; removed old timeout-option (non-deterministic, disabled for a long time anyway); use local $ reference instead of global jQuery reference; minor code cleanup (var config instead of _config; queue.shift instead of slice)
* qunit: added support for module level setup/teardown callbacks
* qunit: modified example for equals to avoid confusion with parameter ordering
* qunit: added id/classes to result element to enable integration with browser automation tools, see http://docs.jquery.com/QUnit#Integration_into_Browser_Automation_Tools
* qunit: replaced $ alias with jQuery (merged from jquery/test/data/testrunner.js)
* qunit: fixed inline documentation for equals
* qunit testrunner - catch and log possible error during reset()
* QUnit: Switched out Date and Rev for Id.
* qunit: when errors are thrown in a test, the message is successfully show on all browsers.
* qunit: added license header
* qunit: moved jquery testrunner to top-level project, see http://docs.jquery.com/QUnit
* Share project 'qunit' into 'https://jqueryjs.googlecode.com/svn'
jquery_1.7.2+dfsg/test/qunit/addons/ 0000755 0001750 0001750 00000000000 11757032022 016415 5 ustar metal metal jquery_1.7.2+dfsg/test/qunit/addons/close-enough/ 0000755 0001750 0001750 00000000000 11757032022 021005 5 ustar metal metal jquery_1.7.2+dfsg/test/qunit/addons/close-enough/qunit-close-enough.js 0000644 0001750 0001750 00000002246 11757032022 025075 0 ustar metal metal QUnit.extend( QUnit, {
/**
* Checks that the first two arguments are equal, or are numbers close enough to be considered equal
* based on a specified maximum allowable difference.
*
* @example close(3.141, Math.PI, 0.001);
*
* @param Number actual
* @param Number expected
* @param Number maxDifference (the maximum inclusive difference allowed between the actual and expected numbers)
* @param String message (optional)
*/
close: function(actual, expected, maxDifference, message) {
var passes = (actual === expected) || Math.abs(actual - expected) <= maxDifference;
QUnit.push(passes, actual, expected, message);
},
/**
* Checks that the first two arguments are numbers with differences greater than the specified
* minimum difference.
*
* @example notClose(3.1, Math.PI, 0.001);
*
* @param Number actual
* @param Number expected
* @param Number minDifference (the minimum exclusive difference allowed between the actual and expected numbers)
* @param String message (optional)
*/
notClose: function(actual, expected, minDifference, message) {
QUnit.push(Math.abs(actual - expected) > minDifference, actual, expected, message);
}
}); jquery_1.7.2+dfsg/test/qunit/addons/close-enough/close-enough.html 0000644 0001750 0001750 00000001162 11757032022 024263 0 ustar metal metal
QUnit Test Suite - Close Enough Addon
QUnit Test Suite - Close Enough
jquery_1.7.2+dfsg/test/qunit/addons/close-enough/close-enough-test.js 0000644 0001750 0001750 00000001374 11757032022 024715 0 ustar metal metal test("Close Numbers", function () {
QUnit.close(7, 7, 0);
QUnit.close(7, 7.1, 0.1);
QUnit.close(7, 7.1, 0.2);
QUnit.close(3.141, Math.PI, 0.001);
QUnit.close(3.1, Math.PI, 0.1);
var halfPi = Math.PI / 2;
QUnit.close(halfPi, 1.57, 0.001);
var sqrt2 = Math.sqrt(2);
QUnit.close(sqrt2, 1.4142, 0.0001);
QUnit.close(Infinity, Infinity, 1);
});
test("Distant Numbers", function () {
QUnit.notClose(6, 7, 0);
QUnit.notClose(7, 7.2, 0.1);
QUnit.notClose(7, 7.2, 0.19999999999);
QUnit.notClose(3.141, Math.PI, 0.0001);
QUnit.notClose(3.1, Math.PI, 0.001);
var halfPi = Math.PI / 2;
QUnit.notClose(halfPi, 1.57, 0.0001);
var sqrt2 = Math.sqrt(2);
QUnit.notClose(sqrt2, 1.4142, 0.00001);
QUnit.notClose(Infinity, -Infinity, 5);
}); jquery_1.7.2+dfsg/test/qunit/addons/close-enough/README.md 0000644 0001750 0001750 00000001167 11757032022 022271 0 ustar metal metal Close-Enough - A QUnit Addon For Number Approximations
================================
This addon for QUnit adds close and notClose assertion methods, to test that
numbers are close enough (or different enough) from an expected number, with
a specified accuracy.
Usage:
close(actual, expected, maxDifference, message)
notClose(actual, expected, minDifference, message)
Where:
* maxDifference: the maximum inclusive difference allowed between the actual and expected numbers
* minDifference: the minimum exclusive difference allowed between the actual and expected numbers
* actual, expected, message: The usual
jquery_1.7.2+dfsg/test/qunit/addons/canvas/ 0000755 0001750 0001750 00000000000 11757032022 017670 5 ustar metal metal jquery_1.7.2+dfsg/test/qunit/addons/canvas/canvas-test.js 0000644 0001750 0001750 00000005117 11757032022 022462 0 ustar metal metal test("Canvas pixels", function () {
var canvas = document.getElementById('qunit-canvas'), context;
try {
context = canvas.getContext('2d');
} catch(e) {
// propably no canvas support, just exit
return;
}
context.fillStyle = 'rgba(0, 0, 0, 0)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 0, 0);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(255, 0, 0, 0)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 0, 0);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 255, 0, 0)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 0, 0);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 255, 0)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 0, 0);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(255, 0, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 255, 0, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 255, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 255, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 255, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 255, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 2, 2, 0, 0, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(255, 0, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 2, 2, 255, 0, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 255, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 2, 2, 0, 255, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 255, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 2, 2, 0, 0, 255, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 0, 1)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 4, 4, 0, 0, 0, 255);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(255, 0, 0, 1)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 4, 4, 255, 0, 0, 255);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 255, 0, 1)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 4, 4, 0, 255, 0, 255);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 255, 1)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 4, 4, 0, 0, 255, 255);
context.clearRect(0,0,5,5);
});
jquery_1.7.2+dfsg/test/qunit/addons/canvas/qunit-canvas.js 0000644 0001750 0001750 00000000435 11757032022 022641 0 ustar metal metal QUnit.extend( QUnit, {
pixelEqual: function(canvas, x, y, r, g, b, a, message) {
var actual = Array.prototype.slice.apply(canvas.getContext('2d').getImageData(x, y, 1, 1).data), expected = [r, g, b, a];
QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
}
});
jquery_1.7.2+dfsg/test/qunit/addons/canvas/README.md 0000644 0001750 0001750 00000000747 11757032022 021157 0 ustar metal metal Canvas - A QUnit Addon For Testing Canvas Rendering
================================
This addon for QUnit adds a pixelEqual method that allows you to assert
individual pixel values in a given canvas.
Usage:
pixelEqual(canvas, x, y, r, g, b, a, message)
Where:
* canvas: Reference to a canvas element
* x, y: Coordinates of the pixel to test
* r, g, b, a: The color and opacity value of the pixel that you except
* message: Optional message, same as for other assertions
jquery_1.7.2+dfsg/test/qunit/addons/canvas/canvas.html 0000644 0001750 0001750 00000001232 11757032022 022027 0 ustar metal metal
QUnit Test Suite - Canvas Addon
QUnit Test Suite - Canvas Addon
jquery_1.7.2+dfsg/test/qunit/addons/step/ 0000755 0001750 0001750 00000000000 11757032022 017370 5 ustar metal metal jquery_1.7.2+dfsg/test/qunit/addons/step/step-test.js 0000644 0001750 0001750 00000000475 11757032022 021664 0 ustar metal metal module('Step Addon');
test("step", 3, function () {
QUnit.step(1, "step starts at 1");
setTimeout(function () {
start();
QUnit.step(3);
}, 100);
QUnit.step(2, "before the setTimeout callback is run");
stop();
});
test("step counter", 1, function () {
QUnit.step(1, "each test has its own step counter");
}); jquery_1.7.2+dfsg/test/qunit/addons/step/qunit-step.js 0000644 0001750 0001750 00000001224 11757032022 022036 0 ustar metal metal QUnit.extend( QUnit, {
/**
* Check the sequence/order
*
* @example step(1); setTimeout(function () { step(3); }, 100); step(2);
* @param Number expected The excepted step within the test()
* @param String message (optional)
*/
step: function (expected, message) {
this.config.current.step++; // increment internal step counter.
if (typeof message == "undefined") {
message = "step " + expected;
}
var actual = this.config.current.step;
QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
}
});
/**
* Reset the step counter for every test()
*/
QUnit.testStart(function () {
this.config.current.step = 0;
});
jquery_1.7.2+dfsg/test/qunit/addons/step/README.md 0000644 0001750 0001750 00000000716 11757032022 020653 0 ustar metal metal QUnit.step() - A QUnit Addon For Testing execution in order
============================================================
This addon for QUnit adds a step method that allows you to assert
the proper sequence in which the code should execute.
Example:
test("example test", function () {
function x() {
QUnit.step(2, "function y should be called first");
}
function y() {
QUnit.step(1);
}
y();
x();
}); jquery_1.7.2+dfsg/test/qunit/addons/step/step.html 0000644 0001750 0001750 00000001222 11757032022 021226 0 ustar metal metal
QUnit Test Suite - Step Addon
QUnit Test Suite - Step Addon
jquery_1.7.2+dfsg/test/qunit/addons/composite/ 0000755 0001750 0001750 00000000000 11757032022 020417 5 ustar metal metal jquery_1.7.2+dfsg/test/qunit/addons/composite/dummy-same-test.html 0000644 0001750 0001750 00000001016 11757032022 024336 0 ustar metal metal
QUnit Same Test Suite
QUnit Same Test Suite
test markup
jquery_1.7.2+dfsg/test/qunit/addons/composite/qunit-composite.css 0000644 0001750 0001750 00000000301 11757032022 024263 0 ustar metal metal iframe.qunit-subsuite{
position: fixed;
bottom: 0;
left: 0;
margin: 0;
padding: 0;
border-width: 1px 0 0;
height: 45%;
width: 100%;
background: #fff;
} jquery_1.7.2+dfsg/test/qunit/addons/composite/dummy-qunit-test.html 0000644 0001750 0001750 00000001016 11757032022 024551 0 ustar metal metal
QUnit Core Test Suite
QUnit Core Test Suite
test markup
jquery_1.7.2+dfsg/test/qunit/addons/composite/composite-demo-test.html 0000644 0001750 0001750 00000001420 11757032022 025203 0 ustar metal metal
QUnit SubsuiteRunner Test Suite
QUnit SubsuiteRunner Test Suite
jquery_1.7.2+dfsg/test/qunit/addons/composite/index.html 0000644 0001750 0001750 00000002264 11757032022 022420 0 ustar metal metal
Composite
Composite
A QUnit Addon For Running Multiple Test Files
Composite is a QUnit addon that, when handed an array of
files, will open each of those files inside of an iframe, run
the tests and display the results as a single suite of QUnit
tests.
Using Composite
To use Composite, setup a standard QUnit html page as you
would with other QUnit tests. Remember to include composite.js
and composite.css. Then, inside of either an external js file,
or a script block call the only new method that Composite
exposes, QUnit.testSuites().
QUnit.testSuites() is
passed an array of test files to run as follows:
You can help us by dropping that code into your existing application and letting us know that if anything no longer works. Please file a bug and be sure to mention that you're testing against jQuery {{version}}.
We want to encourage everyone from the community to try and get involved in contributing back to jQuery core. We've set up a full page of information dedicated towards becoming more involved with the team. The team is here and ready to help you help us!
jQuery {{version}} Change Log
The current change log of the {{version}} release.
{{/categories}}
jquery_1.7.2+dfsg/build/freq.js 0000644 0001750 0001750 00000002334 11757032022 015422 0 ustar metal metal #! /usr/bin/env node
var fs = require( "fs" );
function isEmptyObject( obj ) {
for ( var name in obj ) {
return false;
}
return true;
}
function extend( obj ) {
var dest = obj,
src = [].slice.call( arguments, 1 );
Object.keys( src ).forEach(function( key ) {
var copy = src[ key ];
for ( var prop in copy ) {
dest[ prop ] = copy[ prop ];
}
});
return dest;
};
function charSort( obj, callback ) {
var ordered = [],
table = {},
copied;
copied = extend({}, obj );
(function order() {
var largest = 0,
c;
for ( var i in obj ) {
if ( obj[ i ] >= largest ) {
largest = obj[ i ];
c = i;
}
}
ordered.push( c );
delete obj[ c ];
if ( !isEmptyObject( obj ) ) {
order();
} else {
ordered.forEach(function( val ) {
table[ val ] = copied[ val ];
});
callback( table );
}
})();
}
function charFrequency( src, callback ) {
var obj = {};
src.replace(/[^\w]|\d/gi, "").split("").forEach(function( c ) {
obj[ c ] ? ++obj[ c ] : ( obj[ c ] = 1 );
});
return charSort( obj, callback );
}
charFrequency( fs.readFileSync( "dist/jquery.min.js", "utf8" ), function( obj ) {
var chr;
for ( chr in obj ) {
console.log( " " + chr + " " + obj[ chr ] );
}
});
jquery_1.7.2+dfsg/version.txt 0000644 0001750 0001750 00000000005 11757032022 015247 0 ustar metal metal 1.7.2 jquery_1.7.2+dfsg/GPL-LICENSE.txt 0000644 0001750 0001750 00000035373 11757032022 015304 0 ustar metal metal GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
jquery_1.7.2+dfsg/src/ 0000755 0001750 0001750 00000000000 11757032022 013615 5 ustar metal metal jquery_1.7.2+dfsg/src/css.js 0000644 0001750 0001750 00000026647 11757032022 014762 0 ustar metal metal (function( jQuery ) {
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnum = /^[\-+]?(?:\d*\.)?\d+$/i,
rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
rrelNum = /^([\-+])=([\-+.\de]+)/,
rmargin = /^margin/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
// order is important!
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
curCSS,
getComputedStyle,
currentStyle;
jQuery.fn.css = function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
};
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
} else {
return elem.style.opacity;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra ) {
var ret, hooks;
// Make sure that we're working with the right name
name = jQuery.camelCase( name );
hooks = jQuery.cssHooks[ name ];
name = jQuery.cssProps[ name ] || name;
// cssFloat needs a special treatment
if ( name === "cssFloat" ) {
name = "float";
}
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
return ret;
// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
return curCSS( elem, name );
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {},
ret, name;
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
// DEPRECATED in 1.3, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, name ) {
var ret, defaultView, computedStyle, width,
style = elem.style;
name = name.replace( rupper, "-$1" ).toLowerCase();
if ( (defaultView = elem.ownerDocument.defaultView) &&
(computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
}
// A tribute to the "awesome hack by Dean Edwards"
// WebKit uses "computed value (percentage if specified)" instead of "used value" for margins
// which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) {
width = style.width;
style.width = ret;
ret = computedStyle.width;
style.width = width;
}
return ret;
};
}
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left, rsLeft, uncomputed,
ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && (uncomputed = style[ name ]) ) {
ret = uncomputed;
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( rnumnonpx.test( ret ) ) {
// Remember the original values
left = style.left;
rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
elem.runtimeStyle.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
curCSS = getComputedStyle || currentStyle;
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
i = name === "width" ? 1 : 0,
len = 4;
if ( val > 0 ) {
if ( extra !== "border" ) {
for ( ; i < len; i += 2 ) {
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
}
}
return val + "px";
}
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Add padding, border, margin
if ( extra ) {
for ( ; i < len; i += 2 ) {
val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
if ( extra !== "padding" ) {
val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0;
}
}
}
return val + "px";
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
return getWidthOrHeight( elem, name, extra );
} else {
return jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
});
}
}
},
set: function( elem, value ) {
return rnum.test( value ) ?
value + "px" :
value;
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( parseFloat( RegExp.$1 ) / 100 ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there there is no filter style applied in a css rule, we are done
if ( currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
jQuery(function() {
// This hook cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
return curCSS( elem, "margin-right" );
} else {
return elem.style.marginRight;
}
});
}
};
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i,
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ],
expanded = {};
for ( i = 0; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
});
})( jQuery );
jquery_1.7.2+dfsg/src/data.js 0000644 0001750 0001750 00000022546 11757032022 015075 0 ustar metal metal (function( jQuery ) {
var rbrace = /^(?:\{.*\}|\[.*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
// Please use with caution
uuid: 0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var privateCache, thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
isEvents = name === "events";
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = ++jQuery.uuid;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
privateCache = thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Users should not attempt to inspect the internal events object using jQuery.data,
// it is undocumented and subject to change. But does anyone listen? No.
if ( isEvents && !thisCache[ name ] ) {
return privateCache.events;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i, l,
// Reference to internal data cache key
internalKey = jQuery.expando,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
// See jQuery.data for more information
id = isNode ? elem[ internalKey ] : internalKey;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split( " " );
}
}
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject(cache[ id ]) ) {
return;
}
}
// Browsers that fail expando deletion also refuse to delete expandos on
// the window, but it will allow it on all other JS objects; other browsers
// don't care
// Ensure that `cache` is not a window object #10080
if ( jQuery.support.deleteExpando || !cache.setInterval ) {
delete cache[ id ];
} else {
cache[ id ] = null;
}
// We destroyed the cache and need to eliminate the expando on the node to avoid
// false lookups in the cache for entries that no longer exist
if ( isNode ) {
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( jQuery.support.deleteExpando ) {
delete elem[ internalKey ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
}
},
// For internal use only.
_data: function( elem, name, data ) {
return jQuery.data( elem, name, data, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
if ( elem.nodeName ) {
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
if ( match ) {
return !(match === true || elem.getAttribute("classid") !== match);
}
}
return true;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var parts, part, attr, name, l,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attr = elem.attributes;
for ( l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
parts = key.split( ".", 2 );
parts[1] = parts[1] ? "." + parts[1] : "";
part = parts[1] + "!";
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
data = this.triggerHandler( "getData" + part, [ parts[0] ] );
// Try to fetch any internally stored data first
if ( data === undefined && elem ) {
data = jQuery.data( elem, key );
data = dataAttr( elem, key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
}
parts[1] = value;
this.each(function() {
var self = jQuery( this );
self.triggerHandler( "setData" + part, parts );
jQuery.data( this, key, value );
self.triggerHandler( "changeData" + part, parts );
});
}, null, value, arguments.length > 1, null, false );
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
jQuery.isNumeric( data ) ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
for ( var name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
})( jQuery );
jquery_1.7.2+dfsg/src/support.js 0000644 0001750 0001750 00000024267 11757032022 015702 0 ustar metal metal (function( jQuery ) {
jQuery.support = (function() {
var support,
all,
a,
select,
opt,
input,
fragment,
tds,
events,
eventName,
i,
isSupported,
div = document.createElement( "div" ),
documentElement = document.documentElement;
// Preliminary tests
div.setAttribute("className", "t");
div.innerHTML = "
a";
all = div.getElementsByTagName( "*" );
a = div.getElementsByTagName( "a" )[ 0 ];
// Can't get basic test support
if ( !all || !all.length || !a ) {
return {};
}
// First batch of supports tests
select = document.createElement( "select" );
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName( "input" )[ 0 ];
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: ( a.getAttribute("href") === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.55/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Tests for enctype support on a form(#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>",
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true,
pixelMargin: true
};
// jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.attachEvent( "onclick", function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent( "onclick" );
}
// Check if a radio maintains its value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute("type", "radio");
support.radioValue = input.value === "t";
input.setAttribute("checked", "checked");
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "name", "t" );
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.lastChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
fragment.removeChild( input );
fragment.appendChild( div );
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for ( i in {
submit: 1,
change: 1,
focusin: 1
}) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
fragment.removeChild( div );
// Null elements to avoid leaks in IE
fragment = select = opt = div = input = null;
// Run tests that need a body at doc ready
jQuery(function() {
var container, outer, inner, table, td, offsetSupport,
marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
paddingMarginBorderVisibility, paddingMarginBorder,
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
conMarginTop = 1;
paddingMarginBorder = "padding:0;margin:0;border:";
positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
html = "
" +
"
" +
"
";
container = document.createElement("div");
container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
body.insertBefore( container, body.firstChild );
// Construct the test element
div = document.createElement("div");
container.appendChild( div );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div.innerHTML = "
t
";
tds = div.getElementsByTagName( "td" );
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE <= 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( window.getComputedStyle ) {
div.innerHTML = "";
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.style.width = "2px";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
if ( typeof div.style.zoom !== "undefined" ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.innerHTML = "";
div.style.width = div.style.padding = "1px";
div.style.border = 0;
div.style.overflow = "hidden";
div.style.display = "inline";
div.style.zoom = 1;
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "block";
div.style.overflow = "visible";
div.innerHTML = "";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
}
div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
div.innerHTML = html;
outer = div.firstChild;
inner = outer.firstChild;
td = outer.nextSibling.firstChild.firstChild;
offsetSupport = {
doesNotAddBorder: ( inner.offsetTop !== 5 ),
doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
};
inner.style.position = "fixed";
inner.style.top = "20px";
// safari subtracts parent border width here which is 5px
offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
inner.style.position = inner.style.top = "";
outer.style.overflow = "hidden";
outer.style.position = "relative";
offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
if ( window.getComputedStyle ) {
div.style.marginTop = "1%";
support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";
}
if ( typeof container.style.zoom !== "undefined" ) {
container.style.zoom = 1;
}
body.removeChild( container );
marginDiv = div = container = null;
jQuery.extend( support, offsetSupport );
});
return support;
})();
})( jQuery );
jquery_1.7.2+dfsg/src/deferred.js 0000644 0001750 0001750 00000007501 11757032022 015736 0 ustar metal metal (function( jQuery ) {
var // Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({
Deferred: function( func ) {
var doneList = jQuery.Callbacks( "once memory" ),
failList = jQuery.Callbacks( "once memory" ),
progressList = jQuery.Callbacks( "memory" ),
state = "pending",
lists = {
resolve: doneList,
reject: failList,
notify: progressList
},
promise = {
done: doneList.add,
fail: failList.add,
progress: progressList.add,
state: function() {
return state;
},
// Deprecated
isResolved: doneList.fired,
isRejected: failList.fired,
then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
return this;
},
always: function() {
deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
return this;
},
pipe: function( fnDone, fnFail, fnProgress ) {
return jQuery.Deferred(function( newDefer ) {
jQuery.each( {
done: [ fnDone, "resolve" ],
fail: [ fnFail, "reject" ],
progress: [ fnProgress, "notify" ]
}, function( handler, data ) {
var fn = data[ 0 ],
action = data[ 1 ],
returned;
if ( jQuery.isFunction( fn ) ) {
deferred[ handler ](function() {
returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {
deferred[ handler ]( newDefer[ action ] );
}
});
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
if ( obj == null ) {
obj = promise;
} else {
for ( var key in promise ) {
obj[ key ] = promise[ key ];
}
}
return obj;
}
},
deferred = promise.promise({}),
key;
for ( key in lists ) {
deferred[ key ] = lists[ key ].fire;
deferred[ key + "With" ] = lists[ key ].fireWith;
}
// Handle state
deferred.done( function() {
state = "resolved";
}, failList.disable, progressList.lock ).fail( function() {
state = "rejected";
}, doneList.disable, progressList.lock );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( firstParam ) {
var args = sliceDeferred.call( arguments, 0 ),
i = 0,
length = args.length,
pValues = new Array( length ),
count = length,
pCount = length,
deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
firstParam :
jQuery.Deferred(),
promise = deferred.promise();
function resolveFunc( i ) {
return function( value ) {
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
if ( !( --count ) ) {
deferred.resolveWith( deferred, args );
}
};
}
function progressFunc( i ) {
return function( value ) {
pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
deferred.notifyWith( promise, pValues );
};
}
if ( length > 1 ) {
for ( ; i < length; i++ ) {
if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
} else {
--count;
}
}
if ( !count ) {
deferred.resolveWith( deferred, args );
}
} else if ( deferred !== firstParam ) {
deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
}
return promise;
}
});
})( jQuery );
jquery_1.7.2+dfsg/src/queue.js 0000644 0001750 0001750 00000010564 11757032022 015305 0 ustar metal metal (function( jQuery ) {
function handleQueueMarkDefer( elem, type, src ) {
var deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
defer = jQuery._data( elem, deferDataKey );
if ( defer &&
( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
// Give room for hard-coded callbacks to fire first
// and eventually mark/queue something else on the element
setTimeout( function() {
if ( !jQuery._data( elem, queueDataKey ) &&
!jQuery._data( elem, markDataKey ) ) {
jQuery.removeData( elem, deferDataKey, true );
defer.fire();
}
}, 0 );
}
}
jQuery.extend({
_mark: function( elem, type ) {
if ( elem ) {
type = ( type || "fx" ) + "mark";
jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
}
},
_unmark: function( force, elem, type ) {
if ( force !== true ) {
type = elem;
elem = force;
force = false;
}
if ( elem ) {
type = type || "fx";
var key = type + "mark",
count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
if ( count ) {
jQuery._data( elem, key, count );
} else {
jQuery.removeData( elem, key, true );
handleQueueMarkDefer( elem, type, "mark" );
}
}
},
queue: function( elem, type, data ) {
var q;
if ( elem ) {
type = ( type || "fx" ) + "queue";
q = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !q || jQuery.isArray(data) ) {
q = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
q.push( data );
}
}
return q || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
hooks = {};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
jQuery._data( elem, type + ".run", hooks );
fn.call( elem, function() {
jQuery.dequeue( elem, type );
}, hooks );
}
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue " + type + ".run", true );
handleQueueMarkDefer( elem, type, "queue" );
}
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
i = elements.length,
count = 1,
deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
tmp;
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
count++;
tmp.add( resolve );
}
}
resolve();
return defer.promise( object );
}
});
})( jQuery );
jquery_1.7.2+dfsg/src/exports.js 0000644 0001750 0001750 00000002060 11757032022 015655 0 ustar metal metal (function( jQuery ) {
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( jQuery );
jquery_1.7.2+dfsg/src/ajax/ 0000755 0001750 0001750 00000000000 11757032022 014540 5 ustar metal metal jquery_1.7.2+dfsg/src/ajax/jsonp.js 0000644 0001750 0001750 00000003746 11757032022 016241 0 ustar metal metal (function( jQuery ) {
var jsc = jQuery.now(),
jsre = /(\=)\?(&|$)|\?\?/i;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
return jQuery.expando + "_" + ( jsc++ );
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType );
if ( s.dataTypes[ 0 ] === "jsonp" ||
s.jsonp !== false && ( jsre.test( s.url ) ||
inspectData && jsre.test( s.data ) ) ) {
var responseContainer,
jsonpCallback = s.jsonpCallback =
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
previous = window[ jsonpCallback ],
url = s.url,
data = s.data,
replace = "$1" + jsonpCallback + "$2";
if ( s.jsonp !== false ) {
url = url.replace( jsre, replace );
if ( s.url === url ) {
if ( inspectData ) {
data = data.replace( jsre, replace );
}
if ( s.data === data ) {
// Add callback manually
url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
}
}
}
s.url = url;
s.data = data;
// Install callback
window[ jsonpCallback ] = function( response ) {
responseContainer = [ response ];
};
// Clean-up function
jqXHR.always(function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( previous ) ) {
window[ jsonpCallback ]( responseContainer[ 0 ] );
}
});
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( jsonpCallback + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Delegate to script
return "script";
}
});
})( jQuery );
jquery_1.7.2+dfsg/src/ajax/xhr.js 0000644 0001750 0001750 00000014345 11757032022 015706 0 ustar metal metal (function( jQuery ) {
var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject ? function() {
// Abort all pending requests
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( 0, 1 );
}
} : false,
xhrId = 0,
xhrCallbacks;
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
(function( xhr ) {
jQuery.extend( jQuery.support, {
ajax: !!xhr,
cors: !!xhr && ( "withCredentials" in xhr )
});
})( jQuery.ajaxSettings.xhr() );
// Create transport if the browser can provide an xhr
if ( jQuery.support.ajax ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var xhr = s.xhr(),
handle,
i;
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( _ ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status,
statusText,
responseHeaders,
responses,
xml;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occured
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
try {
responses.text = xhr.responseText;
} catch( _ ) {
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
// if we're in sync mode or it's in cache
// and has been retrieved directly (IE6 & IE7)
// we need to manually fire the callback
if ( !s.async || xhr.readyState === 4 ) {
callback();
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback(0,1);
}
}
};
}
});
}
})( jQuery );
jquery_1.7.2+dfsg/src/ajax/script.js 0000644 0001750 0001750 00000003634 11757032022 016410 0 ustar metal metal (function( jQuery ) {
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript|ecmascript/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = "async";
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( head && script.parentNode ) {
head.removeChild( script );
}
// Dereference the script
script = undefined;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( 0, 1 );
}
}
};
}
});
})( jQuery );
jquery_1.7.2+dfsg/src/event.js 0000644 0001750 0001750 00000077142 11757032022 015307 0 ustar metal metal (function( jQuery ) {
var rformElems = /^(?:textarea|input|select)$/i,
rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
quickParse = function( selector ) {
var quick = rquickIs.exec( selector );
if ( quick ) {
// 0 1 2 3
// [ _, tag, id, class ]
quick[1] = ( quick[1] || "" ).toLowerCase();
quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
}
return quick;
},
quickIs = function( elem, m ) {
var attrs = elem.attributes || {};
return (
(!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
(!m[2] || (attrs.id || {}).value === m[2]) &&
(!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
);
},
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
add: function( elem, types, handler, data, selector ) {
var elemData, eventHandle, events,
t, tns, type, namespaces, handleObj,
handleObjIn, quick, handlers, special;
// Don't attach events to noData or text/comment nodes (allow plain objects tho)
if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
events = elemData.events;
if ( !events ) {
elemData.events = events = {};
}
eventHandle = elemData.handle;
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = jQuery.trim( hoverHack(types) ).split( " " );
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = ( tns[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: tns[1],
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
quick: selector && quickParse( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
handlers = events[ type ];
if ( !handlers ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
t, tns, type, origType, namespaces, origCount,
j, events, special, handle, eventType, handleObj;
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = origType = tns[1];
namespaces = tns[2];
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector? special.delegateType : special.bindType ) || type;
eventType = events[ type ] || [];
origCount = eventType.length;
namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
// Remove matching events
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !namespaces || namespaces.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
eventType.splice( j--, 1 );
if ( handleObj.selector ) {
eventType.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( eventType.length === 0 && origCount !== eventType.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
handle = elemData.handle;
if ( handle ) {
handle.elem = null;
}
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery.removeData( elem, [ "events", "handle" ], true );
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Don't do events on text and comment nodes
if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
return;
}
// Event object or event type
var type = event.type || event,
namespaces = [],
cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "!" ) >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf( "." ) >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.isTrigger = true;
event.exclusive = exclusive;
event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
cache = jQuery.cache;
for ( i in cache ) {
if ( cache[ i ].events && cache[ i ].events[ type ] ) {
jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
}
}
return;
}
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
eventPath = [[ elem, special.bindType || type ]];
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
old = null;
for ( ; cur; cur = cur.parentNode ) {
eventPath.push([ cur, bubbleType ]);
old = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( old && old === elem.ownerDocument ) {
eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
}
}
// Fire handlers on the event path
for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
cur = eventPath[i][0];
event.type = eventPath[i][1];
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Note that this is a bare JS function and not a jQuery handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486)
if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( old ) {
elem[ ontype ] = old;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event );
var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount,
args = [].slice.call( arguments, 0 ),
run_all = !event.exclusive && !event.namespace,
special = jQuery.event.special[ event.type ] || {},
handlerQueue = [],
i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers that should run if there are delegated events
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !(event.button && event.type === "click") ) {
// Pregenerate a single jQuery object for reuse with .is()
jqcur = jQuery(this);
jqcur.context = this.ownerDocument || this;
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
// Don't process events on disabled elements (#6911, #8165)
if ( cur.disabled !== true ) {
selMatch = {};
matches = [];
jqcur[0] = cur;
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
sel = handleObj.selector;
if ( selMatch[ sel ] === undefined ) {
selMatch[ sel ] = (
handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
);
}
if ( selMatch[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, matches: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( handlers.length > delegateCount ) {
handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
}
// Run delegates first; they may want to stop propagation beneath us
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
// Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var eventDoc, doc, body,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop,
originalEvent = event,
fixHook = jQuery.event.fixHooks[ event.type ] || {},
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = jQuery.Event( originalEvent );
for ( i = copy.length; i; ) {
prop = copy[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Target should not be a text node (#504, Safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
if ( event.metaKey === undefined ) {
event.metaKey = event.ctrlKey;
}
return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
special: {
ready: {
// Make sure the ready event is setup
setup: jQuery.bindReady
},
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
delegateType: "focusin"
},
blur: {
delegateType: "focusout"
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle = jQuery.event.dispatch;
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
if ( elem.detachEvent ) {
elem.detachEvent( "on" + type, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var target = this,
related = event.relatedTarget,
handleObj = event.handleObj,
selector = handleObj.selector,
ret;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !form._submit_attached ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
form._submit_attached = true;
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
jQuery.event.simulate( "change", this, event, true );
}
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
elem._change_attached = true;
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) { // && selector != null
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
var handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( var type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
live: function( types, data, fn ) {
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
},
die: function( types, fn ) {
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
if ( jQuery.attrFn ) {
jQuery.attrFn[ name ] = true;
}
if ( rkeyEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
}
if ( rmouseEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
}
});
})( jQuery );
jquery_1.7.2+dfsg/src/intro.js 0000644 0001750 0001750 00000001036 11757032022 015306 0 ustar metal metal /*!
* jQuery JavaScript Library v@VERSION
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: @DATE
*/
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
navigator = window.navigator,
location = window.location;
jquery_1.7.2+dfsg/src/offset.js 0000644 0001750 0001750 00000015617 11757032022 015453 0 ustar metal metal (function( jQuery ) {
var getOffset,
rtable = /^t(?:able|d|h)$/i,
rroot = /^(?:body|html)$/i;
if ( "getBoundingClientRect" in document.documentElement ) {
getOffset = function( elem, doc, docElem, box ) {
try {
box = elem.getBoundingClientRect();
} catch(e) {}
// Make sure we're not dealing with a disconnected DOM node
if ( !box || !jQuery.contains( docElem, elem ) ) {
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
}
var body = doc.body,
win = getWindow( doc ),
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
top = box.top + scrollTop - clientTop,
left = box.left + scrollLeft - clientLeft;
return { top: top, left: left };
};
} else {
getOffset = function( elem, doc, docElem ) {
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
body = doc.body,
defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop,
left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
break;
}
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
top -= elem.scrollTop;
left -= elem.scrollLeft;
if ( elem === offsetParent ) {
top += elem.offsetTop;
left += elem.offsetLeft;
if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevOffsetParent = offsetParent;
offsetParent = elem.offsetParent;
}
if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevComputedStyle = computedStyle;
}
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
top += body.offsetTop;
left += body.offsetLeft;
}
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
top += Math.max( docElem.scrollTop, body.scrollTop );
left += Math.max( docElem.scrollLeft, body.scrollLeft );
}
return { top: top, left: left };
};
}
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var elem = this[0],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return null;
}
if ( elem === doc.body ) {
return jQuery.offset.bodyOffset( elem );
}
return getOffset( elem, doc, doc.documentElement );
};
jQuery.offset = {
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return null;
}
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
})( jQuery );
jquery_1.7.2+dfsg/src/outro.js 0000644 0001750 0001750 00000000017 11757032022 015321 0 ustar metal metal
})( window );
jquery_1.7.2+dfsg/src/callbacks.js 0000644 0001750 0001750 00000013426 11757032022 016100 0 ustar metal metal (function( jQuery ) {
// String to Object flags format cache
var flagsCache = {};
// Convert String-formatted flags into Object-formatted ones and store in cache
function createFlags( flags ) {
var object = flagsCache[ flags ] = {},
i, length;
flags = flags.split( /\s+/ );
for ( i = 0, length = flags.length; i < length; i++ ) {
object[ flags[i] ] = true;
}
return object;
}
/*
* Create a callback list using the following parameters:
*
* flags: an optional list of space-separated flags that will change how
* the callback list behaves
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible flags:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( flags ) {
// Convert flags from String-formatted to Object-formatted
// (we check in cache first)
flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
var // Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = [],
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Add one or several callbacks to the list
add = function( args ) {
var i,
length,
elem,
type,
actual;
for ( i = 0, length = args.length; i < length; i++ ) {
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
// Inspect recursively
add( elem );
} else if ( type === "function" ) {
// Add if not in unique mode and callback is not in
if ( !flags.unique || !self.has( elem ) ) {
list.push( elem );
}
}
}
},
// Fire callbacks
fire = function( context, args ) {
args = args || [];
memory = !flags.memory || [ context, args ];
fired = true;
firing = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
memory = true; // Mark as halted
break;
}
}
firing = false;
if ( list ) {
if ( !flags.once ) {
if ( stack && stack.length ) {
memory = stack.shift();
self.fireWith( memory[ 0 ], memory[ 1 ] );
}
} else if ( memory === true ) {
self.disable();
} else {
list = [];
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
var length = list.length;
add( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away, unless previous
// firing was halted (stopOnFalse)
} else if ( memory && memory !== true ) {
firingStart = length;
fire( memory[ 0 ], memory[ 1 ] );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
var args = arguments,
argIndex = 0,
argLength = args.length;
for ( ; argIndex < argLength ; argIndex++ ) {
for ( var i = 0; i < list.length; i++ ) {
if ( args[ argIndex ] === list[ i ] ) {
// Handle firingIndex and firingLength
if ( firing ) {
if ( i <= firingLength ) {
firingLength--;
if ( i <= firingIndex ) {
firingIndex--;
}
}
}
// Remove the element
list.splice( i--, 1 );
// If we have some unicity property then
// we only need to do this once
if ( flags.unique ) {
break;
}
}
}
}
}
return this;
},
// Control if a given callback is in the list
has: function( fn ) {
if ( list ) {
var i = 0,
length = list.length;
for ( ; i < length; i++ ) {
if ( fn === list[ i ] ) {
return true;
}
}
}
return false;
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory || memory === true ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( stack ) {
if ( firing ) {
if ( !flags.once ) {
stack.push( [ context, args ] );
}
} else if ( !( flags.once && memory ) ) {
fire( context, args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
})( jQuery );
jquery_1.7.2+dfsg/src/selector.js 0000644 0001750 0001750 00000103525 11757032022 016001 0 ustar metal metal /*!
* Sizzle CSS Selector Engine
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
expando = "sizcache" + (Math.random() + '').replace('.', ''),
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
baseHasDuplicate = true,
rBackslash = /\\/g,
rReturn = /\r\n/g,
rNonWord = /\W/;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function() {
baseHasDuplicate = false;
return 0;
});
var Sizzle = function( selector, context, results, seed ) {
results = results || [];
context = context || document;
var origContext = context;
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var m, set, checkSet, extra, ret, cur, pop, i,
prune = true,
contextXML = Sizzle.isXML( context ),
parts = [],
soFar = selector;
// Reset the position of the chunker regexp (start from head)
do {
chunker.exec( "" );
m = chunker.exec( soFar );
if ( m ) {
soFar = m[3];
parts.push( m[1] );
if ( m[2] ) {
extra = m[3];
break;
}
}
} while ( m );
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context, seed );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] ) {
selector += parts.shift();
}
set = posProcess( selector, set, seed );
}
}
} else {
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ?
Sizzle.filter( ret.expr, ret.set )[0] :
ret.set[0];
}
if ( context ) {
ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ?
Sizzle.filter( ret.expr, ret.set ) :
ret.set;
if ( parts.length > 0 ) {
checkSet = makeArray( set );
} else {
prune = false;
}
while ( parts.length ) {
cur = parts.pop();
pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
} else {
checkSet = parts = [];
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
Sizzle.error( cur || selector );
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context && context.nodeType === 1 ) {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}
return results;
};
Sizzle.uniqueSort = function( results ) {
if ( sortOrder ) {
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[ i - 1 ] ) {
results.splice( i--, 1 );
}
}
}
}
return results;
};
Sizzle.matches = function( expr, set ) {
return Sizzle( expr, null, null, set );
};
Sizzle.matchesSelector = function( node, expr ) {
return Sizzle( expr, null, null, [node] ).length > 0;
};
Sizzle.find = function( expr, context, isXML ) {
var set, i, len, match, type, left;
if ( !expr ) {
return [];
}
for ( i = 0, len = Expr.order.length; i < len; i++ ) {
type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
left = match[1];
match.splice( 1, 1 );
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace( rBackslash, "" );
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( "*" ) :
[];
}
return { set: set, expr: expr };
};
Sizzle.filter = function( expr, set, inplace, not ) {
var match, anyFound,
type, found, item, filter, left,
i, pass,
old = expr,
result = [],
curLoop = set,
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
while ( expr && set.length ) {
for ( type in Expr.filter ) {
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
filter = Expr.filter[ type ];
left = match[1];
anyFound = false;
match.splice(1,1);
if ( left.substr( left.length - 1 ) === "\\" ) {
continue;
}
if ( curLoop === result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
pass = not ^ found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curLoop;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Utility function for retreiving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
var getText = Sizzle.getText = function( elem ) {
var i, node,
nodeType = elem.nodeType,
ret = "";
if ( nodeType ) {
if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent || innerText for elements
if ( typeof elem.textContent === 'string' ) {
return elem.textContent;
} else if ( typeof elem.innerText === 'string' ) {
// Replace IE's carriage returns
return elem.innerText.replace( rReturn, '' );
} else {
// Traverse it's children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
} else {
// If no nodeType, this is expected to be an array
for ( i = 0; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
if ( node.nodeType !== 8 ) {
ret += getText( node );
}
}
}
return ret;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function( elem ) {
return elem.getAttribute( "href" );
},
type: function( elem ) {
return elem.getAttribute( "type" );
}
},
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !rNonWord.test( part ),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
if ( isPartStr && !rNonWord.test( part ) ) {
part = part.toLowerCase();
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
} else {
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
},
"~": function( checkSet, part, isXML ) {
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
}
},
find: {
ID: function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
},
NAME: function( match, context ) {
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [],
results = context.getElementsByName( match[1] );
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function( match, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( match[1] );
}
}
},
preFilter: {
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
match = " " + match[1].replace( rBackslash, "" ) + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
if ( !inplace ) {
result.push( elem );
}
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function( match ) {
return match[1].replace( rBackslash, "" );
},
TAG: function( match, curLoop ) {
return match[1].replace( rBackslash, "" ).toLowerCase();
},
CHILD: function( match ) {
if ( match[1] === "nth" ) {
if ( !match[2] ) {
Sizzle.error( match[0] );
}
match[2] = match[2].replace(/^\+|\s*/g, '');
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
else if ( match[2] ) {
Sizzle.error( match[0] );
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
// Handle if an un-quoted value was used
match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function( match, curLoop, inplace, result, not ) {
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function( match ) {
match.unshift( true );
return match;
}
},
filters: {
enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function( elem ) {
return elem.disabled === true;
},
checked: function( elem ) {
return elem.checked === true;
},
selected: function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
parent: function( elem ) {
return !!elem.firstChild;
},
empty: function( elem ) {
return !elem.firstChild;
},
has: function( elem, i, match ) {
return !!Sizzle( match[3], elem ).length;
},
header: function( elem ) {
return (/h\d/i).test( elem.nodeName );
},
text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
},
radio: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
},
checkbox: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
},
file: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
},
password: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
},
submit: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "submit" === elem.type;
},
image: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
},
reset: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "reset" === elem.type;
},
button: function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && "button" === elem.type || name === "button";
},
input: function( elem ) {
return (/input|select|textarea|button/i).test( elem.nodeName );
},
focus: function( elem ) {
return elem === elem.ownerDocument.activeElement;
}
},
setFilters: {
first: function( elem, i ) {
return i === 0;
},
last: function( elem, i, match, array ) {
return i === array.length - 1;
},
even: function( elem, i ) {
return i % 2 === 0;
},
odd: function( elem, i ) {
return i % 2 === 1;
},
lt: function( elem, i, match ) {
return i < match[3] - 0;
},
gt: function( elem, i, match ) {
return i > match[3] - 0;
},
nth: function( elem, i, match ) {
return match[3] - 0 === i;
},
eq: function( elem, i, match ) {
return match[3] - 0 === i;
}
},
filter: {
PSEUDO: function( elem, match, i, array ) {
var name = match[1],
filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
for ( var j = 0, l = not.length; j < l; j++ ) {
if ( not[j] === elem ) {
return false;
}
}
return true;
} else {
Sizzle.error( name );
}
},
CHILD: function( elem, match ) {
var first, last,
doneName, parent, cache,
count, diff,
type = match[1],
node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
/* falls through */
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
case "nth":
first = match[2];
last = match[3];
if ( first === 1 && last === 0 ) {
return true;
}
doneName = match[0];
parent = elem.parentNode;
if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent[ expando ] = doneName;
}
diff = elem.nodeIndex - last;
if ( first === 0 ) {
return diff === 0;
} else {
return ( diff % first === 0 && diff / first >= 0 );
}
}
},
ID: function( elem, match ) {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
},
CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
},
ATTR: function( elem, match ) {
var name = match[1],
result = Sizzle.attr ?
Sizzle.attr( elem, name ) :
Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getAttribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ?
type === "!=" :
!type && Sizzle.attr ?
result != null :
type === "=" ?
value === check :
type === "*=" ?
value.indexOf(check) >= 0 :
type === "~=" ?
(" " + value + " ").indexOf(check) >= 0 :
!check ?
value && result !== false :
type === "!=" ?
value !== check :
type === "^=" ?
value.indexOf(check) === 0 :
type === "$=" ?
value.substr(value.length - check.length) === check :
type === "|=" ?
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
POS: function( elem, match, i, array ) {
var name = match[2],
filter = Expr.setFilters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
var origPOS = Expr.match.POS,
fescape = function(all, num){
return "\\" + (num - 0 + 1);
};
for ( var type in Expr.match ) {
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}
// Expose origPOS
// "global" as in regardless of relation to brackets/parens
Expr.match.globalPOS = origPOS;
var makeArray = function( array, results ) {
array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
// Also verifies that the returned array holds DOM nodes
// (which is not the case in the Blackberry browser)
try {
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
} catch( e ) {
makeArray = function( array, results ) {
var i = 0,
ret = results || [];
if ( toString.call(array) === "[object Array]" ) {
Array.prototype.push.apply( ret, array );
} else {
if ( typeof array.length === "number" ) {
for ( var l = array.length; i < l; i++ ) {
ret.push( array[i] );
}
} else {
for ( ; array[i]; i++ ) {
ret.push( array[i] );
}
}
}
return ret;
};
}
var sortOrder, siblingCheck;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
return a.compareDocumentPosition ? -1 : 1;
}
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
};
} else {
sortOrder = function( a, b ) {
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
siblingCheck = function( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
};
}
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("div"),
id = "script" + (new Date()).getTime(),
root = document.documentElement;
form.innerHTML = "";
// Inject it into the root element, check its status, and remove it quickly
root.insertBefore( form, root.firstChild );
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
if ( document.getElementById( id ) ) {
Expr.find.ID = function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ?
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
[m] :
undefined :
[];
}
};
Expr.filter.ID = function( elem, match ) {
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return elem.nodeType === 1 && node && node.nodeValue === match;
};
}
root.removeChild( form );
// release memory in IE
root = form = null;
})();
(function(){
// Check to see if the browser returns only elements
// when doing getElementsByTagName("*")
// Create a fake element
var div = document.createElement("div");
div.appendChild( document.createComment("") );
// Make sure no comments are found
if ( div.getElementsByTagName("*").length > 0 ) {
Expr.find.TAG = function( match, context ) {
var results = context.getElementsByTagName( match[1] );
// Filter out possible comments
if ( match[1] === "*" ) {
var tmp = [];
for ( var i = 0; results[i]; i++ ) {
if ( results[i].nodeType === 1 ) {
tmp.push( results[i] );
}
}
results = tmp;
}
return results;
};
}
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "";
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function( elem ) {
return elem.getAttribute( "href", 2 );
};
}
// release memory in IE
div = null;
})();
if ( document.querySelectorAll ) {
(function(){
var oldSizzle = Sizzle,
div = document.createElement("div"),
id = "__sizzle__";
div.innerHTML = "";
// Safari can't handle uppercase or unicode characters when
// in quirks mode.
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return;
}
Sizzle = function( query, context, extra, seed ) {
context = context || document;
// Only use querySelectorAll on non-XML documents
// (ID selectors don't work in non-HTML documents)
if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG")
if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra );
}
}
if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it
if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) {
var elem = context.getElementById( match[3] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra );
}
} else {
return makeArray( [], extra );
}
}
try {
return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {}
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
var oldContext = context,
old = context.getAttribute( "id" ),
nid = old || id,
hasParent = context.parentNode,
relativeHierarchySelector = /^\s*[+~]/.test( query );
if ( !old ) {
context.setAttribute( "id", nid );
} else {
nid = nid.replace( /'/g, "\\$&" );
}
if ( relativeHierarchySelector && hasParent ) {
context = context.parentNode;
}
try {
if ( !relativeHierarchySelector || hasParent ) {
return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
}
} catch(pseudoError) {
} finally {
if ( !old ) {
oldContext.removeAttribute( "id" );
}
}
}
}
return oldSizzle(query, context, extra, seed);
};
for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ];
}
// release memory in IE
div = null;
})();
}
(function(){
var html = document.documentElement,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
if ( matches ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9 fails this)
var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
pseudoWorks = false;
try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) {
pseudoWorks = true;
}
Sizzle.matchesSelector = function( node, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) {
try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || !disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9, so check for that
node.document && node.document.nodeType !== 11 ) {
return ret;
}
}
} catch(e) {}
}
return Sizzle(expr, null, null, [node]).length > 0;
};
}
})();
(function(){
var div = document.createElement("div");
div.innerHTML = "";
// Opera can't find a second classname (in 9.6)
// Also, make sure that getElementsByClassName actually exists
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
return;
}
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
if ( div.getElementsByClassName("e").length === 1 ) {
return;
}
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
// release memory in IE
div = null;
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 && !isXML ){
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( elem.nodeName.toLowerCase() === cur ) {
match = elem;
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 ) {
if ( !isXML ) {
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
break;
}
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
match = elem;
break;
}
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
if ( document.documentElement.contains ) {
Sizzle.contains = function( a, b ) {
return a !== b && (a.contains ? a.contains(b) : true);
};
} else if ( document.documentElement.compareDocumentPosition ) {
Sizzle.contains = function( a, b ) {
return !!(a.compareDocumentPosition(b) & 16);
};
} else {
Sizzle.contains = function() {
return false;
};
}
Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
var posProcess = function( selector, context, seed ) {
var match,
tmpSet = [],
later = "",
root = context.nodeType ? [context] : context;
// Position selectors must be done after the filter
// And so must :not(positional) so we move all PSEUDOs to the end
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
later += match[0];
selector = selector.replace( Expr.match.PSEUDO, "" );
}
selector = Expr.relative[selector] ? selector + "*" : selector;
for ( var i = 0, l = root.length; i < l; i++ ) {
Sizzle( selector, root[i], tmpSet, seed );
}
return Sizzle.filter( later, tmpSet );
};
// EXPOSE
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
Sizzle.selectors.attrMap = {};
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})();
jquery_1.7.2+dfsg/src/sizzle-jquery.js 0000644 0001750 0001750 00000000503 11757032022 017006 0 ustar metal metal // Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
Sizzle.selectors.attrMap = {};
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
jquery_1.7.2+dfsg/src/dimensions.js 0000644 0001750 0001750 00000004231 11757032022 016323 0 ustar metal metal (function( jQuery ) {
// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
var clientProp = "client" + name,
scrollProp = "scroll" + name,
offsetProp = "offset" + name;
// innerHeight and innerWidth
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
this[ type ]() :
null;
};
// outerHeight and outerWidth
jQuery.fn[ "outer" + name ] = function( margin ) {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
this[ type ]() :
null;
};
jQuery.fn[ type ] = function( value ) {
return jQuery.access( this, function( elem, type, value ) {
var doc, docElemProp, orig, ret;
if ( jQuery.isWindow( elem ) ) {
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
doc = elem.document;
docElemProp = doc.documentElement[ clientProp ];
return jQuery.support.boxModel && docElemProp ||
doc.body && doc.body[ clientProp ] || docElemProp;
}
// Get document width or height
if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
doc = elem.documentElement;
// when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]
// so we can't use max, as it'll choose the incorrect offset[Width/Height]
// instead we use the correct client[Width/Height]
// support:IE6
if ( doc[ clientProp ] >= doc[ scrollProp ] ) {
return doc[ clientProp ];
}
return Math.max(
elem.body[ scrollProp ], doc[ scrollProp ],
elem.body[ offsetProp ], doc[ offsetProp ]
);
}
// Get width or height on the element
if ( value === undefined ) {
orig = jQuery.css( elem, type );
ret = parseFloat( orig );
return jQuery.isNumeric( ret ) ? ret : orig;
}
// Set the width or height on the element
jQuery( elem ).css( type, value );
}, type, value, arguments.length, null );
};
});
})( jQuery );
jquery_1.7.2+dfsg/src/ajax.js 0000644 0001750 0001750 00000065013 11757032022 015103 0 ustar metal metal (function( jQuery ) {
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
rscript = /