Compare commits

..

No commits in common. "master" and "1.2.3b" have entirely different histories.

143 changed files with 16324 additions and 36675 deletions

2
.gitattributes vendored
View file

@ -1,2 +0,0 @@
* eol=lf
*.jar binary

8
.gitignore vendored
View file

@ -1,8 +0,0 @@
src/selector.js
dist
.settings
*~
*.diff
*.patch
/*.html
.DS_Store

6
.gitmodules vendored
View file

@ -1,6 +0,0 @@
[submodule "src/sizzle"]
path = src/sizzle
url = git://github.com/jquery/sizzle.git
[submodule "test/qunit"]
path = test/qunit
url = git://github.com/jquery/qunit.git

98
ChangeLog.txt Normal file
View file

@ -0,0 +1,98 @@
== jQuery ChangeLog ==
== 1.2.2 ==
* show is now element aware (uses default display type instead of just forcing block)
* New special events api: jQuery.events.special
* ready is now a real event and can be bound, unbound and triggered.
* mouseenter and mouseleave now work on all supported browsers
* The hover helper method now uses the mouseenter and mouseleave events
* New offset test suite test/offset.html (requires your pop-up blocker to be disabled)
* Refactored the width and height methods (fixes lots of bugs)
* Fixed event memory leaks in IE (html, remove, empty also no longer leak memory)
* Fixed window/document width/height values
* Fixed event.pageX and event.pageY in IE
== 1.2 ==
=== 1.1.3 ===
* Always create an ActiveXObject when it is available instead of the XMLHttpRequest, even in IE7
* Removed XMLHttpRequest shadowing, may break code that relies on existence of that function for browser checking
* ...
=== 1.1.2 ===
* Event handlers (like element.onclick) are now removed when no more functions are bound to the event.
* Fixed DOM Manipulations for form elements.
* Fixed jQuery.isFunction to return false on nodes.
* Fixed jQuery.className.has, escaping regex characters in className (for metadata)
* Fixed an issue in IE where an event on a cloned element is fired during a .clone() inside of an event handler.
* Fixed IE ID selectors selecting by the name attribute.
* Change: Events are now internally stored in elem.$events rather than elem.events (due to a nasty bug relating to DOM 0 expandos).
* .attr('href') is now consistent in all browsers.
* @href is now consistent in all browsers.
* Fixed the slideDown flickering bug.
* Having a \r endline in $("...") caused a never-ending loop.
* Fixed IE6 AJAX memory leak
* Fixed bug in pushStack, reporting an element at [0] in a jQuery object with length 0
=== 1.1.1 ===
* Setting the numerical value of a css property failed, for example: .css("opacity",0.5) (also occurred with zIndex, fontWeight)
* Calling $(..., jqobj) with a context of a jQuery object failed.
* Accessing a property on an element that doesn't exist caused an error, for example: $("#foobar").attr("id")
* Calling .load() without a callback caused an error.
* You couldn't cancel an event that was triggered using .trigger() or .click() (for example).
* .add()ing a single DOM element to a jQuery object was broken.
* Passing in undefined values to a $.post() caused weird errors to occur.
* Accessing child nodes within an xml document didn't work properly.
* jQuery.isFunction() was unable to reliably determine a function, in a cross-browser way.
* Triggering a .click() failed in IE.
* Triggered click handlers were executed twice in most browsers.
* A newline passed into $(...) caused Firefox to go into a never-ending loop.
* Calling $.post() without any data caused an error.
* Calling a descendant selector after a child selector caused strange results, for example: $("ul > li ul")
* Triggered events did not occur if an event handler was not bound for that event.
== 1.1 ==
* Massive speed-ups (4x-10x) in the selector engine.
* You can now unbind event handlers from within themselves
* Added new .one( "type", fn ) method
* text(String) now escapes HTML
* Added attr(String,Function) to calculate the value
* Performming .click(), .blur(), .focus(), .submit() will actually trigger the browsers default action for those events.
* Added global settings for AJAX (in addition to timeout), use $.ajaxSetup() to modify them
* Implemented a better error handling for ajax requests. Exceptions caused by dropping connections are now handled, too.
* Improved event fixing (Opera provides event.srcElement, must ignore it if target is available; only create pageX if clientX is available)
* Fixed nth-child selectors to start on the right number
* jQuery is no longer destructive. Doing var a = $("a"); a.find("span"); does not change the original "a" variable.
* Fixed synchronous requests
* Fixed ID with context selectors (eg. div #id doesn't ignore "div" anymore)
* Fixed docs for html(): Now mentions that is not available for XML documents
* Improved AJAX docs (eg. more examples for $.ajax)
* Documented filter(Function), a very powerful approach for custom filtering
* Improved docs for FX module, merging method descriptions and marking optional arguments
* Improved docs for append, prepend, before and after, merging the three pairs into one
* Improved show/hide animations to show only hidden and hide only visible elements
* Removed .oneEvent() and .unEvent() helper methods.
* Removed all CSS helper methods.
* Removed most attribute helper methods.
* Removed the (undocumented) .find( "selector", fn ) for all destructive methods.
* $.get, $.getIfModified, $.post, $.getScript and $.getJSON now all pass through the XMLHttpRequest as returned by $.ajax
== 1.0.4 ==
* Tons of bug fixes
* Extensions to $.ajax: $.ajax accepts additonal options: beforeSend, async and processData; returns XMLHttpRequest to allow manual aborting of requests, see docs for details
* AJAX module: the public $.ajax API is now used internally (for $.get/$.post etc.); loading scripts works now much more reliable on all browers except Safari
* New global ajax handler: ajaxSend - called before an ajax request is sent
* Extensions to global ajax handlers: ajaxSend, ajaxSuccess, ajaxError and ajaxComplete get XMLHttpRequest and settings passed as arguments
* Extensions to event handling: pageX and pageY are available x-browser (IE does not provide native pageX/Y)
* Improved docs: $(String) method has now two seperate descriptions, one for selecting elements, one for creating (html on-the-fly)
* FX module: Most inline stlyes added by animations are now removed when the animation is complete, eg. height style when animating height (exception: display styles)
* Added note to attr(String, Object) about issues with setting the name property on input elements
* Seperated internal stuff from get() into set()
* Merged the two API examples for each() into one more precise example
* Improved docs for $.browser and added docs for $.boxModel
* Docs for the jQuery constructor $() were improved: There is now $(String expression[, Object context]) and $(String html)

View file

@ -1,4 +1,4 @@
Copyright (c) 2011 John Resig, http://jquery.com/ Copyright (c) 2008 John Resig, http://jquery.com/
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

210
Makefile
View file

@ -1,120 +1,166 @@
SRC_DIR = src SRC_DIR = src
TEST_DIR = test
BUILD_DIR = build BUILD_DIR = build
PREFIX = . PREFIX = .
DOCS_DIR = ${PREFIX}/docs
TEST_DIR = ${PREFIX}/test
DIST_DIR = ${PREFIX}/dist DIST_DIR = ${PREFIX}/dist
SPEED_DIR = ${PREFIX}/speed
JS_ENGINE ?= `which node nodejs` PLUG_DIR = ../plugins
COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js
BASE_FILES = ${SRC_DIR}/core.js\ BASE_FILES = ${SRC_DIR}/core.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}/selector.js\
${SRC_DIR}/traversing.js\ ${SRC_DIR}/event.js\
${SRC_DIR}/manipulation.js\
${SRC_DIR}/css.js\
${SRC_DIR}/ajax.js\ ${SRC_DIR}/ajax.js\
${SRC_DIR}/ajax/jsonp.js\ ${SRC_DIR}/fx.js\
${SRC_DIR}/ajax/script.js\ ${SRC_DIR}/offset.js
${SRC_DIR}/ajax/xhr.js\
${SRC_DIR}/effects.js\ PLUGINS = ${PLUG_DIR}/button/*\
${SRC_DIR}/offset.js\ ${PLUG_DIR}/center/*\
${SRC_DIR}/dimensions.js ${PLUG_DIR}/cookie/*\
${PLUG_DIR}/dimensions/*\
${PLUG_DIR}/metadata/*\
${PLUG_DIR}/form/*\
${PLUG_DIR}/greybox/greybox.js\
${PLUG_DIR}/interface/*\
${PLUG_DIR}/pager/*\
${PLUG_DIR}/tablesorter/*\
${PLUG_DIR}/tabs/*\
${PLUG_DIR}/tooltip/jquery.tooltip.js\
${PLUG_DIR}/accordion/jquery.accordion.js
MODULES = ${SRC_DIR}/intro.js\ MODULES = ${SRC_DIR}/intro.js\
${BASE_FILES}\ ${BASE_FILES}\
${SRC_DIR}/outro.js ${SRC_DIR}/outro.js
MODULES_WITH_PLUGINS = ${SRC_DIR}/intro.js\
${BASE_FILES}\
${PLUGINS}\
${SRC_DIR}/outro.js
JQ = ${DIST_DIR}/jquery.js JQ = ${DIST_DIR}/jquery.js
JQ_LITE = ${DIST_DIR}/jquery.lite.js
JQ_MIN = ${DIST_DIR}/jquery.min.js JQ_MIN = ${DIST_DIR}/jquery.min.js
JQ_PACK = ${DIST_DIR}/jquery.pack.js
SIZZLE_DIR = ${SRC_DIR}/sizzle JQ_VER = `cat version.txt`
VER = sed s/@VERSION/${JQ_VER}/
JQ_VER = $(shell cat version.txt) JAR = java -jar ${BUILD_DIR}/js.jar
VER = sed "s/@VERSION/${JQ_VER}/"
DATE=$(shell git log -1 --pretty=format:%ad) all: jquery lite min pack speed
all: update_submodules core
core: jquery min lint
@@echo "jQuery build complete." @@echo "jQuery build complete."
${DIST_DIR}: ${DIST_DIR}:
@@mkdir -p ${DIST_DIR} @@mkdir -p ${DIST_DIR}
jquery: ${JQ} jquery: ${DIST_DIR} ${JQ}
${JQ}: ${MODULES} | ${DIST_DIR} ${JQ}: ${MODULES}
@@echo "Building" ${JQ} @@echo "Building" ${JQ}
@@cat ${MODULES} | \ @@mkdir -p ${DIST_DIR}
sed 's/.function..jQuery...{//' | \ @@cat ${MODULES} | ${VER} > ${JQ};
sed 's/}...jQuery..;//' | \
sed 's/@DATE/'"${DATE}"'/' | \
${VER} > ${JQ};
${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js @@echo ${JQ} "Built"
@@echo "Building selector code from Sizzle" @@echo
@@sed '/EXPOSE/r src/sizzle-jquery.js' ${SIZZLE_DIR}/sizzle.js | grep -v window.Sizzle > ${SRC_DIR}/selector.js
lint: jquery with_plugins: ${MODULES_WITH_PLUGINS}
@@if test ! -z ${JS_ENGINE}; then \ @@echo "Building" ${JQ}
echo "Checking jQuery against JSLint..."; \
${JS_ENGINE} build/jslint-check.js; \
else \
echo "You must have NodeJS installed in order to test jQuery against JSLint."; \
fi
min: jquery ${JQ_MIN} @@mkdir -p ${DIST_DIR}
@@cat ${MODULES_WITH_PLUGINS} | ${VER} > ${JQ};
@@echo ${JQ} "Built"
@@echo
lite: ${JQ_LITE}
${JQ_LITE}: ${JQ}
@@echo "Building" ${JQ_LITE}
@@cp ${JQ} ${JQ_LITE}
@@echo ${JQ_LITE} "Built"
@@echo
pack: ${JQ_PACK}
${JQ_PACK}: ${JQ}
@@echo "Building" ${JQ_PACK}
@@echo " - Compressing using Packer"
@@${JAR} ${BUILD_DIR}/build/pack.js ${JQ} ${JQ_PACK}
@@echo ${JQ_PACK} "Built"
@@echo
min: ${JQ_MIN}
${JQ_MIN}: ${JQ} ${JQ_MIN}: ${JQ}
@@if test ! -z ${JS_ENGINE}; then \ @@echo "Building" ${JQ_MIN}
echo "Minifying jQuery" ${JQ_MIN}; \
${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \ @@echo " - Compressing using Minifier"
${POST_COMPILER} ${JQ_MIN}.tmp > ${JQ_MIN}; \ @@${JAR} ${BUILD_DIR}/build/min.js ${JQ} ${JQ_MIN}
rm -f ${JQ_MIN}.tmp; \
else \ @@echo ${JQ_MIN} "Built"
echo "You must have NodeJS installed in order to minify jQuery."; \ @@echo
fi
test: ${JQ}
@@echo "Building Test Suite"
@@echo "Test Suite Built"
@@echo
runtest: ${JQ} test
@@echo "Running Automated Test Suite"
@@${JAR} ${BUILD_DIR}/runtest/test.js
@@echo "Test Suite Finished"
@@echo
docs: ${JQ}
@@echo "Building Documentation"
@@echo " - Making Documentation Directory:" ${DOCS_DIR}
@@mkdir -p ${DOCS_DIR}
@@mkdir -p ${DOCS_DIR}/data
@@echo " - Copying over htaccess file."
@@cp -fR ${BUILD_DIR}/docs/.htaccess ${DOCS_DIR}
@@echo " - Copying over script files."
@@cp -fR ${BUILD_DIR}/docs/js ${DOCS_DIR}/js
@@echo " - Copying over style files."
@@cp -fR ${BUILD_DIR}/docs/style ${DOCS_DIR}/style
@@echo " - Extracting ScriptDoc from" ${JQ}
@@${JAR} ${BUILD_DIR}/docs/docs.js ${JQ} ${DOCS_DIR}
@@echo "Documentation Built"
@@echo
speed: ${JQ}
@@echo "Building Speed Test Suite"
@@echo " - Making Speed Test Suite Directory:" ${SPEED_DIR}
@@mkdir -p ${SPEED_DIR}
@@echo " - Copying over script files."
@@cp -f ${BUILD_DIR}/speed/index.html ${SPEED_DIR}
@@cp -f ${BUILD_DIR}/speed/benchmarker.css ${SPEED_DIR}
@@cp -f ${BUILD_DIR}/speed/benchmarker.js ${SPEED_DIR}
@@cp -f ${BUILD_DIR}/speed/jquery-basis.js ${SPEED_DIR}
@@echo "Speed Test Suite Built"
@@echo
clean: clean:
@@echo "Removing Distribution directory:" ${DIST_DIR} @@echo "Removing Distribution directory:" ${DIST_DIR}
@@rm -rf ${DIST_DIR} @@rm -rf ${DIST_DIR}
@@echo "Removing built copy of Sizzle" @@echo "Removing Documentation directory:" ${DOCS_DIR}
@@rm -f src/selector.js @@rm -rf ${DOCS_DIR}
distclean: clean @@echo "Removing Speed Test Suite directory:" ${SPEED_DIR}
@@echo "Removing submodules" @@rm -rf ${SPEED_DIR}
@@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 lint min clean distclean update_submodules pull_submodules pull core

67
README Normal file
View file

@ -0,0 +1,67 @@
--------------------------------
jQuery - New Wave Javascript
http://jquery.com/
--------------------------------
What you need to build your own jQuery:
- Make sure that you have Java installed.
If not, go to this page and download "Java Runtime Environment (JRE) 5.0"
http://java.sun.com/javase/downloads/index.jsp
- You now have two options for building jQuery, if you have access to
common UNIX commands (like 'make', 'mkdir', 'rm', 'cat', and 'echo')
then simply type 'make' to build all the components.
- The other option is if you have Ant installed (or are on Windows and
don't have access to make). You can download Ant from here:
http://ant.apache.org/bindownload.cgi
If you do have Ant, everytime (in this README) that I say 'make', do
'ant' instead - it works identically (for all intents and purposes).
How to build your own jQuery:
In the main directory of the distribution (the one that this file is in), type
the following to make all versions of jQuery, the documentation, and the test suite:
make
Here are each of the individual items that are buildable from the Makefile.
make jquery
The standard, uncompressed, jQuery code.
Makes: ./dist/jquery.js
make lite
jQuery without all the additional inline documentation and test cases.
Makes: ./dist/jquery.lite.js
make pack
A compressed version of jQuery (made with Packer).
Makes: ./dist/jquery.pack.js
make docs
Builds a complete copy of the documentation, based upon the jQuery source.
Makes ./docs/
Open this file in your browser:
./docs/index.xml
make test
Builds a complete copy of the test suite, based upon the jQuery source.
Makes ./test/
Open this file in your browser:
./test/index.html
Finally, you can remove all the built files using the command:
make clean
Additionally, if you want to install jQuery to a location that is not this
directory, you can specify the PREFIX directory, for example:
make PREFIX=/home/john/test/
OR
make PREFIX=~/www/ docs
If you have any questions, please feel free to ask them on the jQuery
mailing list, which can be found here:
http://jquery.com/discuss/

147
README.md
View file

@ -1,147 +0,0 @@
[jQuery](http://jquery.com/) - New Wave JavaScript
==================================================
What you need to build your own jQuery
--------------------------------------
In order to build jQuery, you need to have GNU make 3.8 or later, Node.js 0.2 or later, and git 1.7 or later.
(Earlier versions might work OK, but are not tested.)
Windows users have two options:
1. Install [msysgit](https://code.google.com/p/msysgit/) (Full installer for official Git),
[GNU make for Windows](http://gnuwin32.sourceforge.net/packages/make.htm), and a
[binary version of Node.js](http://node-js.prcn.co.cc/). Make sure all three packages are installed to the same
location (by default, this is C:\Program Files\Git).
2. Install [Cygwin](http://cygwin.com/) (make sure you install the git, make, and which packages), then either follow
the [Node.js build instructions](https://github.com/ry/node/wiki/Building-node.js-on-Cygwin-%28Windows%29) or install
the [binary version of Node.js](http://node-js.prcn.co.cc/).
Mac OS users should install Xcode (comes on your Mac OS install DVD, or downloadable from
[Apple's Xcode site](http://developer.apple.com/technologies/xcode.html)) and
[http://mxcl.github.com/homebrew/](Homebrew). Once Homebrew is installed, run `brew install git` to install git,
and `brew install node` to install Node.js.
Linux/BSD users should use their appropriate package managers to install make, git, and node, or build from source
if you swing that way. Easy-peasy.
How to build your own jQuery
----------------------------
First, clone a copy of the main jQuery git repo by running `git clone git://github.com/jquery/jquery.git`.
Then, to get a complete, minified, jslinted version of jQuery, simply `cd` to the `jquery` directory and type
`make`. If you don't have Node installed and/or want to make a basic, uncompressed, unlinted version of jQuery, use
`make jquery` instead of `make`.
The built version of jQuery will be put in the `dist/` subdirectory.
To remove all built files, run `make clean`.
Building to a different directory
---------------------------------
If you want to build jQuery to a directory that is different from the default location, you can specify the PREFIX
directory: `make PREFIX=/home/jquery/test/ [command]`
With this example, the output files would end up in `/home/jquery/test/dist/`.
Troubleshooting
---------------
Sometimes, the various git repositories get into an inconsistent state where builds don't complete properly
(usually this results in the jquery.js or jquery.min.js being 0 bytes). If this happens, run `make clean`, then
run `make` again.
Git for dummies
---------------
As the source code is handled by the version control system Git, it's useful to know some features used.
### Submodules ###
The repository uses submodules, which normally are handled directly by the Makefile, but sometimes you want to
be able to work with them manually.
Following are the steps to manually get the submodules:
1. `git clone https://github.com/jquery/jquery.git`
2. `git submodule init`
3. `git submodule update`
Or:
1. `git clone https://github.com/jquery/jquery.git`
2. `git submodule update --init`
Or:
1. `git clone --recursive https://github.com/jquery/jquery.git`
If you want to work inside a submodule, it is possible, but first you need to checkout a branch:
1. `cd src/sizzle`
2. `git checkout master`
After you've committed your changes to the submodule, you'll update the jquery project to point to the new commit,
but remember to push the submodule changes before pushing the new jquery commit:
1. `cd src/sizzle`
2. `git push origin master`
3. `cd ..`
4. `git add src/sizzle`
5. `git commit`
The makefile has some targets to simplify submodule handling:
#### `make update_submodules` ####
checks out the commit pointed to by jquery, but merges your local changes, if any. This target is executed
when you are doing a normal `make`.
#### `make pull_submodules` ####
updates the content of the submodules to what is probably the latest upstream code.
#### `make pull` ####
make a `make pull_submodules` and after that a `git pull`. if you have no remote tracking in your master branch, you can
execute this command as `make pull REMOTE=origin BRANCH=master` instead.
### cleaning ###
If you want to purge your working directory back to the status of upstream, following commands can be used (remember everything you've worked on is gone after these):
1. `git reset --hard upstream/master`
2. `git clean -fdx`
### rebasing ###
For feature/topic branches, you should always used the `--rebase` flag to `git pull`, or if you are usually handling many temporary "to be in a github pull request" branches, run following to automate this:
* `git config branch.autosetuprebase local` (see `man git-config` for more information)
### handling merge conflicts ###
If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature
`git mergetool`. Even though the default tool `xxdiff` looks awful/old, it's rather useful.
Following are some commands that can be used there:
* `Ctrl + Alt + M` - automerge as much as possible
* `b` - jump to next merge conflict
* `s` - change the order of the conflicted lines
* `u` - undo an merge
* `left mouse button` - mark a block to be the winner
* `middle mouse button` - mark a line to be the winner
* `Ctrl + S` - save
* `Ctrl + Q` - quit
Questions?
----------
If you have any questions, please feel free to ask on the
[Developing jQuery Core forum](http://forum.jquery.com/developing-jquery-core) or in #jquery on irc.freenode.net.

88
build.xml Normal file
View file

@ -0,0 +1,88 @@
<project name="jQuery" default="jquery" basedir=".">
<!--
To get jQuery even smaller, remove the modules you don't need by removing the fileset elements
in the jquery-target, for example leaving only these:
<fileset dir="${SRC_DIR}" includes="intro.js" />
<fileset dir="${SRC_DIR}" includes="core.js" />
<fileset dir="${SRC_DIR}" includes="selector.js" />
<fileset dir="${SRC_DIR}" includes="event.js" />
<fileset dir="${SRC_DIR}" includes="outro.js" />
That'd remove ajax, fx and offset support, leaving basic selectors, manipulation and event handling.
-->
<!-- SETUP -->
<property description="Source Folder" name="SRC_DIR" value="src" />
<property description="Files for parsing etc." name="BUILD_DIR" value="build" />
<property description="Rhino JS Engine" name="JAR" value="${BUILD_DIR}/js.jar" />
<property description="Folder for jquery, min, lite and packed target" name="DIST_DIR" value="./dist" />
<!-- Files names for distribution -->
<property name="JQ" value="${DIST_DIR}/jquery.js" />
<property name="JQ_LITE" value="${DIST_DIR}/jquery.lite.js" />
<property name="JQ_MIN" value="${DIST_DIR}/jquery.min.js" />
<property name="JQ_PACK" value="${DIST_DIR}/jquery.pack.js" />
<!-- MAIN -->
<target name="jquery" description="Main jquery build, concatenates source files and replaces @VERSION">
<echo message="Building ${JQ}" />
<mkdir dir="${DIST_DIR}" />
<concat destfile="${JQ}">
<fileset dir="${SRC_DIR}" includes="intro.js" />
<fileset dir="${SRC_DIR}" includes="core.js" />
<fileset dir="${SRC_DIR}" includes="selector.js" />
<fileset dir="${SRC_DIR}" includes="event.js" />
<fileset dir="${SRC_DIR}" includes="ajax.js" />
<fileset dir="${SRC_DIR}" includes="fx.js" />
<fileset dir="${SRC_DIR}" includes="offset.js" />
<fileset dir="${SRC_DIR}" includes="outro.js" />
</concat>
<java jar="${JAR}" fork="true">
<arg value="${BUILD_DIR}/build/version.js" />
<arg value="${JQ}" />
</java>
<echo message="${JQ} built." />
</target>
<target name="min" depends="jquery" description="Remove all comments and whitespace, no compression, great in combination with GZip">
<echo message="Building ${JQ_MIN}" />
<java jar="${JAR}" fork="true">
<arg value="${BUILD_DIR}/build/min.js" />
<arg value="${JQ}" />
<arg value="${JQ_MIN}" />
</java>
<echo message="${JQ_MIN} built." />
</target>
<target name="pack" depends="jquery" description="Remove all comments and whitespace and compress">
<echo message="Building ${JQ_PACK}" />
<java jar="${JAR}" fork="true">
<arg value="${BUILD_DIR}/build/pack.js" />
<arg value="${JQ}" />
<arg value="${JQ_PACK}" />
</java>
<echo message="${JQ_PACK} built." />
</target>
<target name="runtest">
<echo message="Running Automated Test Suite" />
<java jar="${JAR}" fork="true">
<arg value="${BUILD_DIR}/runtest/test.js" />
</java>
<echo message="Test Suite Finished" />
</target>
<target name="clean">
<delete dir="${DIST_DIR}" />
</target>
<target name="all" depends="clean,jquery,min,pack">
<echo message="Build complete." />
</target>
</project>

5
build/build/build.js Normal file
View file

@ -0,0 +1,5 @@
load("build/js/ParseMaster.js", "build/js/pack.js", "build/js/writeFile.js");
var out = readFile( arguments[0] );
writeFile( arguments[1], pack( out, 62, true, false ) );

11
build/build/min.js Normal file
View file

@ -0,0 +1,11 @@
load("build/js/jsmin.js", "build/js/writeFile.js");
// arguments
var inFile = arguments[0];
var outFile = arguments[1] || inFile.replace(/\.js$/, ".min.js");
var script = readFile(inFile);
var header = script.match(/\/\*(.|\n)*?\*\//)[0];
var minifiedScript = jsmin('', script, 3);
writeFile( outFile, header + minifiedScript );

19
build/build/pack.js Normal file
View file

@ -0,0 +1,19 @@
load("build/js/writeFile.js");
load("build/js/base2.js");
load("build/js/Packer.js");
load("build/js/Words.js");
// arguments
var inFile = arguments[0];
var outFile = arguments[1] || inFile.replace(/\.js$/, ".pack.js");
// options
var base62 = true;
var shrink = true;
var script = readFile(inFile);
var header = script.match(/\/\*(.|\n)*?\*\//)[0];
var packer = new Packer;
var packedScript = packer.pack(script, base62, shrink);
writeFile(outFile, header + "\n" + packedScript);

4
build/build/version.js Normal file
View file

@ -0,0 +1,4 @@
load("build/js/writeFile.js");
var file = arguments[0];
writeFile(file, readFile(file).replace(new RegExp("@VERSION", "g"), readFile("version.txt").replace( /^\s+|\s+$/g, "" )));

BIN
build/js.jar Normal file

Binary file not shown.

209
build/js/Packer.js Normal file
View file

@ -0,0 +1,209 @@
/*
Packer version 3.0 (beta 8) - copyright 2004-2007, Dean Edwards
http://www.opensource.org/licenses/mit-license
*/
eval(base2.namespace);
var IGNORE = RegGrp.IGNORE;
var REMOVE = "";
var SPACE = " ";
var WORDS = /\w+/g;
var Packer = Base.extend({
minify: function(script) {
script = script.replace(Packer.CONTINUE, "");
script = Packer.data.exec(script);
script = Packer.whitespace.exec(script);
script = Packer.clean.exec(script);
return script;
},
pack: function(script, base62, shrink) {
script = this.minify(script + "\n");
if (shrink) script = this._shrinkVariables(script);
if (base62) script = this._base62Encode(script);
return script;
},
_base62Encode: function(script) {
var words = new Words(script);
var encode = function(word) {
return words.fetch(word).encoded;
};
/* build the packed script */
var p = this._escape(script.replace(WORDS, encode));
var a = Math.min(Math.max(words.count(), 2), 62);
var c = words.count();
var k = words;
var e = Packer["ENCODE" + (a > 10 ? a > 36 ? 62 : 36 : 10)];
var r = a > 10 ? "e(c)" : "c";
// the whole thing
return format(Packer.UNPACK, p,a,c,k,e,r);
},
_escape: function(script) {
// single quotes wrap the final string so escape them
// also escape new lines required by conditional comments
return script.replace(/([\\'])/g, "\\$1").replace(/[\r\n]+/g, "\\n");
},
_shrinkVariables: function(script) {
// Windows Scripting Host cannot do regexp.test() on global regexps.
var global = function(regexp) {
// This function creates a global version of the passed regexp.
return new RegExp(regexp.source, "g");
};
var data = []; // encoded strings and regular expressions
var REGEXP = /^[^'"]\//;
var store = function(string) {
var replacement = "#" + data.length;
if (REGEXP.test(string)) {
replacement = string.charAt(0) + replacement;
string = string.slice(1);
}
data.push(string);
return replacement;
};
// Base52 encoding (a-Z)
var encode52 = function(c) {
return (c < 52 ? '' : arguments.callee(parseInt(c / 52))) +
((c = c % 52) > 25 ? String.fromCharCode(c + 39) : String.fromCharCode(c + 97));
};
// identify blocks, particularly identify function blocks (which define scope)
var BLOCK = /(function\s*[\w$]*\s*\(\s*([^\)]*)\s*\)\s*)?(\{([^{}]*)\})/;
var VAR_ = /var\s+/g;
var VAR_NAME = /var\s+[\w$]+/g;
var COMMA = /\s*,\s*/;
var blocks = []; // store program blocks (anything between braces {})
// encoder for program blocks
var encode = function(block, func, args) {
if (func) { // the block is a function block
// decode the function block (THIS IS THE IMPORTANT BIT)
// We are retrieving all sub-blocks and will re-parse them in light
// of newly shrunk variables
block = decode(block);
// create the list of variable and argument names
var vars = match(block, VAR_NAME).join(",").replace(VAR_, "");
var ids = Array2.combine(args.split(COMMA).concat(vars.split(COMMA)));
// process each identifier
var count = 0, shortId;
forEach (ids, function(id) {
id = trim(id);
if (id && id.length > 1) { // > 1 char
id = rescape(id);
// find the next free short name (check everything in the current scope)
do shortId = encode52(count++);
while (new RegExp("[^\\w$.]" + shortId + "[^\\w$:]").test(block));
// replace the long name with the short name
var reg = new RegExp("([^\\w$.])" + id + "([^\\w$:])");
while (reg.test(block)) block = block.replace(global(reg), "$1" + shortId + "$2");
var reg = new RegExp("([^{,])" + id + ":", "g");
block = block.replace(reg, "$1" + shortId + ":");
}
});
}
var replacement = "~" + blocks.length + "~";
blocks.push(block);
return replacement;
};
// decoder for program blocks
var ENCODED = /~(\d+)~/;
var decode = function(script) {
while (ENCODED.test(script)) {
script = script.replace(global(ENCODED), function(match, index) {
return blocks[index];
});
}
return script;
};
// encode strings and regular expressions
script = Packer.data.exec(script, store);
// remove closures (this is for base2 namespaces only)
script = script.replace(/new function\(_\)\s*\{/g, "{;#;");
// encode blocks, as we encode we replace variable and argument names
while (BLOCK.test(script)) {
script = script.replace(global(BLOCK), encode);
}
// put the blocks back
script = decode(script);
// put back the closure (for base2 namespaces only)
script = script.replace(/\{;#;/g, "new function(_){");
// put strings and regular expressions back
script = script.replace(/#(\d+)/g, function(match, index) {
return data[index];
});
return script;
}
}, {
CONTINUE: /\\\r?\n/g,
ENCODE10: "String",
ENCODE36: "function(c){return c.toString(a)}",
ENCODE62: "function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))}",
UNPACK: "eval(function(p,a,c,k,e,r){e=%5;if(!''.replace(/^/,String)){while(c--)r[%6]=k[c]" +
"||%6;k=[function(e){return r[e]}];e=function(){return'\\\\w+'};c=1};while(c--)if(k[c])p=p." +
"replace(new RegExp('\\\\b'+e(c)+'\\\\b','g'),k[c]);return p}('%1',%2,%3,'%4'.split('|'),0,{}))",
init: function() {
this.data = reduce(this.data, function(data, replacement, expression) {
data.store(this.javascript.exec(expression), replacement);
return data;
}, new RegGrp, this);
this.clean = this.data.union(this.clean);
this.whitespace = this.data.union(this.whitespace);
},
clean: {
"\\(\\s*;\\s*;\\s*\\)": "(;;)", // for (;;) loops
"throw[^};]+[};]": IGNORE, // a safari 1.3 bug
";+\\s*([};])": "$1"
},
data: {
// strings
"STRING1": IGNORE,
'STRING2': IGNORE,
"CONDITIONAL": IGNORE, // conditional comments
"(COMMENT1)\\n\\s*(REGEXP)?": "\n$3",
"(COMMENT2)\\s*(REGEXP)?": " $3",
"([\\[(\\^=,{}:;&|!*?])\\s*(REGEXP)": "$1$2"
},
javascript: new RegGrp({
COMMENT1: /(\/\/|;;;)[^\n]*/.source,
COMMENT2: /\/\*[^*]*\*+([^\/][^*]*\*+)*\//.source,
CONDITIONAL: /\/\*@|@\*\/|\/\/@[^\n]*\n/.source,
REGEXP: /\/(\\[\/\\]|[^*\/])(\\.|[^\/\n\\])*\/[gim]*/.source,
STRING1: /'(\\.|[^'\\])*'/.source,
STRING2: /"(\\.|[^"\\])*"/.source
}),
whitespace: {
"(\\d)\\s+(\\.\\s*[a-z\\$_\\[(])": "$1 $2", // http://dean.edwards.name/weblog/2007/04/packer3/#comment84066
"([+-])\\s+([+-])": "$1 $2", // c = a++ +b;
"\\b\\s+\\$\\s+\\b": " $ ", // var $ in
"\\$\\s+\\b": "$ ", // object$ in
"\\b\\s+\\$": " $", // return $object
"\\b\\s+\\b": SPACE,
"\\s+": REMOVE
}
});

106
build/js/ParseMaster.js Normal file
View file

@ -0,0 +1,106 @@
/*
ParseMaster, version 1.0.2 (2005-08-19)
Copyright 2005, Dean Edwards
License: http://creativecommons.org/licenses/LGPL/2.1/
*/
/* a multi-pattern parser */
// KNOWN BUG: erroneous behavior when using escapeChar with a replacement value that is a function
function ParseMaster() {
// constants
var $EXPRESSION = 0, $REPLACEMENT = 1, $LENGTH = 2;
// used to determine nesting levels
var $GROUPS = /\(/g, $SUB_REPLACE = /\$\d/, $INDEXED = /^\$\d+$/,
$TRIM = /(['"])\1\+(.*)\+\1\1$/, $$ESCAPE = /\\./g, $QUOTE = /'/,
$$DELETED = /\x01[^\x01]*\x01/g;
var self = this;
// public
this.add = function($expression, $replacement) {
if (!$replacement) $replacement = "";
// count the number of sub-expressions
// - add one because each pattern is itself a sub-expression
var $length = (_internalEscape(String($expression)).match($GROUPS) || "").length + 1;
// does the pattern deal with sub-expressions?
if ($SUB_REPLACE.test($replacement)) {
// a simple lookup? (e.g. "$2")
if ($INDEXED.test($replacement)) {
// store the index (used for fast retrieval of matched strings)
$replacement = parseInt($replacement.slice(1)) - 1;
} else { // a complicated lookup (e.g. "Hello $2 $1")
// build a function to do the lookup
var i = $length;
var $quote = $QUOTE.test(_internalEscape($replacement)) ? '"' : "'";
while (i) $replacement = $replacement.split("$" + i--).join($quote + "+a[o+" + i + "]+" + $quote);
$replacement = new Function("a,o", "return" + $quote + $replacement.replace($TRIM, "$1") + $quote);
}
}
// pass the modified arguments
_add($expression || "/^$/", $replacement, $length);
};
// execute the global replacement
this.exec = function($string) {
_escaped.length = 0;
return _unescape(_escape($string, this.escapeChar).replace(
new RegExp(_patterns, this.ignoreCase ? "gi" : "g"), _replacement), this.escapeChar).replace($$DELETED, "");
};
// clear the patterns collection so that this object may be re-used
this.reset = function() {
_patterns.length = 0;
};
// private
var _escaped = []; // escaped characters
var _patterns = []; // patterns stored by index
var _toString = function(){return "(" + String(this[$EXPRESSION]).slice(1, -1) + ")"};
_patterns.toString = function(){return this.join("|")};
// create and add a new pattern to the patterns collection
function _add() {
arguments.toString = _toString;
// store the pattern - as an arguments object (i think this is quicker..?)
_patterns[_patterns.length] = arguments;
}
// this is the global replace function (it's quite complicated)
function _replacement() {
if (!arguments[0]) return "";
var i = 1, j = 0, $pattern;
// loop through the patterns
while ($pattern = _patterns[j++]) {
// do we have a result?
if (arguments[i]) {
var $replacement = $pattern[$REPLACEMENT];
switch (typeof $replacement) {
case "function": return $replacement(arguments, i);
case "number": return arguments[$replacement + i];
}
var $delete = (arguments[i].indexOf(self.escapeChar) == -1) ? "" :
"\x01" + arguments[i] + "\x01";
return $delete + $replacement;
// skip over references to sub-expressions
} else i += $pattern[$LENGTH];
}
};
// encode escaped characters
function _escape($string, $escapeChar) {
return $escapeChar ? $string.replace(new RegExp("\\" + $escapeChar + "(.)", "g"), function($match, $char) {
_escaped[_escaped.length] = $char;
return $escapeChar;
}) : $string;
};
// decode escaped characters
function _unescape($string, $escapeChar) {
var i = 0;
return $escapeChar ? $string.replace(new RegExp("\\" + $escapeChar, "g"), function() {
return $escapeChar + (_escaped[i++] || "");
}) : $string;
};
function _internalEscape($string) {
return $string.replace($$ESCAPE, "");
};
};
ParseMaster.prototype = {
constructor: ParseMaster,
ignoreCase: false,
escapeChar: ""
};

62
build/js/Words.js Normal file
View file

@ -0,0 +1,62 @@
var Words = Collection.extend({
constructor: function(script) {
this.base();
forEach (script.match(WORDS), this.add, this);
this.encode();
},
add: function(word) {
if (!this.exists(word)) this.base(word);
word = this.fetch(word);
word.count++;
return word;
},
encode: function() {
// sort by frequency
this.sort(function(word1, word2) {
return word2.count - word1.count;
});
eval("var a=62,e=" + Packer.ENCODE62);
var encode = e;
var encoded = new Collection; // a dictionary of base62 -> base10
var count = this.count();
for (var i = 0; i < count; i++) {
encoded.store(encode(i), i);
}
var empty = function() {return ""};
var index = 0;
forEach (this, function(word) {
if (encoded.exists(word)) {
word.index = encoded.fetch(word);
word.toString = empty;
} else {
while (this.exists(encode(index))) index++;
word.index = index++;
}
word.encoded = encode(word.index);
}, this);
// sort by encoding
this.sort(function(word1, word2) {
return word1.index - word2.index;
});
},
toString: function() {
return this.values().join("|");
}
}, {
Item: {
constructor: function(word) {
this.toString = function() {return word};
},
count: 0,
encoded: "",
index: -1
}
});

978
build/js/base2.js Normal file
View file

@ -0,0 +1,978 @@
// timestamp: Tue, 01 May 2007 19:13:00
/*
base2.js - copyright 2007, Dean Edwards
http://www.opensource.org/licenses/mit-license
*/
var base2 = {};
// You know, writing a javascript library is awfully time consuming.
new function(_) { //////////////////// BEGIN: CLOSURE ////////////////////
// =========================================================================
// base2/Base.js
// =========================================================================
// version 1.1
var Base = function() {
// call this method from any other method to invoke that method's ancestor
};
Base.prototype = {
extend: function(source) {
if (arguments.length > 1) { // extending with a name/value pair
var ancestor = this[source];
var value = arguments[1];
if (typeof value == "function" && ancestor && /\bbase\b/.test(value)) {
var method = value;
value = function() { // override
var previous = this.base;
this.base = ancestor;
var returnValue = method.apply(this, arguments);
this.base = previous;
return returnValue;
};
value.method = method;
value.ancestor = ancestor;
}
this[source] = value;
} else if (source) { // extending with an object literal
var extend = Base.prototype.extend;
if (Base._prototyping) {
var key, i = 0, members = ["constructor", "toString", "valueOf"];
while (key = members[i++]) if (source[key] != Object.prototype[key]) {
extend.call(this, key, source[key]);
}
} else if (typeof this != "function") {
// if the object has a customised extend() method then use it
extend = this.extend || extend;
}
// copy each of the source object's properties to this object
for (key in source) if (!Object.prototype[key]) {
extend.call(this, key, source[key]);
}
}
return this;
},
base: Base
};
Base.extend = function(_instance, _static) { // subclass
var extend = Base.prototype.extend;
// build the prototype
Base._prototyping = true;
var proto = new this;
extend.call(proto, _instance);
delete Base._prototyping;
// create the wrapper for the constructor function
var constructor = proto.constructor;
var klass = proto.constructor = function() {
if (!Base._prototyping) {
if (this._constructing || this.constructor == klass) { // instantiation
this._constructing = true;
constructor.apply(this, arguments);
delete this._constructing;
} else { // casting
var object = arguments[0];
if (object != null) {
(object.extend || extend).call(object, proto);
}
return object;
}
}
};
// build the class interface
for (var i in Base) klass[i] = this[i];
klass.ancestor = this;
klass.base = Base.base;
klass.prototype = proto;
klass.toString = this.toString;
extend.call(klass, _static);
// class initialisation
if (typeof klass.init == "function") klass.init();
return klass;
};
// initialise
Base = Base.extend({
constructor: function() {
this.extend(arguments[0]);
}
}, {
ancestor: Object,
base: Base,
implement: function(_interface) {
if (typeof _interface == "function") {
// if it's a function, call it
_interface(this.prototype);
} else {
// add the interface using the extend() method
this.prototype.extend(_interface);
}
return this;
}
});
// =========================================================================
// lang/main.js
// =========================================================================
var Legacy = typeof $Legacy == "undefined" ? {} : $Legacy;
var K = function(k) {return k};
var assert = function(condition, message, Err) {
if (!condition) {
throw new (Err || Error)(message || "Assertion failed.");
}
};
var assertType = function(object, type, message) {
if (type) {
var condition = typeof type == "function" ? instanceOf(object, type) : typeof object == type;
assert(condition, message || "Invalid type.", TypeError);
}
};
var copy = function(object) {
var fn = new Function;
fn.prototype = object;
return new fn;
};
var format = function(string) {
// replace %n with arguments[n]
// e.g. format("%1 %2%3 %2a %1%3", "she", "se", "lls");
// ==> "she sells sea shells"
// only supports nine replacements: %1 - %9
var args = arguments;
return String(string).replace(/%([1-9])/g, function(match, index) {
return index < args.length ? args[index] : match;
});
};
var $instanceOf = Legacy.instanceOf || new Function("o,k", "return o instanceof k");
var instanceOf = function(object, klass) {
assertType(klass, "function", "Invalid 'instanceOf' operand.");
if ($instanceOf(object, klass)) return true;
// handle exceptions where the target object originates from another frame
// this is handy for JSON parsing (amongst other things)
if (object != null) switch (klass) {
case Object:
return true;
case Number:
case Boolean:
case Function:
case String:
return typeof object == typeof klass.prototype.valueOf();
case Array:
// this is the only troublesome one
return !!(object.join && object.splice && !arguments.callee(object, Function));
case Date:
return !!object.getTimezoneOffset;
case RegExp:
return String(object.constructor.prototype) == String(new RegExp);
}
return false;
};
var match = function(string, expression) {
// same as String.match() except that this function will return an empty
// array if there is no match
return String(string).match(expression) || [];
};
var RESCAPE = /([\/()[\]{}|*+-.,^$?\\])/g;
var rescape = function(string) {
// make a string safe for creating a RegExp
return String(string).replace(RESCAPE, "\\$1");
};
var $slice = Array.prototype.slice;
var slice = function(object) {
// slice an array-like object
return $slice.apply(object, $slice.call(arguments, 1));
};
var TRIM = /^\s+|\s+$/g;
var trim = function(string) {
return String(string).replace(TRIM, "");
};
// =========================================================================
// lang/extend.js
// =========================================================================
var base = function(object, args) {
// invoke the base method with all supplied arguments
return object.base.apply(object, args);
};
var extend = function(object) {
assert(object != Object.prototype, "Object.prototype is verboten!");
return Base.prototype.extend.apply(object, slice(arguments, 1));
};
// =========================================================================
// lang/assignID.js
// =========================================================================
var $ID = 1;
var assignID = function(object) {
// assign a unique id
if (!object.base2ID) object.base2ID = "b2_" + $ID++;
return object.base2ID;
};
// =========================================================================
// lang/forEach.js
// =========================================================================
if (typeof StopIteration == "undefined") {
StopIteration = new Error("StopIteration");
}
var forEach = function(object, block, context) {
if (object == null) return;
if (typeof object == "function") {
// functions are a special case
var fn = Function;
} else if (typeof object.forEach == "function" && object.forEach != arguments.callee) {
// the object implements a custom forEach method
object.forEach(block, context);
return;
} else if (typeof object.length == "number") {
// the object is array-like
forEach.Array(object, block, context);
return;
}
forEach.Function(fn || Object, object, block, context);
};
// these are the two core enumeration methods. all other forEach methods
// eventually call one of these two.
forEach.Array = function(array, block, context) {
var i, length = array.length; // preserve
if (typeof array == "string") {
for (i = 0; i < length; i++) {
block.call(context, array.charAt(i), i, array);
}
} else {
for (i = 0; i < length; i++) {
block.call(context, array[i], i, array);
}
}
};
forEach.Function = Legacy.forEach || function(fn, object, block, context) {
// enumerate an object and compare its keys with fn's prototype
for (var key in object) {
if (fn.prototype[key] === undefined) {
block.call(context, object[key], key, object);
}
}
};
// =========================================================================
// base2/Base/forEach.js
// =========================================================================
Base.forEach = function(object, block, context) {
forEach.Function(this, object, block, context);
};
// =========================================================================
// base2/../Function.js
// =========================================================================
// some browsers don't define this
Function.prototype.prototype = {};
// =========================================================================
// base2/../String.js
// =========================================================================
// fix String.replace (Safari/IE5.0)
if ("".replace(/^/, String)) {
extend(String.prototype, "replace", function(expression, replacement) {
if (typeof replacement == "function") { // Safari doesn't like functions
if (instanceOf(expression, RegExp)) {
var regexp = expression;
var global = regexp.global;
if (global == null) global = /(g|gi)$/.test(regexp);
// we have to convert global RexpExps for exec() to work consistently
if (global) regexp = new RegExp(regexp.source); // non-global
} else {
regexp = new RegExp(rescape(expression));
}
var match, string = this, result = "";
while (string && (match = regexp.exec(string))) {
result += string.slice(0, match.index) + replacement.apply(this, match);
string = string.slice(match.index + match[0].length);
if (!global) break;
}
return result + string;
} else {
return base(this, arguments);
}
});
}
// =========================================================================
// base2/Abstract.js
// =========================================================================
var Abstract = Base.extend({
constructor: function() {
throw new TypeError("Class cannot be instantiated.");
}
});
// =========================================================================
// base2/Module.js
// =========================================================================
// based on ruby's Module class and Mozilla's Array generics:
// http://www.ruby-doc.org/core/classes/Module.html
// http://developer.mozilla.org/en/docs/New_in_JavaScript_1.6#Array_and_String_generics
// A Module is used as the basis for creating interfaces that can be
// applied to other classes. *All* properties and methods are static.
// When a module is used as a mixin, methods defined on what would normally be
// the instance interface become instance methods of the target object.
// Modules cannot be instantiated. Static properties and methods are inherited.
var Module = Abstract.extend(null, {
extend: function(_interface, _static) {
// extend a module to create a new module
var module = this.base();
// inherit static methods
forEach (this, function(property, name) {
if (!Module[name] && name != "init") {
extend(module, name, property);
}
});
// implement module (instance AND static) methods
module.implement(_interface);
// implement static properties and methods
extend(module, _static);
// Make the submarine noises Larry!
if (typeof module.init == "function") module.init();
return module;
},
implement: function(_interface) {
// implement an interface on BOTH the instance and static interfaces
var module = this;
if (typeof _interface == "function") {
module.base(_interface);
forEach (_interface, function(property, name) {
if (!Module[name] && name != "init") {
extend(module, name, property);
}
});
} else {
// create the instance interface
Base.forEach (extend({}, _interface), function(property, name) {
// instance methods call the equivalent static method
if (typeof property == "function") {
property = function() {
base; // force inheritance
return module[name].apply(module, [this].concat(slice(arguments)));
};
}
if (!Module[name]) extend(this, name, property);
}, module.prototype);
// add the static interface
extend(module, _interface);
}
return module;
}
});
// =========================================================================
// base2/Enumerable.js
// =========================================================================
var Enumerable = Module.extend({
every: function(object, test, context) {
var result = true;
try {
this.forEach (object, function(value, key) {
result = test.call(context, value, key, object);
if (!result) throw StopIteration;
});
} catch (error) {
if (error != StopIteration) throw error;
}
return !!result; // cast to boolean
},
filter: function(object, test, context) {
return this.reduce(object, function(result, value, key) {
if (test.call(context, value, key, object)) {
result[result.length] = value;
}
return result;
}, new Array2);
},
invoke: function(object, method) {
// apply a method to each item in the enumerated object
var args = slice(arguments, 2);
return this.map(object, (typeof method == "function") ? function(item) {
if (item != null) return method.apply(item, args);
} : function(item) {
if (item != null) return item[method].apply(item, args);
});
},
map: function(object, block, context) {
var result = new Array2;
this.forEach (object, function(value, key) {
result[result.length] = block.call(context, value, key, object);
});
return result;
},
pluck: function(object, key) {
return this.map(object, function(item) {
if (item != null) return item[key];
});
},
reduce: function(object, block, result, context) {
this.forEach (object, function(value, key) {
result = block.call(context, result, value, key, object);
});
return result;
},
some: function(object, test, context) {
return !this.every(object, function(value, key) {
return !test.call(context, value, key, object);
});
}
}, {
forEach: forEach
});
// =========================================================================
// base2/Array2.js
// =========================================================================
// The IArray module implements all Array methods.
// This module is not public but its methods are accessible through the Array2 object (below).
var IArray = Module.extend({
combine: function(keys, values) {
// combine two arrays to make a hash
if (!values) values = keys;
return this.reduce(keys, function(object, key, index) {
object[key] = values[index];
return object;
}, {});
},
copy: function(array) {
return this.concat(array);
},
contains: function(array, item) {
return this.indexOf(array, item) != -1;
},
forEach: forEach.Array,
indexOf: function(array, item, fromIndex) {
var length = array.length;
if (fromIndex == null) {
fromIndex = 0;
} else if (fromIndex < 0) {
fromIndex = Math.max(0, length + fromIndex);
}
for (var i = fromIndex; i < length; i++) {
if (array[i] === item) return i;
}
return -1;
},
insertAt: function(array, item, index) {
this.splice(array, index, 0, item);
return item;
},
insertBefore: function(array, item, before) {
var index = this.indexOf(array, before);
if (index == -1) this.push(array, item);
else this.splice(array, index, 0, item);
return item;
},
lastIndexOf: function(array, item, fromIndex) {
var length = array.length;
if (fromIndex == null) {
fromIndex = length - 1;
} else if (from < 0) {
fromIndex = Math.max(0, length + fromIndex);
}
for (var i = fromIndex; i >= 0; i--) {
if (array[i] === item) return i;
}
return -1;
},
remove: function(array, item) {
var index = this.indexOf(array, item);
if (index != -1) this.removeAt(array, index);
return item;
},
removeAt: function(array, index) {
var item = array[index];
this.splice(array, index, 1);
return item;
}
});
IArray.prototype.forEach = function(block, context) {
forEach.Array(this, block, context);
};
IArray.implement(Enumerable);
forEach ("concat,join,pop,push,reverse,shift,slice,sort,splice,unshift".split(","), function(name) {
IArray[name] = function(array) {
return Array.prototype[name].apply(array, slice(arguments, 1));
};
});
// create a faux constructor that augments the built-in Array object
var Array2 = function() {
return IArray(this.constructor == IArray ? Array.apply(null, arguments) : arguments[0]);
};
// expose IArray.prototype so that it can be extended
Array2.prototype = IArray.prototype;
forEach (IArray, function(method, name, proto) {
if (Array[name]) {
IArray[name] = Array[name];
delete IArray.prototype[name];
}
Array2[name] = IArray[name];
});
// =========================================================================
// base2/Hash.js
// =========================================================================
var HASH = "#" + Number(new Date);
var KEYS = HASH + "keys";
var VALUES = HASH + "values";
var Hash = Base.extend({
constructor: function(values) {
this[KEYS] = new Array2;
this[VALUES] = {};
this.merge(values);
},
copy: function() {
var copy = new this.constructor(this);
Base.forEach (this, function(property, name) {
if (typeof property != "function" && name.charAt(0) != "#") {
copy[name] = property;
}
});
return copy;
},
// ancient browsers throw an error when we use "in" as an operator
// so we must create the function dynamically
exists: Legacy.exists || new Function("k", format("return('%1'+k)in this['%2']", HASH, VALUES)),
fetch: function(key) {
return this[VALUES][HASH + key];
},
forEach: function(block, context) {
forEach (this[KEYS], function(key) {
block.call(context, this.fetch(key), key, this);
}, this);
},
keys: function(index, length) {
var keys = this[KEYS] || new Array2;
switch (arguments.length) {
case 0: return keys.copy();
case 1: return keys[index];
default: return keys.slice(index, length);
}
},
merge: function(values) {
forEach (arguments, function(values) {
forEach (values, function(value, key) {
this.store(key, value);
}, this);
}, this);
return this;
},
remove: function(key) {
var value = this.fetch(key);
this[KEYS].remove(String(key));
delete this[VALUES][HASH + key];
return value;
},
store: function(key, value) {
if (arguments.length == 1) value = key;
// only store the key for a new entry
if (!this.exists(key)) {
this[KEYS].push(String(key));
}
// create the new entry (or overwrite the old entry)
this[VALUES][HASH + key] = value;
return value;
},
toString: function() {
return String(this[KEYS]);
},
union: function(values) {
return this.merge.apply(this.copy(), arguments);
},
values: function(index, length) {
var values = this.map(K);
switch (arguments.length) {
case 0: return values;
case 1: return values[index];
default: return values.slice(index, length);
}
}
});
Hash.implement(Enumerable);
// =========================================================================
// base2/Collection.js
// =========================================================================
// A Hash that is more array-like (accessible by index).
// Collection classes have a special (optional) property: Item
// The Item property points to a constructor function.
// Members of the collection must be an instance of Item.
// e.g.
// var Dates = Collection.extend(); // create a collection class
// Dates.Item = Date; // only JavaScript Date objects allowed as members
// var appointments = new Dates(); // instantiate the class
// appointments.add(appointmentId, new Date); // add a date
// appointments.add(appointmentId, "tomorrow"); // ERROR!
// The static create() method is responsible for all construction of collection items.
// Instance methods that add new items (add, store, insertAt, replaceAt) pass *all* of their arguments
// to the static create() method. If you want to modify the way collection items are
// created then you only need to override this method for custom collections.
var Collection = Hash.extend({
add: function(key, item) {
// Duplicates not allowed using add().
// - but you can still overwrite entries using store()
assert(!this.exists(key), "Duplicate key.");
return this.store.apply(this, arguments);
},
count: function() {
return this[KEYS].length;
},
indexOf: function(key) {
return this[KEYS].indexOf(String(key));
},
insertAt: function(index, key, item) {
assert(!this.exists(key), "Duplicate key.");
this[KEYS].insertAt(index, String(key));
return this.store.apply(this, slice(arguments, 1));
},
item: function(index) {
return this.fetch(this[KEYS][index]);
},
removeAt: function(index) {
return this.remove(this[KEYS][index]);
},
reverse: function() {
this[KEYS].reverse();
return this;
},
sort: function(compare) {
if (compare) {
var self = this;
this[KEYS].sort(function(key1, key2) {
return compare(self.fetch(key1), self.fetch(key2), key1, key2);
});
} else this[KEYS].sort();
return this;
},
store: function(key, item) {
if (arguments.length == 1) item = key;
item = this.constructor.create.apply(this.constructor, arguments);
return this.base(key, item);
},
storeAt: function(index, item) {
//-dean: get rid of this?
assert(index < this.count(), "Index out of bounds.");
arguments[0] = this[KEYS][index];
return this.store.apply(this, arguments);
}
}, {
Item: null, // if specified, all members of the Collection must be instances of Item
create: function(key, item) {
if (this.Item && !instanceOf(item, this.Item)) {
item = new this.Item(key, item);
}
return item;
},
extend: function(_instance, _static) {
var klass = this.base(_instance);
klass.create = this.create;
extend(klass, _static);
if (!klass.Item) {
klass.Item = this.Item;
} else if (typeof klass.Item != "function") {
klass.Item = (this.Item || Base).extend(klass.Item);
}
if (typeof klass.init == "function") klass.init();
return klass;
}
});
// =========================================================================
// base2/RegGrp.js
// =========================================================================
var RegGrp = Collection.extend({
constructor: function(values, flags) {
this.base(values);
if (typeof flags == "string") {
this.global = /g/.test(flags);
this.ignoreCase = /i/.test(flags);
}
},
global: true, // global is the default setting
ignoreCase: false,
exec: function(string, replacement) {
if (arguments.length == 1) {
var keys = this[KEYS];
var values = this[VALUES];
replacement = function(match) {
if (!match) return "";
var offset = 1, i = 0;
// loop through the values
while (match = values[HASH + keys[i++]]) {
// do we have a result?
if (arguments[offset]) {
var replacement = match.replacement;
switch (typeof replacement) {
case "function":
return replacement.apply(null, slice(arguments, offset));
case "number":
return arguments[offset + replacement];
default:
return replacement;
}
// no? then skip over references to sub-expressions
} else offset += match.length + 1;
}
};
}
var flags = (this.global ? "g" : "") + (this.ignoreCase ? "i" : "");
return String(string).replace(new RegExp(this, flags), replacement);
},
test: function(string) {
return this.exec(string) != string;
},
toString: function() {
var length = 0;
return "(" + this.map(function(item) {
// fix back references
var expression = String(item).replace(/\\(\d+)/g, function($, index) {
return "\\" + (1 + Number(index) + length);
});
length += item.length + 1;
return expression;
}).join(")|(") + ")";
}
}, {
IGNORE: "$0",
init: function() {
forEach ("add,exists,fetch,remove,store".split(","), function(name) {
extend(this, name, function(expression) {
if (instanceOf(expression, RegExp)) {
expression = expression.source;
}
return base(this, arguments);
});
}, this.prototype);
}
});
// =========================================================================
// base2/RegGrp/Item.js
// =========================================================================
RegGrp.Item = Base.extend({
constructor: function(expression, replacement) {
var ESCAPE = /\\./g;
var STRING = /(['"])\1\+(.*)\+\1\1$/;
expression = instanceOf(expression, RegExp) ? expression.source : String(expression);
if (typeof replacement == "number") replacement = String(replacement);
else if (replacement == null) replacement = "";
// count the number of sub-expressions
// - add one because each pattern is itself a sub-expression
this.length = match(expression.replace(ESCAPE, "").replace(/\[[^\]]+\]/g, ""), /\(/g).length;
// does the pattern use sub-expressions?
if (typeof replacement == "string" && /\$(\d+)/.test(replacement)) {
// a simple lookup? (e.g. "$2")
if (/^\$\d+$/.test(replacement)) {
// store the index (used for fast retrieval of matched strings)
replacement = parseInt(replacement.slice(1));
} else { // a complicated lookup (e.g. "Hello $2 $1")
// build a function to do the lookup
var i = this.length + 1;
var Q = /'/.test(replacement.replace(ESCAPE, "")) ? '"' : "'";
replacement = replacement.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\$(\d+)/g, Q +
"+(arguments[$1]||" + Q+Q + ")+" + Q);
replacement = new Function("return " + Q + replacement.replace(STRING, "$1") + Q);
}
}
this.replacement = replacement;
this.toString = function() {
return expression || "";
};
},
length: 0,
replacement: ""
});
// =========================================================================
// base2/Namespace.js
// =========================================================================
var Namespace = Base.extend({
constructor: function(_private, _public) {
this.extend(_public);
this.toString = function() {
return format("[base2.%1]", this.name);
};
// initialise
if (typeof this.init == "function") this.init();
if (this.name != "base2") {
this.namespace = format("var %1=base2.%1;", this.name);
}
var namespace = "var base=" + base + ";";
var imports = ("base2,lang," + this.imports).split(",");
_private.imports = Enumerable.reduce(imports, function(namespace, name) {
if (base2[name]) namespace += base2[name].namespace;
return namespace;
}, namespace);
var namespace = format("base2.%1=%1;", this.name);
var exports = this.exports.split(",");
_private.exports = Enumerable.reduce(exports, function(namespace, name) {
if (name) {
this.namespace += format("var %2=%1.%2;", this.name, name);
namespace += format("if(!%1.%2)%1.%2=%2;base2.%2=%1.%2;", this.name, name);
}
return namespace;
}, namespace, this);
if (this.name != "base2") {
base2.namespace += format("var %1=base2.%1;", this.name);
}
},
exports: "",
imports: "",
namespace: "",
name: ""
});
base2 = new Namespace(this, {
name: "base2",
version: "0.8 (alpha)",
exports: "Base,Abstract,Module,Enumerable,Array2,Hash,Collection,RegGrp,Namespace"
});
base2.toString = function() {
return "[base2]";
};
eval(this.exports);
// =========================================================================
// base2/lang/namespace.js
// =========================================================================
var lang = new Namespace(this, {
name: "lang",
version: base2.version,
exports: "K,assert,assertType,assignID,copy,instanceOf,extend,format,forEach,match,rescape,slice,trim",
init: function() {
this.extend = extend;
// add the Enumerable methods to the lang object
forEach (Enumerable.prototype, function(method, name) {
if (!Module[name]) {
this[name] = function() {
return Enumerable[name].apply(Enumerable, arguments);
};
this.exports += "," + name;
}
}, this);
}
});
eval(this.exports);
base2.namespace += lang.namespace;
}; //////////////////// END: CLOSURE /////////////////////////////////////

316
build/js/jsmin.js Normal file
View file

@ -0,0 +1,316 @@
/* jsmin.js - 2006-08-31
Author: Franck Marcia
This work is an adaptation of jsminc.c published by Douglas Crockford.
Permission is hereby granted to use the Javascript version under the same
conditions as the jsmin.c on which it is based.
jsmin.c
2006-05-04
Copyright (c) 2002 Douglas Crockford (www.crockford.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Update:
add level:
1: minimal, keep linefeeds if single
2: normal, the standard algorithm
3: agressive, remove any linefeed and doesn't take care of potential
missing semicolons (can be regressive)
store stats
jsmin.oldSize
jsmin.newSize
*/
String.prototype.has = function(c) {
return this.indexOf(c) > -1;
};
function jsmin(comment, input, level) {
if (input === undefined) {
input = comment;
comment = '';
level = 2;
} else if (level === undefined || level < 1 || level > 3) {
level = 2;
}
if (comment.length > 0) {
comment += '\n';
}
var a = '',
b = '',
EOF = -1,
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
DIGITS = '0123456789',
ALNUM = LETTERS + DIGITS + '_$\\',
theLookahead = EOF;
/* isAlphanum -- return true if the character is a letter, digit, underscore,
dollar sign, or non-ASCII character.
*/
function isAlphanum(c) {
return c != EOF && (ALNUM.has(c) || c.charCodeAt(0) > 126);
}
/* get -- return the next character. Watch out for lookahead. If the
character is a control character, translate it to a space or
linefeed.
*/
function get() {
var c = theLookahead;
if (get.i == get.l) {
return EOF;
}
theLookahead = EOF;
if (c == EOF) {
c = input.charAt(get.i);
++get.i;
}
if (c >= ' ' || c == '\n') {
return c;
}
if (c == '\r') {
return '\n';
}
return ' ';
}
get.i = 0;
get.l = input.length;
/* peek -- get the next character without getting it.
*/
function peek() {
theLookahead = get();
return theLookahead;
}
/* next -- get the next character, excluding comments. peek() is used to see
if a '/' is followed by a '/' or '*'.
*/
function next() {
var c = get();
if (c == '/') {
switch (peek()) {
case '/':
for (;;) {
c = get();
if (c <= '\n') {
return c;
}
}
break;
case '*':
get();
for (;;) {
switch (get()) {
case '*':
if (peek() == '/') {
get();
return ' ';
}
break;
case EOF:
throw 'Error: Unterminated comment.';
}
}
break;
default:
return c;
}
}
return c;
}
/* action -- do something! What you do is determined by the argument:
1 Output A. Copy B to A. Get the next B.
2 Copy B to A. Get the next B. (Delete A).
3 Get the next B. (Delete B).
action treats a string as a single character. Wow!
action recognizes a regular expression if it is preceded by ( or , or =.
*/
function action(d) {
var r = [];
if (d == 1) {
r.push(a);
}
if (d < 3) {
a = b;
if (a == '\'' || a == '"') {
for (;;) {
r.push(a);
a = get();
if (a == b) {
break;
}
if (a <= '\n') {
throw 'Error: unterminated string literal: ' + a;
}
if (a == '\\') {
r.push(a);
a = get();
}
}
}
}
b = next();
if (b == '/' && '(,=:[!&|'.has(a)) {
r.push(a);
r.push(b);
for (;;) {
a = get();
if (a == '/') {
break;
} else if (a =='\\') {
r.push(a);
a = get();
} else if (a <= '\n') {
throw 'Error: unterminated Regular Expression literal';
}
r.push(a);
}
b = next();
}
return r.join('');
}
/* m -- Copy the input to the output, deleting the characters which are
insignificant to JavaScript. Comments will be removed. Tabs will be
replaced with spaces. Carriage returns will be replaced with
linefeeds.
Most spaces and linefeeds will be removed.
*/
function m() {
var r = [];
a = '\n';
r.push(action(3));
while (a != EOF) {
switch (a) {
case ' ':
if (isAlphanum(b)) {
r.push(action(1));
} else {
r.push(action(2));
}
break;
case '\n':
switch (b) {
case '{':
case '[':
case '(':
case '+':
case '-':
r.push(action(1));
break;
case ' ':
r.push(action(3));
break;
default:
if (isAlphanum(b)) {
r.push(action(1));
} else {
if (level == 1 && b != '\n') {
r.push(action(1));
} else {
r.push(action(2));
}
}
}
break;
default:
switch (b) {
case ' ':
if (isAlphanum(a)) {
r.push(action(1));
break;
}
r.push(action(3));
break;
case '\n':
if (level == 1 && a != '\n') {
r.push(action(1));
} else {
switch (a) {
case '}':
case ']':
case ')':
case '+':
case '-':
case '"':
case '\'':
if (level == 3) {
r.push(action(3));
} else {
r.push(action(1));
}
break;
default:
if (isAlphanum(a)) {
r.push(action(1));
} else {
r.push(action(3));
}
}
}
break;
default:
r.push(action(1));
break;
}
}
}
return r.join('');
}
jsmin.oldSize = input.length;
var r = m(input);
jsmin.newSize = r.length;
return comment + r;
}

117
build/js/json.js Normal file
View file

@ -0,0 +1,117 @@
/*
json.js
2006-04-28
This file adds these methods to JavaScript:
object.toJSONString()
This method produces a JSON text from an object. The
object must not contain any cyclical references.
array.toJSONString()
This method produces a JSON text from an array. The
array must not contain any cyclical references.
string.parseJSON()
This method parses a JSON text to produce an object or
array. It will return false if there is an error.
*/
(function () {
var m = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
s = {
array: function (x) {
var a = ['['], b, f, i, l = x.length, v;
for (i = 0; i < l; i += 1) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a[a.length] = v;
b = true;
}
}
}
a[a.length] = ']';
return a.join('');
},
'boolean': function (x) {
return String(x);
},
'null': function (x) {
return "null";
},
number: function (x) {
return isFinite(x) ? String(x) : 'null';
},
object: function (x) {
if (x) {
if (x instanceof Array) {
return s.array(x);
}
var a = ['{'], b, f, i, v;
for (i in x) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a.push(s.string(i), ':', v);
b = true;
}
}
}
a[a.length] = '}';
return a.join('');
}
return 'null';
},
string: function (x) {
if (/["\\\x00-\x1f]/.test(x)) {
x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
var c = m[b];
if (c) {
return c;
}
c = b.charCodeAt();
return '\\u00' +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
});
}
return '"' + x + '"';
}
};
Object.toJSON = function(obj) {
return s.object(obj);
};
})();
String.prototype.parseJSON = function () {
try {
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
this.replace(/"(\\.|[^"\\])*"/g, ''))) &&
eval('(' + this + ')');
} catch (e) {
return false;
}
};

316
build/js/pack.js Normal file
View file

@ -0,0 +1,316 @@
/*
packer, version 2.0.2 (2005-08-19)
Copyright 2004-2005, Dean Edwards
License: http://creativecommons.org/licenses/LGPL/2.1/
*/
function pack(_script, _encoding, _fastDecode, _specialChars) {
// constants
var $IGNORE = "$1";
// validate parameters
_script += "\n";
_encoding = Math.min(parseInt(_encoding), 95);
// apply all parsing routines
function _pack($script) {
var i, $parse;
for (i = 0; ($parse = _parsers[i]); i++) {
$script = $parse($script);
}
return $script;
};
// unpacking function - this is the boot strap function
// data extracted from this packing routine is passed to
// this function when decoded in the target
var _unpack = function($packed, $ascii, $count, $keywords, $encode, $decode) {
while ($count--)
if ($keywords[$count])
$packed = $packed.replace(new RegExp('\\b' + $encode($count) + '\\b', 'g'), $keywords[$count]);
return $packed;
};
// code-snippet inserted into the unpacker to speed up decoding
var _decode = function() {
// does the browser support String.replace where the
// replacement value is a function?
if (!''.replace(/^/, String)) {
// decode all the values we need
while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count);
// global replacement function
$keywords = [function($encoded){return $decode[$encoded]}];
// generic match
$encode = function(){return'\\w+'};
// reset the loop counter - we are now doing a global replace
$count = 1;
}
};
// keep a list of parsing functions, they'll be executed all at once
var _parsers = [];
function _addParser($parser) {
_parsers[_parsers.length] = $parser;
};
// zero encoding - just removal of white space and comments
function _basicCompression($script) {
var $parser = new ParseMaster;
// make safe
$parser.escapeChar = "\\";
// protect strings
$parser.add(/'[^'\n\r]*'/, $IGNORE);
$parser.add(/"[^"\n\r]*"/, $IGNORE);
// remove comments
$parser.add(/\/\/[^\n\r]*[\n\r]/, " ");
$parser.add(/\/\*[^*]*\*+([^\/][^*]*\*+)*\//, " ");
// protect regular expressions
$parser.add(/\s+(\/[^\/\n\r\*][^\/\n\r]*\/g?i?)/, "$2"); // IGNORE
$parser.add(/[^\w\x24\/'"*)\?:]\/[^\/\n\r\*][^\/\n\r]*\/g?i?/, $IGNORE);
// remove: ;;; doSomething();
if (_specialChars) $parser.add(/;;;[^\n\r]+[\n\r]/);
// remove redundant semi-colons
$parser.add(/\(;;\)/, $IGNORE); // protect for (;;) loops
$parser.add(/;+\s*([};])/, "$2");
// apply the above
$script = $parser.exec($script);
// remove white-space
$parser.add(/(\b|\x24)\s+(\b|\x24)/, "$2 $3");
$parser.add(/([+\-])\s+([+\-])/, "$2 $3");
$parser.add(/\s+/, "");
// done
return $parser.exec($script);
};
function _encodeSpecialChars($script) {
var $parser = new ParseMaster;
// replace: $name -> n, $$name -> na
$parser.add(/((\x24+)([a-zA-Z$_]+))(\d*)/, function($match, $offset) {
var $length = $match[$offset + 2].length;
var $start = $length - Math.max($length - $match[$offset + 3].length, 0);
return $match[$offset + 1].substr($start, $length) + $match[$offset + 4];
});
// replace: _name -> _0, double-underscore (__name) is ignored
var $regexp = /\b_[A-Za-z\d]\w*/;
// build the word list
var $keywords = _analyze($script, _globalize($regexp), _encodePrivate);
// quick ref
var $encoded = $keywords.$encoded;
$parser.add($regexp, function($match, $offset) {
return $encoded[$match[$offset]];
});
return $parser.exec($script);
};
function _encodeKeywords($script) {
// escape high-ascii values already in the script (i.e. in strings)
if (_encoding > 62) $script = _escape95($script);
// create the parser
var $parser = new ParseMaster;
var $encode = _getEncoder(_encoding);
// for high-ascii, don't encode single character low-ascii
var $regexp = (_encoding > 62) ? /\w\w+/ : /\w+/;
// build the word list
$keywords = _analyze($script, _globalize($regexp), $encode);
var $encoded = $keywords.$encoded;
// encode
$parser.add($regexp, function($match, $offset) {
return $encoded[$match[$offset]];
});
// if encoded, wrap the script in a decoding function
return $script && _bootStrap($parser.exec($script), $keywords);
};
function _analyze($script, $regexp, $encode) {
// analyse
// retreive all words in the script
var $all = $script.match($regexp);
var $$sorted = []; // list of words sorted by frequency
var $$encoded = {}; // dictionary of word->encoding
var $$protected = {}; // instances of "protected" words
if ($all) {
var $unsorted = []; // same list, not sorted
var $protected = {}; // "protected" words (dictionary of word->"word")
var $values = {}; // dictionary of charCode->encoding (eg. 256->ff)
var $count = {}; // word->count
var i = $all.length, j = 0, $word;
// count the occurrences - used for sorting later
do {
$word = "$" + $all[--i];
if (!$count[$word]) {
$count[$word] = 0;
$unsorted[j] = $word;
// make a dictionary of all of the protected words in this script
// these are words that might be mistaken for encoding
$protected["$" + ($values[j] = $encode(j))] = j++;
}
// increment the word counter
$count[$word]++;
} while (i);
// prepare to sort the word list, first we must protect
// words that are also used as codes. we assign them a code
// equivalent to the word itself.
// e.g. if "do" falls within our encoding range
// then we store keywords["do"] = "do";
// this avoids problems when decoding
i = $unsorted.length;
do {
$word = $unsorted[--i];
if ($protected[$word] != null) {
$$sorted[$protected[$word]] = $word.slice(1);
$$protected[$protected[$word]] = true;
$count[$word] = 0;
}
} while (i);
// sort the words by frequency
$unsorted.sort(function($match1, $match2) {
return $count[$match2] - $count[$match1];
});
j = 0;
// because there are "protected" words in the list
// we must add the sorted words around them
do {
if ($$sorted[i] == null) $$sorted[i] = $unsorted[j++].slice(1);
$$encoded[$$sorted[i]] = $values[i];
} while (++i < $unsorted.length);
}
return {$sorted: $$sorted, $encoded: $$encoded, $protected: $$protected};
};
// build the boot function used for loading and decoding
function _bootStrap($packed, $keywords) {
var $ENCODE = _safeRegExp("$encode\\($count\\)", "g");
// $packed: the packed script
$packed = "'" + _escape($packed) + "'";
// $ascii: base for encoding
var $ascii = Math.min($keywords.$sorted.length, _encoding) || 1;
// $count: number of words contained in the script
var $count = $keywords.$sorted.length;
// $keywords: list of words contained in the script
for (var i in $keywords.$protected) $keywords.$sorted[i] = "";
// convert from a string to an array
$keywords = "'" + $keywords.$sorted.join("|") + "'.split('|')";
// $encode: encoding function (used for decoding the script)
var $encode = _encoding > 62 ? _encode95 : _getEncoder($ascii);
$encode = String($encode).replace(/_encoding/g, "$ascii").replace(/arguments\.callee/g, "$encode");
var $inline = "$count" + ($ascii > 10 ? ".toString($ascii)" : "");
// $decode: code snippet to speed up decoding
if (_fastDecode) {
// create the decoder
var $decode = _getFunctionBody(_decode);
if (_encoding > 62) $decode = $decode.replace(/\\\\w/g, "[\\xa1-\\xff]");
// perform the encoding inline for lower ascii values
else if ($ascii < 36) $decode = $decode.replace($ENCODE, $inline);
// special case: when $count==0 there are no keywords. I want to keep
// the basic shape of the unpacking funcion so i'll frig the code...
if (!$count) $decode = $decode.replace(_safeRegExp("($count)\\s*=\\s*1"), "$1=0");
}
// boot function
var $unpack = String(_unpack);
if (_fastDecode) {
// insert the decoder
$unpack = $unpack.replace(/\{/, "{" + $decode + ";");
}
$unpack = $unpack.replace(/"/g, "'");
if (_encoding > 62) { // high-ascii
// get rid of the word-boundaries for regexp matches
$unpack = $unpack.replace(/'\\\\b'\s*\+|\+\s*'\\\\b'/g, "");
}
if ($ascii > 36 || _encoding > 62 || _fastDecode) {
// insert the encode function
$unpack = $unpack.replace(/\{/, "{$encode=" + $encode + ";");
} else {
// perform the encoding inline
$unpack = $unpack.replace($ENCODE, $inline);
}
// pack the boot function too
$unpack = pack($unpack, 0, false, true);
// arguments
var $params = [$packed, $ascii, $count, $keywords];
if (_fastDecode) {
// insert placeholders for the decoder
$params = $params.concat(0, "{}");
}
// the whole thing
return "eval(" + $unpack + "(" + $params + "))\n";
};
// mmm.. ..which one do i need ??
function _getEncoder($ascii) {
return $ascii > 10 ? $ascii > 36 ? $ascii > 62 ? _encode95 : _encode62 : _encode36 : _encode10;
};
// zero encoding
// characters: 0123456789
var _encode10 = function($charCode) {
return $charCode;
};
// inherent base36 support
// characters: 0123456789abcdefghijklmnopqrstuvwxyz
var _encode36 = function($charCode) {
return $charCode.toString(36);
};
// hitch a ride on base36 and add the upper case alpha characters
// characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
var _encode62 = function($charCode) {
return ($charCode < _encoding ? '' : arguments.callee(parseInt($charCode / _encoding))) +
(($charCode = $charCode % _encoding) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36));
};
// use high-ascii values
var _encode95 = function($charCode) {
return ($charCode < _encoding ? '' : arguments.callee($charCode / _encoding)) +
String.fromCharCode($charCode % _encoding + 161);
};
// special _chars
var _encodePrivate = function($charCode) {
return "_" + $charCode;
};
// protect characters used by the parser
function _escape($script) {
return $script.replace(/([\\'])/g, "\\$1");
};
// protect high-ascii characters already in the script
function _escape95($script) {
return $script.replace(/[\xa1-\xff]/g, function($match) {
return "\\x" + $match.charCodeAt(0).toString(16);
});
};
function _safeRegExp($string, $flags) {
return new RegExp($string.replace(/\$/g, "\\$"), $flags);
};
// extract the body of a function
function _getFunctionBody($function) {
with (String($function)) return slice(indexOf("{") + 1, lastIndexOf("}"));
};
// set the global flag on a RegExp (you have to create a new one)
function _globalize($regexp) {
return new RegExp(String($regexp).slice(1, -1), "g");
};
// build the parsing routine
_addParser(_basicCompression);
if (_specialChars) _addParser(_encodeSpecialChars);
if (_encoding) _addParser(_encodeKeywords);
// go!
return _pack(_script);
};

105
build/js/parse.js Normal file
View file

@ -0,0 +1,105 @@
function parse( f ) {
var c = [], bm, m;
var blockMatch = /\/\*\*\s*((.|\n)*?)\s*\*\//g;
var paramMatch = /\@(\S+) *((.|\n)*?)(?=\n\@|!!!)/m;
while ( bm = blockMatch.exec(f) ) {
block = bm[1].replace(/^\s*\* ?/mg,"") + "!!!";
var ret = { params: [], examples: [], tests: [], options: [] };
while ( m = paramMatch.exec( block ) ) {
block = block.replace( paramMatch, "" );
var n = m[1];
var v = m[2]
.replace(/\s*$/g,"")
.replace(/^\s*/g,"")
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
//.replace(/\n/g, "<br/>")
/*.replace(/(\s\s+)/g, function(a){
var ret = "";
for ( var i = 0; i < a.length; i++ )
ret += "&nbsp;";
return ret;
})*/ || 1;
if ( n == 'param' || n == 'option' ) {
var args = v.split(/\s+/);
v = args.slice( 2, args.length );
v = { type: args[0], name: args[1], desc: v.join(' ') };
n = n + "s";
} else if ( n == 'example' ) {
v = { code: v };
n = "examples";
} else if ( n == 'test' ) {
n = "tests";
}
if ( n == 'desc' || n == 'before' || n == 'after' || n == 'result' ) {
ret.examples[ ret.examples.length - 1 ][ n ] = v;
} else {
if ( ret[ n ] ) {
if ( ret[ n ].constructor == Array ) {
ret[ n ].push( v );
} else {
ret[ n ] = [ ret[ n ], v ];
}
} else {
ret[ n ] = v;
}
}
}
ret.desc = block.replace(/\s*!!!$/,"")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
//.replace(/\n\n/g, "<br/><br/>")
//.replace(/\n/g, " ");
var m = /^((.|\n)*?(\.|$))/.exec( ret.desc );
if ( m ) ret['short'] = m[1];
if ( ret.name ) c.push( ret );
}
return c;
}
function categorize( json ) {
var obj = { cat: [], method: [] };
for ( var i = 0; i < json.length; i++ ) {
if ( !json[i].cat ) json[i].cat = "";
var cat = json[i].cat.split("/");
var pos = obj;
for ( var j = 0; j < cat.length; j++ ) {
var c = cat[j];
var curCat = null;
// Locate current category
for ( var n = 0; n < pos.cat.length; n++ )
if ( pos.cat[n].value == c )
curCat = pos.cat[n];
// Create current category
if ( !curCat ) {
curCat = { value: c, cat: [], method: [] };
pos.cat.push( curCat )
}
// If we're at the end, add the method
if ( j == cat.length - 1 )
curCat.method.push( json[i] );
// Otherwise, traverse deeper
else
pos = curCat;
}
}
return obj;
}

19
build/js/writeFile.js Normal file
View file

@ -0,0 +1,19 @@
importPackage(java.io);
function writeFile( file, stream ) {
var buffer = new PrintWriter( new FileWriter( file ) );
buffer.print( stream );
buffer.close();
}
function read( file ) {
var jq = new File(file);
var reader = new BufferedReader(new FileReader(jq));
var line = null;
var buffer = new java.lang.StringBuffer(jq.length());
while( (line = reader.readLine()) != null) {
buffer.append(line);
buffer.append("\n");
}
return buffer.toString();
}

25
build/js/xml.js Normal file
View file

@ -0,0 +1,25 @@
Object.toXML = function( obj, tag ) {
if ( obj.constructor == Array ) {
var ret = "";
for ( var i = 0; i < obj.length; i++ )
ret += Object.toXML( obj[i], tag );
return ret;
} else if ( obj.constructor == Object ) {
var tag = tag || "tmp";
var p = "", child = "";
for ( var i in obj )
if ( ( obj[i].constructor != String && obj[i].constructor != Number ) || /</.test(obj[i] + "") || Object.toXML.force[i] )
child += Object.toXML( obj[i], i );
else
p += " " + i + "='" + (obj[i] + "").replace(/'/g, "&apos;") + "'";
return "<" + tag + p + ( child ? ">\n" + child + "</" + tag + ">\n" : "/>\n" );
} else if ( obj.constructor == String || obj.constructor == Number ) {
return "<" + tag + ">" + obj + "</" + tag + ">\n";
}
return "";
};
Object.toXML.force = {};

View file

@ -1,36 +0,0 @@
var JSLINT = require("./lib/jslint").JSLINT,
print = require("sys").print,
src = require("fs").readFileSync("dist/jquery.js", "utf8");
JSLINT(src, { evil: true, forin: true, maxerr: 100 });
// All of the following are known issues that we think are 'ok'
// (in contradiction with JSLint) more information here:
// http://docs.jquery.com/JQuery_Core_Style_Guidelines
var ok = {
"Expected an identifier and instead saw 'undefined' (a reserved word).": true,
"Use '===' to compare with 'null'.": true,
"Use '!==' to compare with 'null'.": true,
"Expected an assignment or function call and instead saw an expression.": true,
"Expected a 'break' statement before 'case'.": true,
"'e' is already defined.": true
};
var e = JSLINT.errors, found = 0, w;
for ( var i = 0; i < e.length; i++ ) {
w = e[i];
if ( !ok[ w.reason ] ) {
found++;
print( "\n" + w.evidence + "\n" );
print( " Problem at line " + w.line + " character " + w.character + ": " + w.reason );
}
}
if ( found > 0 ) {
print( "\n" + found + " Error(s) found.\n" );
} else {
print( "JSLint check passed.\n" );
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,22 +0,0 @@
var jsp = require("./parse-js"),
pro = require("./process"),
slice = jsp.slice,
member = jsp.member,
PRECEDENCE = jsp.PRECEDENCE,
OPERATORS = jsp.OPERATORS;
function ast_squeeze_more(ast) {
var w = pro.ast_walker(), walk = w.walk;
return w.with_walkers({
"call": function(expr, args) {
if (expr[0] == "dot" && expr[2] == "toString" && args.length == 0) {
// foo.toString() ==> foo+""
return [ "binary", "+", expr[1], [ "string", "" ]];
}
}
}, function() {
return walk(ast);
});
};
exports.ast_squeeze_more = ast_squeeze_more;

View file

@ -1,7 +0,0 @@
#!/usr/bin/env node
var print = require("sys").print,
src = require("fs").readFileSync(process.argv[2], "utf8");
// Previously done in sed but reimplemented here due to portability issues
print( src.replace( /^(\s*\*\/)(.+)/m, "$1\n$2" ) + ";" );

View file

@ -1,54 +0,0 @@
#!/usr/bin/env node
/*
* jQuery Release Note Generator
*/
var fs = require("fs"),
http = require("http"),
tmpl = require("mustache"),
extract = /<a href="\/ticket\/(\d+)" title="View ticket">(.*?)<[^"]+"component">\s*(\S+)/g;
var opts = {
version: "1.6.2 RC 1",
short_version: "1.6.2rc1",
final_version: "1.6.2",
categories: []
};
http.request({
host: "bugs.jquery.com",
port: 80,
method: "GET",
path: "/query?status=closed&resolution=fixed&component=!web&order=component&milestone=" + opts.final_version
}, function (res) {
var data = [];
res.on( "data", function( chunk ) {
data.push( chunk );
});
res.on( "end", function() {
var match,
file = data.join(""),
cur;
while ( (match = extract.exec( file )) ) {
if ( "#" + match[1] !== match[2] ) {
var cat = match[3];
if ( !cur || cur.name !== cat ) {
cur = { name: match[3], niceName: match[3].replace(/^./, function(a){ return a.toUpperCase(); }), bugs: [] };
opts.categories.push( cur );
}
cur.bugs.push({ ticket: match[1], title: match[2] });
}
}
buildNotes();
});
}).end();
function buildNotes() {
console.log( tmpl.to_html( fs.readFileSync("release-notes.txt", "utf8"), opts ) );
}

View file

@ -1,27 +0,0 @@
<h2>jQuery {{version}} Released</h2>
<p>This is a preview release of jQuery. We're releasing it so that everyone can start testing the code in their applications, making sure that there are no major problems.</p>
<p>You can get the code from the jQuery CDN:</p>
<ul>
<li><a href="http://code.jquery.com/jquery-{{short_version}}.js">http://code.jquery.com/jquery-{{short_version}}.js</a></li>
</ul>
<p>You can help us by dropping that code into your existing application and letting us know that if anything no longer works. Please <a href="http://bugs.jquery.com/">file a bug</a> and be sure to mention that you're testing against jQuery {{version}}.</p>
<p>We want to encourage everyone from the community to try and <a href="http://docs.jquery.com/Getting_Involved">get involved</a> in contributing back to jQuery core. We've set up a <a href="http://docs.jquery.com/Getting_Involved">full page</a> of information dedicated towards becoming more involved with the team. The team is here and ready to help you help us!</p>
<h2>jQuery {{version}} Change Log</h2>
<p>The current change log of the {{version}} release.</p>
{{#categories}}
<h3>{{niceName}}</h3>
<ul>
{{#bugs}}
<li><a href="http://bugs.jquery.com/ticket/{{ticket}}">#{{ticket}}</a>: {{title}}</li>
{{/bugs}}
</ul>
{{/categories}}

View file

@ -1,169 +0,0 @@
#!/usr/bin/env node
/*
* jQuery Release Management
*/
var fs = require("fs"),
child = require("child_process"),
debug = false;
var scpURL = "jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/",
cdnURL = "http://code.origin.jquery.com/",
version = /^[\d.]+(?:(?:a|b|rc)\d+|pre)?$/,
versionFile = "version.txt",
file = "dist/jquery.js",
minFile = "dist/jquery.min.js",
files = {
"jquery-VER.js": file,
"jquery-VER.min.js": minFile
},
finalFiles = {
"jquery.js": file,
"jquery-latest.js": file,
"jquery.min.js": minFile,
"jquery-latest.min.js": minFile
};
exec( "git pull && git status", function( error, stdout, stderr ) {
if ( /Changes to be committed/i.test( stdout ) ) {
exit( "Please commit changed files before attemping to push a release." );
} else if ( /Changes not staged for commit/i.test( stdout ) ) {
exit( "Please stash files before attempting to push a release." );
} else {
setVersion();
}
});
function setVersion() {
var oldVersion = fs.readFileSync( versionFile, "utf8" );
prompt( "New Version (was " + oldVersion + "): ", function( data ) {
if ( data && version.test( data ) ) {
fs.writeFileSync( versionFile, data );
exec( "git commit -a -m 'Tagging the " + data + " release.' && git push && " +
"git tag " + data + " && git push origin " + data, function() {
make( data );
});
} else {
console.error( "Malformed version number, please try again." );
setVersion();
}
});
}
function make( newVersion ) {
exec( "make clean && make", function( error, stdout, stderr ) {
// TODO: Verify JSLint
Object.keys( files ).forEach(function( oldName ) {
var value = files[ oldName ], name = oldName.replace( /VER/g, newVersion );
copy( value, name );
delete files[ oldName ];
files[ name ] = value;
});
exec( "scp " + Object.keys( files ).join( " " ) + " " + scpURL, function() {
setNextVersion( newVersion );
});
});
}
function setNextVersion( newVersion ) {
var isFinal = false;
if ( /(?:a|b|rc)\d+$/.test( newVersion ) ) {
newVersion = newVersion.replace( /(?:a|b|rc)\d+$/, "pre" );
} else if ( /^\d+\.\d+\.?(\d*)$/.test( newVersion ) ) {
newVersion = newVersion.replace( /^(\d+\.\d+\.?)(\d*)$/, function( all, pre, num ) {
return pre + (pre.charAt( pre.length - 1 ) !== "." ? "." : "") + (num ? parseFloat( num ) + 1 : 1) + "pre";
});
isFinal = true;
}
prompt( "Next Version [" + newVersion + "]: ", function( data ) {
if ( !data ) {
data = newVersion;
}
if ( version.test( data ) ) {
fs.writeFileSync( versionFile, data );
exec( "git commit -a -m 'Updating the source version to " + data + "' && git push", function() {
if ( isFinal ) {
makeFinal( newVersion );
}
});
} else {
console.error( "Malformed version number, please try again." );
setNextVersion( newVersion );
}
});
}
function makeFinal( newVersion ) {
var all = Object.keys( finalFiles );
// Copy all the files
all.forEach(function( name ) {
copy( finalFiles[ name ], name );
});
// Upload files to CDN
exec( "scp " + all.join( " " ) + " " + scpURL, function() {
exec( "curl '" + cdnURL + "{" + all.join( "," ) + "}?reload'", function() {
console.log( "Done." );
});
});
}
function copy( oldFile, newFile ) {
if ( debug ) {
console.log( "Copying " + oldFile + " to " + newFile );
} else {
fs.writeFileSync( newFile, fs.readFileSync( oldFile, "utf8" ) );
}
}
function prompt( msg, callback ) {
process.stdout.write( msg );
process.stdin.resume();
process.stdin.setEncoding( "utf8" );
process.stdin.once( "data", function( chunk ) {
process.stdin.pause();
callback( chunk.replace( /\n*$/g, "" ) );
});
}
function exec( cmd, fn ) {
if ( debug ) {
console.log( cmd );
fn();
} else {
child.exec( cmd, fn );
}
}
function exit( msg ) {
if ( msg ) {
console.error( "\nError: " + msg );
}
process.exit( 1 );
}

695
build/runtest/env.js Normal file
View file

@ -0,0 +1,695 @@
/*
* Simulated browser environment for Rhino
* By John Resig <http://ejohn.org/>
* Copyright 2007 John Resig, under the MIT License
*/
// The window Object
var window = this;
(function(){
// Browser Navigator
window.navigator = {
get userAgent(){
return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3";
}
};
var curLocation = (new java.io.File("./")).toURL();
window.__defineSetter__("location", function(url){
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.onreadystatechange = function(){
curLocation = new java.net.URL( curLocation, url );
window.document = xhr.responseXML;
var event = document.createEvent();
event.initEvent("load");
window.dispatchEvent( event );
};
xhr.send();
});
window.__defineGetter__("location", function(url){
return {
get protocol(){
return curLocation.getProtocol() + ":";
},
get href(){
return curLocation.toString();
},
toString: function(){
return this.href;
}
};
});
// Timers
var timers = [];
window.setTimeout = function(fn, time){
var num;
return num = setInterval(function(){
fn();
clearInterval(num);
}, time);
};
window.setInterval = function(fn, time){
var num = timers.length;
timers[num] = new java.lang.Thread(new java.lang.Runnable({
run: function(){
while (true){
java.lang.Thread.currentThread().sleep(time);
fn();
}
}
}));
timers[num].start();
return num;
};
window.clearInterval = function(num){
if ( timers[num] ) {
timers[num].stop();
delete timers[num];
}
};
// Window Events
var events = [{}];
window.addEventListener = function(type, fn){
if ( !this.uuid || this == window ) {
this.uuid = events.length;
events[this.uuid] = {};
}
if ( !events[this.uuid][type] )
events[this.uuid][type] = [];
if ( events[this.uuid][type].indexOf( fn ) < 0 )
events[this.uuid][type].push( fn );
};
window.removeEventListener = function(type, fn){
if ( !this.uuid || this == window ) {
this.uuid = events.length;
events[this.uuid] = {};
}
if ( !events[this.uuid][type] )
events[this.uuid][type] = [];
events[this.uuid][type] =
events[this.uuid][type].filter(function(f){
return f != fn;
});
};
window.dispatchEvent = function(event){
if ( event.type ) {
if ( this.uuid && events[this.uuid][event.type] ) {
var self = this;
events[this.uuid][event.type].forEach(function(fn){
fn.call( self, event );
});
}
if ( this["on" + event.type] )
this["on" + event.type].call( self, event );
}
};
// DOM Document
window.DOMDocument = function(file){
this._file = file;
this._dom = Packages.javax.xml.parsers.
DocumentBuilderFactory.newInstance()
.newDocumentBuilder().parse(file);
if ( !obj_nodes.containsKey( this._dom ) )
obj_nodes.put( this._dom, this );
};
DOMDocument.prototype = {
createTextNode: function(text){
return makeNode( this._dom.createTextNode(
text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")) );
},
createElement: function(name){
return makeNode( this._dom.createElement(name.toLowerCase()) );
},
getElementsByTagName: function(name){
return new DOMNodeList( this._dom.getElementsByTagName(
name.toLowerCase()) );
},
getElementById: function(id){
var elems = this._dom.getElementsByTagName("*");
for ( var i = 0; i < elems.length; i++ ) {
var elem = elems.item(i);
if ( elem.getAttribute("id") == id )
return makeNode(elem);
}
return null;
},
get body(){
return this.getElementsByTagName("body")[0];
},
get documentElement(){
return makeNode( this._dom.getDocumentElement() );
},
get ownerDocument(){
return null;
},
addEventListener: window.addEventListener,
removeEventListener: window.removeEventListener,
dispatchEvent: window.dispatchEvent,
get nodeName() {
return "#document";
},
importNode: function(node, deep){
return makeNode( this._dom.importNode(node._dom, deep) );
},
toString: function(){
return "Document" + (typeof this._file == "string" ?
": " + this._file : "");
},
get innerHTML(){
return this.documentElement.outerHTML;
},
get defaultView(){
return {
getComputedStyle: function(elem){
return {
getPropertyValue: function(prop){
prop = prop.replace(/\-(\w)/g,function(m,c){
return c.toUpperCase();
});
var val = elem.style[prop];
if ( prop == "opacity" && val == "" )
val = "1";
return val;
}
};
}
};
},
createEvent: function(){
return {
type: "",
initEvent: function(type){
this.type = type;
}
};
}
};
function getDocument(node){
return obj_nodes.get(node);
}
// DOM NodeList
window.DOMNodeList = function(list){
this._dom = list;
this.length = list.getLength();
for ( var i = 0; i < this.length; i++ ) {
var node = list.item(i);
this[i] = makeNode( node );
}
};
DOMNodeList.prototype = {
toString: function(){
return "[ " +
Array.prototype.join.call( this, ", " ) + " ]";
},
get outerHTML(){
return Array.prototype.map.call(
this, function(node){return node.outerHTML;}).join('');
}
};
// DOM Node
window.DOMNode = function(node){
this._dom = node;
};
DOMNode.prototype = {
get nodeType(){
return this._dom.getNodeType();
},
get nodeValue(){
return this._dom.getNodeValue();
},
get nodeName() {
return this._dom.getNodeName();
},
cloneNode: function(deep){
return makeNode( this._dom.cloneNode(deep) );
},
get ownerDocument(){
return getDocument( this._dom.ownerDocument );
},
get documentElement(){
return makeNode( this._dom.documentElement );
},
get parentNode() {
return makeNode( this._dom.getParentNode() );
},
get nextSibling() {
return makeNode( this._dom.getNextSibling() );
},
get previousSibling() {
return makeNode( this._dom.getPreviousSibling() );
},
toString: function(){
return '"' + this.nodeValue + '"';
},
get outerHTML(){
return this.nodeValue;
}
};
// DOM Element
window.DOMElement = function(elem){
this._dom = elem;
this.style = {
get opacity(){ return this._opacity; },
set opacity(val){ this._opacity = val + ""; }
};
// Load CSS info
var styles = (this.getAttribute("style") || "").split(/\s*;\s*/);
for ( var i = 0; i < styles.length; i++ ) {
var style = styles[i].split(/\s*:\s*/);
if ( style.length == 2 )
this.style[ style[0] ] = style[1];
}
};
DOMElement.prototype = extend( new DOMNode(), {
get nodeName(){
return this.tagName.toUpperCase();
},
get tagName(){
return this._dom.getTagName();
},
toString: function(){
return "<" + this.tagName + (this.id ? "#" + this.id : "" ) + ">";
},
get outerHTML(){
var ret = "<" + this.tagName, attr = this.attributes;
for ( var i in attr )
ret += " " + i + "='" + attr[i] + "'";
if ( this.childNodes.length || this.nodeName == "SCRIPT" )
ret += ">" + this.childNodes.outerHTML +
"</" + this.tagName + ">";
else
ret += "/>";
return ret;
},
get attributes(){
var attr = {}, attrs = this._dom.getAttributes();
for ( var i = 0; i < attrs.getLength(); i++ )
attr[ attrs.item(i).nodeName ] = attrs.item(i).nodeValue;
return attr;
},
get innerHTML(){
return this.childNodes.outerHTML;
},
set innerHTML(html){
html = html.replace(/<\/?([A-Z]+)/g, function(m){
return m.toLowerCase();
});
var nodes = this.ownerDocument.importNode(
new DOMDocument( new java.io.ByteArrayInputStream(
(new java.lang.String("<wrap>" + html + "</wrap>"))
.getBytes("UTF8"))).documentElement, true).childNodes;
while (this.firstChild)
this.removeChild( this.firstChild );
for ( var i = 0; i < nodes.length; i++ )
this.appendChild( nodes[i] );
},
get textContent(){
return nav(this.childNodes);
function nav(nodes){
var str = "";
for ( var i = 0; i < nodes.length; i++ )
if ( nodes[i].nodeType == 3 )
str += nodes[i].nodeValue;
else if ( nodes[i].nodeType == 1 )
str += nav(nodes[i].childNodes);
return str;
}
},
set textContent(text){
while (this.firstChild)
this.removeChild( this.firstChild );
this.appendChild( this.ownerDocument.createTextNode(text));
},
style: {},
clientHeight: 0,
clientWidth: 0,
offsetHeight: 0,
offsetWidth: 0,
get disabled() {
var val = this.getAttribute("disabled");
return val != "false" && !!val;
},
set disabled(val) { return this.setAttribute("disabled",val); },
get checked() {
var val = this.getAttribute("checked");
return val != "false" && !!val;
},
set checked(val) { return this.setAttribute("checked",val); },
get selected() {
if ( !this._selectDone ) {
this._selectDone = true;
if ( this.nodeName == "OPTION" && !this.parentNode.getAttribute("multiple") ) {
var opt = this.parentNode.getElementsByTagName("option");
if ( this == opt[0] ) {
var select = true;
for ( var i = 1; i < opt.length; i++ )
if ( opt[i].selected ) {
select = false;
break;
}
if ( select )
this.selected = true;
}
}
}
var val = this.getAttribute("selected");
return val != "false" && !!val;
},
set selected(val) { return this.setAttribute("selected",val); },
get className() { return this.getAttribute("class") || ""; },
set className(val) {
return this.setAttribute("class",
val.replace(/(^\s*|\s*$)/g,""));
},
get type() { return this.getAttribute("type") || ""; },
set type(val) { return this.setAttribute("type",val); },
get value() { return this.getAttribute("value") || ""; },
set value(val) { return this.setAttribute("value",val); },
get src() { return this.getAttribute("src") || ""; },
set src(val) { return this.setAttribute("src",val); },
get id() { return this.getAttribute("id") || ""; },
set id(val) { return this.setAttribute("id",val); },
getAttribute: function(name){
return this._dom.hasAttribute(name) ?
new String( this._dom.getAttribute(name) ) :
null;
},
setAttribute: function(name,value){
this._dom.setAttribute(name,value);
},
removeAttribute: function(name){
this._dom.removeAttribute(name);
},
get childNodes(){
return new DOMNodeList( this._dom.getChildNodes() );
},
get firstChild(){
return makeNode( this._dom.getFirstChild() );
},
get lastChild(){
return makeNode( this._dom.getLastChild() );
},
appendChild: function(node){
this._dom.appendChild( node._dom );
},
insertBefore: function(node,before){
this._dom.insertBefore( node._dom, before ? before._dom : before );
},
removeChild: function(node){
this._dom.removeChild( node._dom );
},
getElementsByTagName: DOMDocument.prototype.getElementsByTagName,
addEventListener: window.addEventListener,
removeEventListener: window.removeEventListener,
dispatchEvent: window.dispatchEvent,
click: function(){
var event = document.createEvent();
event.initEvent("click");
this.dispatchEvent(event);
},
submit: function(){
var event = document.createEvent();
event.initEvent("submit");
this.dispatchEvent(event);
},
focus: function(){
var event = document.createEvent();
event.initEvent("focus");
this.dispatchEvent(event);
},
blur: function(){
var event = document.createEvent();
event.initEvent("blur");
this.dispatchEvent(event);
},
get elements(){
return this.getElementsByTagName("*");
},
get contentWindow(){
return this.nodeName == "IFRAME" ? {
document: this.contentDocument
} : null;
},
get contentDocument(){
if ( this.nodeName == "IFRAME" ) {
if ( !this._doc )
this._doc = new DOMDocument(
new java.io.ByteArrayInputStream((new java.lang.String(
"<html><head><title></title></head><body></body></html>"))
.getBytes("UTF8")));
return this._doc;
} else
return null;
}
});
// Helper method for extending one object with another
function extend(a,b) {
for ( var i in b ) {
var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i);
if ( g || s ) {
if ( g )
a.__defineGetter__(i, g);
if ( s )
a.__defineSetter__(i, s);
} else
a[i] = b[i];
}
return a;
}
// Helper method for generating the right
// DOM objects based upon the type
var obj_nodes = new java.util.HashMap();
function makeNode(node){
if ( node ) {
if ( !obj_nodes.containsKey( node ) )
obj_nodes.put( node, node.getNodeType() ==
Packages.org.w3c.dom.Node.ELEMENT_NODE ?
new DOMElement( node ) : new DOMNode( node ) );
return obj_nodes.get(node);
} else
return null;
}
// XMLHttpRequest
// Originally implemented by Yehuda Katz
window.XMLHttpRequest = function(){
this.headers = {};
this.responseHeaders = {};
};
XMLHttpRequest.prototype = {
open: function(method, url, async, user, password){
this.readyState = 1;
if (async)
this.async = true;
this.method = method || "GET";
this.url = url;
this.onreadystatechange();
},
setRequestHeader: function(header, value){
this.headers[header] = value;
},
getResponseHeader: function(header){ },
send: function(data){
var self = this;
function makeRequest(){
var url = new java.net.URL(curLocation, self.url);
if ( url.getProtocol() == "file" ) {
if ( self.method == "PUT" ) {
var out = new java.io.FileWriter(
new java.io.File( new java.net.URI( url.toString() ) ) ),
text = new java.lang.String( data || "" );
out.write( text, 0, text.length() );
out.flush();
out.close();
} else if ( self.method == "DELETE" ) {
var file = new java.io.File( new java.net.URI( url.toString() ) );
file["delete"]();
} else {
var connection = url.openConnection();
connection.connect();
handleResponse();
}
} else {
var connection = url.openConnection();
connection.setRequestMethod( self.method );
// Add headers to Java connection
for (var header in self.headers)
connection.addRequestProperty(header, self.headers[header]);
connection.connect();
// Stick the response headers into responseHeaders
for (var i = 0; ; i++) {
var headerName = connection.getHeaderFieldKey(i);
var headerValue = connection.getHeaderField(i);
if (!headerName && !headerValue) break;
if (headerName)
self.responseHeaders[headerName] = headerValue;
}
handleResponse();
}
function handleResponse(){
self.readyState = 4;
self.status = parseInt(connection.responseCode) || undefined;
self.statusText = connection.responseMessage || "";
var stream = new java.io.InputStreamReader(connection.getInputStream()),
buffer = new java.io.BufferedReader(stream), line;
while ((line = buffer.readLine()) != null)
self.responseText += line;
self.responseXML = null;
if ( self.responseText.match(/^\s*</) ) {
try {
self.responseXML = new DOMDocument(
new java.io.ByteArrayInputStream(
(new java.lang.String(
self.responseText)).getBytes("UTF8")));
} catch(e) {}
}
}
self.onreadystatechange();
}
if (this.async)
(new java.lang.Thread(new java.lang.Runnable({
run: makeRequest
}))).start();
else
makeRequest();
},
abort: function(){},
onreadystatechange: function(){},
getResponseHeader: function(header){
if (this.readyState < 3)
throw new Error("INVALID_STATE_ERR");
else {
var returnedHeaders = [];
for (var rHeader in this.responseHeaders) {
if (rHeader.match(new Regexp(header, "i")))
returnedHeaders.push(this.responseHeaders[rHeader]);
}
if (returnedHeaders.length)
return returnedHeaders.join(", ");
}
return null;
},
getAllResponseHeaders: function(header){
if (this.readyState < 3)
throw new Error("INVALID_STATE_ERR");
else {
var returnedHeaders = [];
for (var header in this.responseHeaders)
returnedHeaders.push( header + ": " + this.responseHeaders[header] );
return returnedHeaders.join("\r\n");
}
},
async: true,
readyState: 0,
responseText: "",
status: 0
};
})();

21
build/runtest/test.js Normal file
View file

@ -0,0 +1,21 @@
// Init
load("build/runtest/env.js");
window.location = "test/index.html";
window.onload = function(){
// Load the test runner
load("dist/jquery.js","build/runtest/testrunner.js");
// Load the tests
load(
"test/unit/core.js",
"test/unit/selector.js",
"test/unit/event.js"
//"test/unit/fx.js",
//"test/unit/ajax.js"
);
// Display the results
results();
};

197
build/runtest/testrunner.js Normal file
View file

@ -0,0 +1,197 @@
function test(name, fn){
expected = -1;
numTests = 0;
reset();
fn();
if ( expected != -1 && expected != numTests )
log( false, "Wrong number of tests run. " + numTests + " ran, expected " + expected );
}
var orig = document.getElementById('main').innerHTML;
/**
* Resets the test setup. Useful for tests that modify the DOM.
*/
function reset() {
document.getElementById('main').innerHTML = orig;
}
var currentModule = "";
// call on start of module test to prepend name to all tests
function module(moduleName) {
currentModule = moduleName;
}
var expected = -1;
/**
* Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
*/
function expect(asserts) {
expected = asserts;
}
/**
* Asserts true.
* @example ok( $("a").size() > 5, "There must be at least 5 anchors" );
*/
function ok(a, msg) {
log( !!a, msg );
}
/**
* Asserts that two arrays are the same
*/
function isSet(a, b, msg) {
var ret = true;
if ( a && b && a.length != undefined && a.length == b.length ) {
for ( var i = 0; i < a.length; i++ ) {
if ( a[i] != b[i] )
ret = false;
}
} else
ret = false;
if ( !ret )
log( ret, msg + " expected: " + serialArray(b) + " result: " + serialArray(a) );
else
log( ret, msg );
}
/**
* Asserts that two objects are equivalent
*/
function isObj(a, b, msg) {
var ret = true;
if ( a && b ) {
for ( var i in a )
if ( a[i] != b[i] )
ret = false;
for ( i in b )
if ( a[i] != b[i] )
ret = false;
} else
ret = false;
log( ret, msg );
}
function serialArray( a ) {
var r = [];
if ( a && a.length )
for ( var i = 0; i < a.length; i++ ) {
var str = a[i] ? a[i].nodeName : "";
if ( str ) {
str = str.toLowerCase();
if ( a[i].id )
str += "#" + a[i].id;
} else
str = a[i];
r.push( str );
}
return "[ " + r.join(", ") + " ]"
}
/**
* Returns an array of elements with the given IDs, eg.
* @example q("main", "foo", "bar")
* @result [<div id="main">, <span id="foo">, <input id="bar">]
*/
function q() {
var r = [];
for ( var i = 0; i < arguments.length; i++ )
r.push( document.getElementById( arguments[i] ) );
return r;
}
/**
* Asserts that a select matches the given IDs
* @example t("Check for something", "//[a]", ["foo", "baar"]);
* @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
*/
function t(a,b,c) {
var f = jQuery(b);
var s = "";
for ( var i = 0; i < f.length; i++ )
s += (s && ",") + '"' + f[i].id + '"';
isSet(f, q.apply(q,c), a + " (" + b + ")");
}
/**
* Checks that the first two arguments are equal, with an optional message.
* Prints out both expected and actual values on failure.
*
* Prefered to ok( expected == actual, message )
*
* @example equals( "Expected 2 characters.", v.formatMessage("Expected {0} characters.", 2) );
*
* @param Object expected
* @param Object actual
* @param String message (optional)
*/
function equals(expected, actual, message) {
var result = expected == actual;
message = message || (result ? "okay" : "failed");
log( result, result ? message + ": " + expected : message + " expected: " + expected + " actual: " + actual );
}
var numTests = 0, total = 0, pass = 0, fail = 0;
function log(state, msg){
print( (state ? "PASS" : "FAIL") + " (" + (++total) + ") " +
(currentModule ? "[" + currentModule + "] " : "") + msg );
numTests++;
if ( state )
pass++;
else
fail++;
}
function results(){
print( pass + " Passed, " + fail + " Failed" );
}
function start(){}
function stop(){}
/**
* Trigger an event on an element.
*
* @example triggerEvent( document.body, "click" );
*
* @param DOMElement elem
* @param String type
*/
function triggerEvent( elem, type, event ) {
/*
if ( jQuery.browser.mozilla || jQuery.browser.opera ) {
event = document.createEvent("MouseEvents");
event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
elem.dispatchEvent( event );
} else if ( jQuery.browser.msie ) {
elem.fireEvent("on"+type);
}
*/
}
/**
* Add random number to url to stop IE from caching
*
* @example url("data/test.html")
* @result "data/test.html?10538358428943"
*
* @example url("data/test.php?foo=bar")
* @result "data/test.php?foo=bar&10538358345554"
*/
function url(value) {
return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);
}

0
speed/benchmarker.css → build/speed/benchmarker.css Normal file → Executable file
View file

59
speed/benchmarker.js → build/speed/benchmarker.js Normal file → Executable file
View file

@ -1,42 +1,18 @@
jQuery.benchmarker.tests = [ jQuery.benchmarker.tests = [
// Selectors from: "*",
// http://ejohn.org/blog/selectors-that-people-actually-use/ "body", "body div", "div",
/* "div div div", "div div", ".dialog", "div.dialog", "div .dialog",
// For Amazon.com "#speech5", "div#speech5", "div #speech5", "div > div", "div.scene div.dialog",
"#navAmazonLogo", "#navSwmSkedPop", "div#scene1.scene div.dialog div", "#scene1 #speech1", "body > div.dialog div#speech5",
".navbar", ".navGreeting", "div:nth-child(even)", "div:nth-child(odd)",
"div", "table", "div:nth-child(1)", "div:nth-child(2n)",
"img.navCrossshopTabCap", "span.navGreeting", "div:nth-child(2n+3)", "div:first-child",
"#navbar table", "#navidWelcomeMsg span", "div:last-child", "div:only-child",
"div#navbar", "ul#navAmazonLogo", "div:contains(CELIA)",
"#navAmazonLogo .navAmazonLogoGatewayPanel", "#navidWelcomeMsg .navGreeting", "div ~ div", "div + div",
".navbar .navAmazonLogoGatewayPanel", ".navbar .navGreeting", "div[@class]", "div[@class=dialog]", "div[@class!=dialog]",
"*", "div[@class^=dialog]", "div[@class$=dialog]", "div[@class*=dialog]"
"#navAmazonLogo li.navAmazonLogoGatewayPanel", "#navidWelcomeMsg span.navGreeting", ]
"a[name=top]", "form[name=site-search]",
".navbar li", ".navbar span",
"[name=top]", "[name=site-search]",
"ul li", "a img",
"#navbar #navidWelcomeMsg", "#navbar #navSwmDWPop",
"#navbar ul li", "#navbar a img"
*/
// For Yahoo.com
"#page", "#masthead", "#mastheadhd",
".mastheadbd", ".first", ".on",
"div", "li", "a",
"div.mastheadbd", "li.first", "li.on",
"#page div", "#dtba span",
"div#page", "div#masthead",
"#page .mastheadbd", "#page .first",
".outer_search_container .search_container", ".searchbox_container .inputtext",
"*",
"#page div.mastheadbd", "#page li.first",
"input[name=p]", "a[name=marketplace]",
".outer_search_container div", ".searchbox_container span",
"[name=p]", "[name=marketplace]",
"ul li", "form input",
"#page #e2econtent", "#page #e2e"
];
jQuery.fn.benchmark = function() { jQuery.fn.benchmark = function() {
this.each(function() { this.each(function() {
@ -62,8 +38,8 @@
jQuery("button.retryTies").bind("click", function() { jQuery("tr:has(td.tie) td.test").benchmark() }) jQuery("button.retryTies").bind("click", function() { jQuery("tr:has(td.tie) td.test").benchmark() })
jQuery("button.selectAll").bind("click", function() { jQuery("input[type=checkbox]").each(function() { this.checked = true }) }) jQuery("button.selectAll").bind("click", function() { jQuery("input[@type=checkbox]").each(function() { this.checked = true }) })
jQuery("button.deselectAll").bind("click", function() { jQuery("input[type=checkbox]").each(function() { this.checked = false }) }) jQuery("button.deselectAll").bind("click", function() { jQuery("input[@type=checkbox]").each(function() { this.checked = false }) })
jQuery("#addTest").bind("click", function() { jQuery("#addTest").bind("click", function() {
jQuery("table").append("<tr><td><input type='checkbox' /></td><td><input type='text' /><button>Add</button></td></tr>"); jQuery("table").append("<tr><td><input type='checkbox' /></td><td><input type='text' /><button>Add</button></td></tr>");
@ -101,6 +77,9 @@
var times = times || 50; var times = times || 50;
var el = list[0]; var el = list[0];
var code = jQuery(el).text().replace(/^-/, ""); var code = jQuery(el).text().replace(/^-/, "");
if(!libraries[0].match(/^jQ/)) {
code = code.replace(/@/, "");
}
var timeArr = [] var timeArr = []
for(i = 0; i < times + 2; i++) { for(i = 0; i < times + 2; i++) {
var time = new Date() var time = new Date()

513
build/speed/index.html Executable file
View file

@ -0,0 +1,513 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" debug="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Speed Test</title>
<script src="jquery-basis.js" type="text/javascript"></script>
<script src="../../dist/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
<link rel="stylesheet" href="benchmarker.css" type="text/css" media="screen" />
</head>
<body>
<h1>Speed Test</h1>
<div id="badid"></div>
<div id="time-test">
<p>Using the following selector expressions (<input type="text" id="times" maxlength="5" size="5" value="20"/> times each):</p>
<p>NOTE: Number shown is an average.</p>
<div class="buttons">
<button class="selectAll">Select All</button>
<button class="deselectAll">Deselect All</button>
<button class="runTests">Run Tests</button>
<button class="retryTies">Retry Ties</button>
</div>
<table cellspacing="0">
<thead>
<tr>
<th>Run?</th>
<th>Test</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
</tr>
</tfoot>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<div class="buttons">
<button class="selectAll">Select All</button>
<button class="deselectAll">Deselect All</button>
<button class="runTests">Run Tests</button>
<button class="retryTies">Retry Ties</button>
<button id="addTest">+</button>
</div>
</div>
<div class="dialog">
<h2>As You Like It</h2>
<div id="playwright">
by William Shakespeare
</div>
<div class="dialog scene" id="scene1">
<h3>ACT I, SCENE III. A room in the palace.</h3>
<div class="dialog">
<div class="direction">Enter CELIA and ROSALIND</div>
</div>
<div id="speech1" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.1">Why, cousin! why, Rosalind! Cupid have mercy! not a word?</div>
</div>
<div id="speech2" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.2">Not one to throw at a dog.</div>
</div>
<div id="speech3" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.3">No, thy words are too precious to be cast away upon</div>
<div id="scene1.3.4">curs; throw some of them at me; come, lame me with reasons.</div>
</div>
<div id="speech4" class="character">ROSALIND</div>
<div id="speech5" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.8">But is all this for your father?</div>
</div>
<div class="dialog">
<div id="scene1.3.5">Then there were two cousins laid up; when the one</div>
<div id="scene1.3.6">should be lamed with reasons and the other mad</div>
<div id="scene1.3.7">without any.</div>
</div>
<div id="speech6" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.9">No, some of it is for my child's father. O, how</div>
<div id="scene1.3.10">full of briers is this working-day world!</div>
</div>
<div id="speech7" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.11">They are but burs, cousin, thrown upon thee in</div>
<div id="scene1.3.12">holiday foolery: if we walk not in the trodden</div>
<div id="scene1.3.13">paths our very petticoats will catch them.</div>
</div>
<div id="speech8" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.14">I could shake them off my coat: these burs are in my heart.</div>
</div>
<div id="speech9" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.15">Hem them away.</div>
</div>
<div id="speech10" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.16">I would try, if I could cry 'hem' and have him.</div>
</div>
<div id="speech11" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.17">Come, come, wrestle with thy affections.</div>
</div>
<div id="speech12" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.18">O, they take the part of a better wrestler than myself!</div>
</div>
<div id="speech13" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.19">O, a good wish upon you! you will try in time, in</div>
<div id="scene1.3.20">despite of a fall. But, turning these jests out of</div>
<div id="scene1.3.21">service, let us talk in good earnest: is it</div>
<div id="scene1.3.22">possible, on such a sudden, you should fall into so</div>
<div id="scene1.3.23">strong a liking with old Sir Rowland's youngest son?</div>
</div>
<div id="speech14" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.24">The duke my father loved his father dearly.</div>
</div>
<div id="speech15" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.25">Doth it therefore ensue that you should love his son</div>
<div id="scene1.3.26">dearly? By this kind of chase, I should hate him,</div>
<div id="scene1.3.27">for my father hated his father dearly; yet I hate</div>
<div id="scene1.3.28">not Orlando.</div>
</div>
<div id="speech16" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.29">No, faith, hate him not, for my sake.</div>
</div>
<div id="speech17" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.30">Why should I not? doth he not deserve well?</div>
</div>
<div id="speech18" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.31">Let me love him for that, and do you love him</div>
<div id="scene1.3.32">because I do. Look, here comes the duke.</div>
</div>
<div id="speech19" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.33">With his eyes full of anger.</div>
<div class="direction">Enter DUKE FREDERICK, with Lords</div>
</div>
<div id="speech20" class="character">DUKE FREDERICK</div>
<div class="dialog">
<div id="scene1.3.34">Mistress, dispatch you with your safest haste</div>
<div id="scene1.3.35">And get you from our court.</div>
</div>
<div id="speech21" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.36">Me, uncle?</div>
</div>
<div id="speech22" class="character">DUKE FREDERICK</div>
<div class="dialog">
<div id="scene1.3.37">You, cousin</div>
<div id="scene1.3.38">Within these ten days if that thou be'st found</div>
<div id="scene1.3.39">So near our public court as twenty miles,</div>
<div id="scene1.3.40">Thou diest for it.</div>
</div>
<div id="speech23" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.41"> I do beseech your grace,</div>
<div id="scene1.3.42">Let me the knowledge of my fault bear with me:</div>
<div id="scene1.3.43">If with myself I hold intelligence</div>
<div id="scene1.3.44">Or have acquaintance with mine own desires,</div>
<div id="scene1.3.45">If that I do not dream or be not frantic,--</div>
<div id="scene1.3.46">As I do trust I am not--then, dear uncle,</div>
<div id="scene1.3.47">Never so much as in a thought unborn</div>
<div id="scene1.3.48">Did I offend your highness.</div>
</div>
<div id="speech24" class="character">DUKE FREDERICK</div>
<div class="dialog">
<div id="scene1.3.49">Thus do all traitors:</div>
<div id="scene1.3.50">If their purgation did consist in words,</div>
<div id="scene1.3.51">They are as innocent as grace itself:</div>
<div id="scene1.3.52">Let it suffice thee that I trust thee not.</div>
</div>
<div id="speech25" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.53">Yet your mistrust cannot make me a traitor:</div>
<div id="scene1.3.54">Tell me whereon the likelihood depends.</div>
</div>
<div id="speech26" class="character">DUKE FREDERICK</div>
<div class="dialog">
<div id="scene1.3.55">Thou art thy father's daughter; there's enough.</div>
</div>
<div id="speech27" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.56">So was I when your highness took his dukedom;</div>
<div id="scene1.3.57">So was I when your highness banish'd him:</div>
<div id="scene1.3.58">Treason is not inherited, my lord;</div>
<div id="scene1.3.59">Or, if we did derive it from our friends,</div>
<div id="scene1.3.60">What's that to me? my father was no traitor:</div>
<div id="scene1.3.61">Then, good my liege, mistake me not so much</div>
<div id="scene1.3.62">To think my poverty is treacherous.</div>
</div>
<div id="speech28" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.63">Dear sovereign, hear me speak.</div>
</div>
<div id="speech29" class="character">DUKE FREDERICK</div>
<div class="dialog">
<div id="scene1.3.64">Ay, Celia; we stay'd her for your sake,</div>
<div id="scene1.3.65">Else had she with her father ranged along.</div>
</div>
<div id="speech30" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.66">I did not then entreat to have her stay;</div>
<div id="scene1.3.67">It was your pleasure and your own remorse:</div>
<div id="scene1.3.68">I was too young that time to value her;</div>
<div id="scene1.3.69">But now I know her: if she be a traitor,</div>
<div id="scene1.3.70">Why so am I; we still have slept together,</div>
<div id="scene1.3.71">Rose at an instant, learn'd, play'd, eat together,</div>
<div id="scene1.3.72">And wheresoever we went, like Juno's swans,</div>
<div id="scene1.3.73">Still we went coupled and inseparable.</div>
</div>
<div id="speech31" class="character">DUKE FREDERICK</div>
<div class="dialog">
<div id="scene1.3.74">She is too subtle for thee; and her smoothness,</div>
<div id="scene1.3.75">Her very silence and her patience</div>
<div id="scene1.3.76">Speak to the people, and they pity her.</div>
<div id="scene1.3.77">Thou art a fool: she robs thee of thy name;</div>
<div id="scene1.3.78">And thou wilt show more bright and seem more virtuous</div>
<div id="scene1.3.79">When she is gone. Then open not thy lips:</div>
<div id="scene1.3.80">Firm and irrevocable is my doom</div>
<div id="scene1.3.81">Which I have pass'd upon her; she is banish'd.</div>
</div>
<div id="speech32" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.82">Pronounce that sentence then on me, my liege:</div>
<div id="scene1.3.83">I cannot live out of her company.</div>
</div>
<div id="speech33" class="character">DUKE FREDERICK</div>
<div class="dialog">
<div id="scene1.3.84">You are a fool. You, niece, provide yourself:</div>
<div id="scene1.3.85">If you outstay the time, upon mine honour,</div>
<div id="scene1.3.86">And in the greatness of my word, you die.</div>
<div class="direction">Exeunt DUKE FREDERICK and Lords</div>
</div>
<div id="speech34" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.87">O my poor Rosalind, whither wilt thou go?</div>
<div id="scene1.3.88">Wilt thou change fathers? I will give thee mine.</div>
<div id="scene1.3.89">I charge thee, be not thou more grieved than I am.</div>
</div>
<div id="speech35" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.90">I have more cause.</div>
</div>
<div id="speech36" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.91"> Thou hast not, cousin;</div>
<div id="scene1.3.92">Prithee be cheerful: know'st thou not, the duke</div>
<div id="scene1.3.93">Hath banish'd me, his daughter?</div>
</div>
<div id="speech37" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.94">That he hath not.</div>
</div>
<div id="speech38" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.95">No, hath not? Rosalind lacks then the love</div>
<div id="scene1.3.96">Which teacheth thee that thou and I am one:</div>
<div id="scene1.3.97">Shall we be sunder'd? shall we part, sweet girl?</div>
<div id="scene1.3.98">No: let my father seek another heir.</div>
<div id="scene1.3.99">Therefore devise with me how we may fly,</div>
<div id="scene1.3.100">Whither to go and what to bear with us;</div>
<div id="scene1.3.101">And do not seek to take your change upon you,</div>
<div id="scene1.3.102">To bear your griefs yourself and leave me out;</div>
<div id="scene1.3.103">For, by this heaven, now at our sorrows pale,</div>
<div id="scene1.3.104">Say what thou canst, I'll go along with thee.</div>
</div>
<div id="speech39" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.105">Why, whither shall we go?</div>
</div>
<div id="speech40" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.106">To seek my uncle in the forest of Arden.</div>
</div>
<div id="speech41" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.107">Alas, what danger will it be to us,</div>
<div id="scene1.3.108">Maids as we are, to travel forth so far!</div>
<div id="scene1.3.109">Beauty provoketh thieves sooner than gold.</div>
</div>
<div id="speech42" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.110">I'll put myself in poor and mean attire</div>
<div id="scene1.3.111">And with a kind of umber smirch my face;</div>
<div id="scene1.3.112">The like do you: so shall we pass along</div>
<div id="scene1.3.113">And never stir assailants.</div>
</div>
<div id="speech43" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.114">Were it not better,</div>
<div id="scene1.3.115">Because that I am more than common tall,</div>
<div id="scene1.3.116">That I did suit me all points like a man?</div>
<div id="scene1.3.117">A gallant curtle-axe upon my thigh,</div>
<div id="scene1.3.118">A boar-spear in my hand; and--in my heart</div>
<div id="scene1.3.119">Lie there what hidden woman's fear there will--</div>
<div id="scene1.3.120">We'll have a swashing and a martial outside,</div>
<div id="scene1.3.121">As many other mannish cowards have</div>
<div id="scene1.3.122">That do outface it with their semblances.</div>
</div>
<div id="speech44" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.123">What shall I call thee when thou art a man?</div>
</div>
<div id="speech45" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.124">I'll have no worse a name than Jove's own page;</div>
<div id="scene1.3.125">And therefore look you call me Ganymede.</div>
<div id="scene1.3.126">But what will you be call'd?</div>
</div>
<div id="speech46" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.127">Something that hath a reference to my state</div>
<div id="scene1.3.128">No longer Celia, but Aliena.</div>
</div>
<div id="speech47" class="character">ROSALIND</div>
<div class="dialog">
<div id="scene1.3.129">But, cousin, what if we assay'd to steal</div>
<div id="scene1.3.130">The clownish fool out of your father's court?</div>
<div id="scene1.3.131">Would he not be a comfort to our travel?</div>
</div>
<div id="speech48" class="character">CELIA</div>
<div class="dialog">
<div id="scene1.3.132">He'll go along o'er the wide world with me;</div>
<div id="scene1.3.133">Leave me alone to woo him. Let's away,</div>
<div id="scene1.3.134">And get our jewels and our wealth together,</div>
<div id="scene1.3.135">Devise the fittest time and safest way</div>
<div id="scene1.3.136">To hide us from pursuit that will be made</div>
<div id="scene1.3.137">After my flight. Now go we in content</div>
<div id="scene1.3.138">To liberty and not to banishment.</div>
<div class="direction">Exeunt</div>
</div>
</div>
</div>
<script type="text/javascript" charset="utf-8">
jQuery.benchmarker = {libraries: ["$", "jQuery"]};
</script>
<script src="benchmarker.js"></script>
</body>
</html>

2992
build/speed/jquery-1.2.1.js vendored Normal file

File diff suppressed because it is too large Load diff

2992
build/speed/jquery-basis.js vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,285 +0,0 @@
#! /usr/bin/env node
// -*- js -*-
global.sys = require(/^v0\.[012]/.test(process.version) ? "sys" : "util");
var fs = require("fs");
var jsp = require("./lib/parse-js"),
pro = require("./lib/process");
var options = {
ast: false,
mangle: true,
mangle_toplevel: false,
squeeze: true,
make_seqs: true,
dead_code: true,
verbose: false,
show_copyright: true,
out_same_file: false,
max_line_length: 32 * 1024,
unsafe: false,
reserved_names: null,
defines: { },
codegen_options: {
ascii_only: false,
beautify: false,
indent_level: 4,
indent_start: 0,
quote_keys: false,
space_colon: false
},
output: true // stdout
};
var args = jsp.slice(process.argv, 2);
var filename;
out: while (args.length > 0) {
var v = args.shift();
switch (v) {
case "-b":
case "--beautify":
options.codegen_options.beautify = true;
break;
case "-i":
case "--indent":
options.codegen_options.indent_level = args.shift();
break;
case "-q":
case "--quote-keys":
options.codegen_options.quote_keys = true;
break;
case "-mt":
case "--mangle-toplevel":
options.mangle_toplevel = true;
break;
case "--no-mangle":
case "-nm":
options.mangle = false;
break;
case "--no-squeeze":
case "-ns":
options.squeeze = false;
break;
case "--no-seqs":
options.make_seqs = false;
break;
case "--no-dead-code":
options.dead_code = false;
break;
case "--no-copyright":
case "-nc":
options.show_copyright = false;
break;
case "-o":
case "--output":
options.output = args.shift();
break;
case "--overwrite":
options.out_same_file = true;
break;
case "-v":
case "--verbose":
options.verbose = true;
break;
case "--ast":
options.ast = true;
break;
case "--unsafe":
options.unsafe = true;
break;
case "--max-line-len":
options.max_line_length = parseInt(args.shift(), 10);
break;
case "--reserved-names":
options.reserved_names = args.shift().split(",");
break;
case "-d":
case "--define":
var defarg = args.shift();
try {
var defsym = function(sym) {
// KEYWORDS_ATOM doesn't include NaN or Infinity - should we check
// for them too ?? We don't check reserved words and the like as the
// define values are only substituted AFTER parsing
if (jsp.KEYWORDS_ATOM.hasOwnProperty(sym)) {
throw "Don't define values for inbuilt constant '"+sym+"'";
}
return sym;
},
defval = function(v) {
if (v.match(/^"(.*)"$/) || v.match(/^'(.*)'$/)) {
return [ "string", RegExp.$1 ];
}
else if (!isNaN(parseFloat(v))) {
return [ "num", parseFloat(v) ];
}
else if (v.match(/^[a-z\$_][a-z\$_0-9]*$/i)) {
return [ "name", v ];
}
else if (!v.match(/"/)) {
return [ "string", v ];
}
else if (!v.match(/'/)) {
return [ "string", v ];
}
throw "Can't understand the specified value: "+v;
};
if (defarg.match(/^([a-z_\$][a-z_\$0-9]*)(=(.*))?$/i)) {
var sym = defsym(RegExp.$1),
val = RegExp.$2 ? defval(RegExp.$2.substr(1)) : [ 'name', 'true' ];
options.defines[sym] = val;
}
else {
throw "The --define option expects SYMBOL[=value]";
}
} catch(ex) {
sys.print("ERROR: In option --define "+defarg+"\n"+ex+"\n");
process.exit(1);
}
break;
case "--define-from-module":
var defmodarg = args.shift(),
defmodule = require(defmodarg),
sym,
val;
for (sym in defmodule) {
if (defmodule.hasOwnProperty(sym)) {
options.defines[sym] = function(val) {
if (typeof val == "string")
return [ "string", val ];
if (typeof val == "number")
return [ "num", val ];
if (val === true)
return [ 'name', 'true' ];
if (val === false)
return [ 'name', 'false' ];
if (val === null)
return [ 'name', 'null' ];
if (val === undefined)
return [ 'name', 'undefined' ];
sys.print("ERROR: In option --define-from-module "+defmodarg+"\n");
sys.print("ERROR: Unknown object type for: "+sym+"="+val+"\n");
process.exit(1);
return null;
}(defmodule[sym]);
}
}
break;
case "--ascii":
options.codegen_options.ascii_only = true;
break;
default:
filename = v;
break out;
}
}
if (options.verbose) {
pro.set_logger(function(msg){
sys.debug(msg);
});
}
jsp.set_logger(function(msg){
sys.debug(msg);
});
if (filename) {
fs.readFile(filename, "utf8", function(err, text){
if (err) throw err;
output(squeeze_it(text));
});
} else {
var stdin = process.openStdin();
stdin.setEncoding("utf8");
var text = "";
stdin.on("data", function(chunk){
text += chunk;
});
stdin.on("end", function() {
output(squeeze_it(text));
});
}
function output(text) {
var out;
if (options.out_same_file && filename)
options.output = filename;
if (options.output === true) {
out = process.stdout;
} else {
out = fs.createWriteStream(options.output, {
flags: "w",
encoding: "utf8",
mode: 0644
});
}
out.write(text);
if (options.output !== true) {
out.end();
}
};
// --------- main ends here.
function show_copyright(comments) {
var ret = "";
for (var i = 0; i < comments.length; ++i) {
var c = comments[i];
if (c.type == "comment1") {
ret += "//" + c.value + "\n";
} else {
ret += "/*" + c.value + "*/";
}
}
return ret;
};
function squeeze_it(code) {
var result = "";
if (options.show_copyright) {
var tok = jsp.tokenizer(code), c;
c = tok();
result += show_copyright(c.comments_before);
}
try {
var ast = time_it("parse", function(){ return jsp.parse(code); });
if (options.mangle) ast = time_it("mangle", function(){
return pro.ast_mangle(ast, {
toplevel: options.mangle_toplevel,
defines: options.defines,
except: options.reserved_names
});
});
if (options.squeeze) ast = time_it("squeeze", function(){
ast = pro.ast_squeeze(ast, {
make_seqs : options.make_seqs,
dead_code : options.dead_code,
keep_comps : !options.unsafe
});
if (options.unsafe)
ast = pro.ast_squeeze_more(ast);
return ast;
});
if (options.ast)
return sys.inspect(ast, null, null);
result += time_it("generate", function(){ return pro.gen_code(ast, options.codegen_options) });
if (!options.codegen_options.beautify && options.max_line_length) {
result = time_it("split", function(){ return pro.split_lines(result, options.max_line_length) });
}
return result;
} catch(ex) {
sys.debug(ex.stack);
sys.debug(sys.inspect(ex));
sys.debug(JSON.stringify(ex));
}
};
function time_it(name, cont) {
if (!options.verbose)
return cont();
var t1 = new Date().getTime();
try { return cont(); }
finally { sys.debug("// " + name + ": " + ((new Date().getTime() - t1) / 1000).toFixed(3) + " sec."); }
};

View file

@ -1,15 +0,0 @@
// Runs a function many times without the function call overhead
function benchmark(fn, times, name){
fn = fn.toString();
var s = fn.indexOf('{')+1,
e = fn.lastIndexOf('}');
fn = fn.substring(s,e);
return benchmarkString(fn, times, name);
}
function benchmarkString(fn, times, name) {
var fn = new Function("i", "var t=new Date; while(i--) {" + fn + "}; return new Date - t")(times)
fn.displayName = name || "benchmarked";
return fn;
}

View file

@ -1,39 +0,0 @@
<!doctype html>
<html>
<head>
<title>Test .closest() Performance</title>
<script src="benchmark.js"></script>
<script src="jquery-basis.js"></script>
<script>var old = jQuery.noConflict(true);</script>
<script src="../dist/jquery.js"></script>
<script>
jQuery(function ready() {
var node = $("#child"), name;
jQuery.each([".zoo", "#zoo", "[data-foo=zoo]", "#nonexistant"], function(i, item) {
setTimeout(function(){
name = "closest '" + item + "'";
jQuery("#results").append("<li>" + name + "<ul>" +
"<li>new: " + benchmarkString("$('#child').closest('" + item + "')", 2500, name) + "</li>" +
"<li>old: " + benchmarkString("old('#child').closest('" + item + "')", 2500, name) + "</li>"
+ "</ul></li>");
}, 100);
});
});
</script>
</head>
<body>
<div>
<p>Hello</p>
<div class="zoo" id="zoo" data-foo="bar">
<div>
<p id="child">lorem ipsum</p>
<p>dolor sit amet</p>
</div>
</div>
</div>
<ul id="results"></ul>
</body>
</html>

View file

@ -1,82 +0,0 @@
<!doctype html>
<html>
<head>
<title>Test Event Handling Performance</title>
<script src="benchmark.js"></script>
<script src="jquery-basis.js"></script>
<script>var old = jQuery.noConflict(true);</script>
<script src="../dist/jquery.js"></script>
<script>
var num = 400;
jQuery(function(){
var p = old("p");
var s = (new Date).getTime();
for ( var n = 0; n < 5; n++ ) {
for ( var i = 0; i < num; i++ ) {
p.css("position");
p.css("top");
p.css("left");
p.css("display");
}
}
var oldNum = (new Date).getTime() - s;
p = jQuery("p");
s = (new Date).getTime();
for ( var n = 0; n < 5; n++ ) {
for ( var i = 0; i < num; i++ ) {
p.css("position");
p.css("top");
p.css("left");
p.css("display");
}
}
var curNum = (new Date).getTime() - s;
jQuery("#num").text( old.fn.jquery + ": " + oldNum + " " + jQuery.fn.jquery + ": " + curNum );
});
jQuery(function(){
var p = old("p");
var s = (new Date).getTime();
for ( var n = 0; n < 5; n++ ) {
for ( var i = 0; i < num; i++ ) {
p.css("position", "relative");
p.css("top", 15);
p.css("left", 15);
p.css("display", "block");
}
}
var oldNum = (new Date).getTime() - s;
p = jQuery("p");
s = (new Date).getTime();
for ( var n = 0; n < 5; n++ ) {
for ( var i = 0; i < num; i++ ) {
p.css("position", "relative");
p.css("top", 15);
p.css("left", 15);
p.css("display", "block");
}
}
var curNum = (new Date).getTime() - s;
jQuery("#num2").text( old.fn.jquery + ": " + oldNum + " " + jQuery.fn.jquery + ": " + curNum );
});
</script>
<style>p { position: absolute; top: 5px; left: 5px; }</style>
</head>
<body>
<p><strong>Getting Values:</strong> <span id="num">Loading...</span></p>
<p><strong>Setting Values:</strong> <span id="num2">Loading...</span></p>
</body>
</html>

View file

@ -1,58 +0,0 @@
<!doctype html>
<html>
<head>
<title>Test Event Handling Performance</title>
<script src="benchmark.js"></script>
<script src="jquery-basis.js"></script>
<script>var old = jQuery.noConflict(true);</script>
<script src="../dist/jquery.js"></script>
<script>
jQuery(function(){
});
var events = [], num = 400, exec = false;
jQuery(document).mousemove(function(e){
if ( exec ) {
return;
}
if ( events.length >= num ) {
exec = true;
var s = (new Date).getTime();
for ( var n = 0; n < 5; n++ ) {
for ( var i = 0; i < num; i++ ) {
old.event.handle.call( document, events[i] );
}
}
var oldNum = (new Date).getTime() - s;
s = (new Date).getTime();
for ( var n = 0; n < 5; n++ ) {
for ( var i = 0; i < num; i++ ) {
jQuery.event.handle.call( document, events[i] );
}
}
var curNum = (new Date).getTime() - s;
jQuery("#num").text( old.fn.jquery + ": " + oldNum + " " + jQuery.fn.jquery + ": " + curNum );
jQuery(this).unbind( "mousemove", e.handler );
} else {
events.push( e.originalEvent );
jQuery("#num").text( events.length + " / " + num );
}
});
</script>
</head>
<body>
<p>Move the mouse, please!</p>
<p id="num"></p>
</body>
</html>

View file

@ -1,183 +0,0 @@
<!doctype html>
<html>
<head>
<title>Test .filter() Performance</title>
<script src="benchmark.js"></script>
<script src="jquery-basis.js"></script>
<script>var old = jQuery.noConflict(true);</script>
<script src="../dist/jquery.js"></script>
<script>
jQuery(function ready() {
var node = $("#child"), name;
jQuery.each([".zoo", "#zoo", "[data-foo=zoo]", "#nonexistant"], function(i, item) {
setTimeout(function(){
name = "filter '" + item + "'";
jQuery("#results").append("<li>" + name + "<ul>" +
"<li>new: " + benchmarkString("$('div').filter('" + item + "')", 100, name) + "</li>" +
"<li>old: " + benchmarkString("old('div').filter('" + item + "')", 100, name) + "</li>" +
"</ul></li>");
jQuery("#results").append("<li>single " + name + "<ul>" +
"<li>new: " + benchmarkString("$('#nonexistant').filter('" + item + "')", 1000, name) + "</li>" +
"<li>old: " + benchmarkString("old('#nonexistant').filter('" + item + "')", 1000, name) + "</li>" +
"</ul></li>");
}, 100);
});
});
</script>
</head>
<body>
<div>
<p>Hello</p>
<div class="zoo" id="nonexistant" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
</div>
<ul id="results"></ul>
</body>
</html>

View file

@ -1,179 +0,0 @@
<!doctype html>
<html>
<head>
<title>Test .find() Performance</title>
<script src="benchmark.js"></script>
<script src="jquery-basis.js"></script>
<script>var old = jQuery.noConflict(true);</script>
<script src="../dist/jquery.js"></script>
<script>
jQuery(function ready() {
var node = $("#child"), name;
jQuery.each([".zoo", "#zoo", "[data-foo=zoo]", "#nonexistant"], function(i, item) {
setTimeout(function(){
name = "find '" + item + "'";
jQuery("#results").append("<li>rooted " + name + "<ul>" +
"<li>new: " + benchmarkString("$('body').find('" + item + "')", 250, name) + "</li>" +
"<li>old: " + benchmarkString("old('body').find('" + item + "')", 250, name) + "</li>" +
"</ul></li>");
}, 100);
});
});
</script>
</head>
<body>
<div>
<p>Hello</p>
<div class="zoo" id="nonexistant" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
<div class="zoo" id="zoo" data-foo="bar"><div></div></div>
</div>
<ul id="results"></ul>
</body>
</html>

File diff suppressed because one or more lines are too long

6238
speed/jquery-basis.js vendored

File diff suppressed because it is too large Load diff

View file

@ -1,47 +0,0 @@
<script type="text/javascript">
(function(){
// Conclusions:
// slice() is a little faster than concat() except on Chrome
// This clone() is slower on FF & IE but takes 50% on Safari & Chrome
var SIZE = 1e4,
LOOPS = 500;
var arr = new Array(SIZE);
for ( var i=arr.length-1; i >= 0; --i )
arr[i] = 0;
var t = new Date;
for ( i=0; i < LOOPS; i++ )
arr.slice(0);
var tslice = new Date - t;
t = new Date;
for ( i=0; i < LOOPS; i++ )
arr.concat();
var tconcat = new Date - t;
// clone() is just to see how fast built-ins are
t = new Date;
for ( i=0; i < LOOPS; i++ )
clone(arr);
var tclone = new Date - t;
alert([
'slice:'+tslice,
'concat:'+tconcat,
'clone:'+tclone
].join('\n'));
function clone(arr){
var i = arr.length,
copy = new Array(i);
while (i--)
copy[i] = arr[i];
return copy;
}
})();
</script>

File diff suppressed because it is too large Load diff

View file

@ -1,79 +0,0 @@
(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 = s.contentType === "application/x-www-form-urlencoded" &&
( typeof s.data === "string" );
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 );

View file

@ -1,89 +0,0 @@
(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 );

View file

@ -1,218 +0,0 @@
(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;
}
responses.text = xhr.responseText;
// 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 );

View file

@ -1,630 +0,0 @@
(function( jQuery ) {
var rclass = /[\n\t\r]/g,
rspace = /\s+/,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
rinvalidChar = /\:|^on/,
formHook, boolHook;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.attr );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classNames, i, l, elem, className, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
classNames = (value || "").split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
className = (" " + elem.className + " ").replace( rclass, " " );
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[ c ] + " ", " ");
}
elem.className = jQuery.trim( className );
} else {
elem.className = "";
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ";
for ( var i = 0, l = this.length; i < l; i++ ) {
if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return undefined;
}
var isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var self = jQuery(this), val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value,
index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type === "select-one";
// Nothing was selected
if ( index < 0 ) {
return null;
}
// Loop through all the selected options
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
if ( one && !values.length && options.length ) {
return jQuery( options[ index ] ).val();
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attrFn: {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
height: true,
offset: true
},
attrFix: {
// Always normalize to ensure hook usage
tabindex: "tabIndex"
},
attr: function( elem, name, value, pass ) {
var nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
}
if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( !("getAttribute" in elem) ) {
return jQuery.prop( elem, name, value );
}
var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// Normalize the name if needed
if ( notxml ) {
name = jQuery.attrFix[ name ] || name;
hooks = jQuery.attrHooks[ name ];
if ( !hooks ) {
// Use boolHook for boolean attributes
if ( rboolean.test( name ) ) {
hooks = boolHook;
// Use formHook for forms and if the name contains certain characters
} else if ( formHook && name !== "className" &&
(jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
hooks = formHook;
}
}
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return undefined;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, "" + value );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, name ) {
var propName;
if ( elem.nodeType === 1 ) {
name = jQuery.attrFix[ name ] || name;
if ( jQuery.support.getSetAttribute ) {
// Use removeAttribute in browsers that support it
elem.removeAttribute( name );
} else {
jQuery.attr( elem, name, "" );
elem.removeAttributeNode( elem.getAttributeNode( name ) );
}
// Set corresponding property to false for boolean attributes
if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
elem[ propName ] = false;
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabIndex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
},
// Use the value property for back compat
// Use the formHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( formHook && jQuery.nodeName( elem, "button" ) ) {
return formHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( formHook && jQuery.nodeName( elem, "button" ) ) {
return formHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
}
var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return (elem[ name ] = value);
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {}
});
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
return jQuery.prop( elem, name ) ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !jQuery.support.getSetAttribute ) {
// propFix is more comprehensive and contains all fixes
jQuery.attrFix = jQuery.propFix;
// Use this for any attribute on a form in IE6/7
formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
// Return undefined if nodeValue is empty string
return ret && ret.nodeValue !== "" ?
ret.nodeValue :
undefined;
},
set: function( elem, value, name ) {
// Check form objects in IE (multiple bugs related)
// Only use nodeValue if the attribute node exists on the form
var ret = elem.getAttributeNode( name );
if ( ret ) {
ret.nodeValue = value;
return value;
}
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return (elem.style.cssText = "" + value);
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
}
});
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
}
}
});
});
})( jQuery );

File diff suppressed because it is too large Load diff

View file

@ -1,372 +0,0 @@
(function( jQuery ) {
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
rrelNum = /^[+\-]=/,
rrelNumFilter = /[^+\-\.\de]+/g,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssWidth = [ "Left", "Right" ],
cssHeight = [ "Top", "Bottom" ],
curCSS,
getComputedStyle,
currentStyle;
jQuery.fn.css = function( name, value ) {
// Setting 'undefined' is a no-op
if ( arguments.length === 2 && value === undefined ) {
return this;
}
return jQuery.access( this, name, value, true, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
});
};
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", "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;
// Make sure that NaN and null values aren't set. See: #7116
if ( type === "number" && isNaN( value ) || value == null ) {
return;
}
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && rrelNum.test( value ) ) {
value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// 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 = {};
// Remember the old values, and insert the new ones
for ( var name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
}
});
// DEPRECATED, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
jQuery.each(["height", "width"], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
var val;
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
return getWH( elem, name, extra );
} else {
jQuery.swap( elem, cssShow, function() {
val = getWH( elem, name, extra );
});
}
return val;
}
},
set: function( elem, value ) {
if ( rnumpx.test( value ) ) {
// ignore negative width and height values #1599
value = parseFloat( value );
if ( value >= 0 ) {
return value + "px";
}
} else {
return 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;
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// Set the alpha filter to set the opacity
var opacity = jQuery.isNaN( value ) ?
"" :
"alpha(opacity=" + value * 100 + ")",
filter = currentStyle && currentStyle.filter || style.filter || "";
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
var ret;
jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
ret = curCSS( elem, "margin-right", "marginRight" );
} else {
ret = elem.style.marginRight;
}
});
return ret;
}
};
}
});
if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, name ) {
var ret, defaultView, computedStyle;
name = name.replace( rupper, "-$1" ).toLowerCase();
if ( !(defaultView = elem.ownerDocument.defaultView) ) {
return undefined;
}
if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
}
return ret;
};
}
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left,
ret = elem.currentStyle && elem.currentStyle[ name ],
rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
style = elem.style;
// 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 ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
// Remember the original values
left = style.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 || 0);
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 getWH( elem, name, extra ) {
// Start with offset property
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
which = name === "width" ? cssWidth : cssHeight;
if ( val > 0 ) {
if ( extra !== "border" ) {
jQuery.each( which, function() {
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
});
}
return val + "px";
}
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ] || 0;
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Add padding, border, margin
if ( extra ) {
jQuery.each( which, function() {
val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
if ( extra !== "padding" ) {
val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
}
});
}
return val + "px";
}
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.display || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
})( jQuery );

View file

@ -1,328 +0,0 @@
(function( jQuery ) {
var rbrace = /^(?:\{.*\}|\[.*\])$/,
rmultiDash = /([a-z])([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 internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
// 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[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
// 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 || (pvt && id && !cache[ id ][ internalKey ])) && 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[ jQuery.expando ] = id = ++jQuery.uuid;
} else {
id = jQuery.expando;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// TODO: This is a hack for 1.5 ONLY. 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 ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
} else {
cache[ id ] = jQuery.extend(cache[ id ], name);
}
}
thisCache = cache[ id ];
// Internal jQuery data is stored in a separate object inside the object's data
// cache in order to avoid key collisions between internal data and user-defined
// data
if ( pvt ) {
if ( !thisCache[ internalKey ] ) {
thisCache[ internalKey ] = {};
}
thisCache = thisCache[ internalKey ];
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
// not attempt to inspect the internal events object using jQuery.data, as this
// internal data object is undocumented and subject to change.
if ( name === "events" && !thisCache[name] ) {
return thisCache[ internalKey ] && thisCache[ internalKey ].events;
}
return getByName ?
// Check for both converted-to-camel and non-converted data property names
thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
thisCache;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var 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[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
if ( thisCache ) {
delete thisCache[ name ];
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !isEmptyDataObject(thisCache) ) {
return;
}
}
}
// See jQuery.data for more information
if ( pvt ) {
delete cache[ id ][ internalKey ];
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject(cache[ id ]) ) {
return;
}
}
var internalCache = cache[ id ][ internalKey ];
// 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
if ( jQuery.support.deleteExpando || cache != window ) {
delete cache[ id ];
} else {
cache[ id ] = null;
}
// We destroyed the entire user cache at once because it's faster than
// iterating through each key, but we need to continue to persist internal
// data if it existed
if ( internalCache ) {
cache[ id ] = {};
// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
// metadata on plain JS objects when the object is serialized using
// JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
cache[ id ][ internalKey ] = internalCache;
// Otherwise, we need to eliminate the expando on the node to avoid
// false lookups in the cache for entries that no longer exist
} else 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[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
} else {
elem[ jQuery.expando ] = 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 data = null;
if ( typeof key === "undefined" ) {
if ( this.length ) {
data = jQuery.data( this[0] );
if ( this[0].nodeType === 1 ) {
var attr = this[0].attributes, name;
for ( var i = 0, l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( this[0], name, data[ name ] );
}
}
}
}
return data;
} else if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
// Try to fetch any internally stored data first
if ( data === undefined && this.length ) {
data = jQuery.data( this[0], key );
data = dataAttr( this[0], key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
} else {
return this.each(function() {
var $this = jQuery( this ),
args = [ parts[0], value ];
$this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
$this.triggerHandler( "changeData" + parts[1] + "!", args );
});
}
},
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-$2" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
!jQuery.isNaN( data ) ? parseFloat( 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;
}
// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
// property to be considered empty objects; this property always exists in
// order to make sure JSON.stringify does not expose internal metadata
function isEmptyDataObject( obj ) {
for ( var name in obj ) {
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
})( jQuery );

View file

@ -1,199 +0,0 @@
(function( jQuery ) {
var // Promise methods
promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
// Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({
// Create a simple deferred (one callbacks list)
_Deferred: function() {
var // callbacks list
callbacks = [],
// stored [ context , args ]
fired,
// to avoid firing when already doing so
firing,
// flag to know if the deferred has been cancelled
cancelled,
// the deferred itself
deferred = {
// done( f1, f2, ...)
done: function() {
if ( !cancelled ) {
var args = arguments,
i,
length,
elem,
type,
_fired;
if ( fired ) {
_fired = fired;
fired = 0;
}
for ( i = 0, length = args.length; i < length; i++ ) {
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
deferred.done.apply( deferred, elem );
} else if ( type === "function" ) {
callbacks.push( elem );
}
}
if ( _fired ) {
deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
}
}
return this;
},
// resolve with given context and args
resolveWith: function( context, args ) {
if ( !cancelled && !fired && !firing ) {
// make sure args are available (#8421)
args = args || [];
firing = 1;
try {
while( callbacks[ 0 ] ) {
callbacks.shift().apply( context, args );
}
}
finally {
fired = [ context, args ];
firing = 0;
}
}
return this;
},
// resolve with this as context and given arguments
resolve: function() {
deferred.resolveWith( this, arguments );
return this;
},
// Has this deferred been resolved?
isResolved: function() {
return !!( firing || fired );
},
// Cancel
cancel: function() {
cancelled = 1;
callbacks = [];
return this;
}
};
return deferred;
},
// Full fledged deferred (two callbacks list)
Deferred: function( func ) {
var deferred = jQuery._Deferred(),
failDeferred = jQuery._Deferred(),
promise;
// Add errorDeferred methods, then and promise
jQuery.extend( deferred, {
then: function( doneCallbacks, failCallbacks ) {
deferred.done( doneCallbacks ).fail( failCallbacks );
return this;
},
always: function() {
return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
},
fail: failDeferred.done,
rejectWith: failDeferred.resolveWith,
reject: failDeferred.resolve,
isRejected: failDeferred.isResolved,
pipe: function( fnDone, fnFail ) {
return jQuery.Deferred(function( newDefer ) {
jQuery.each( {
done: [ fnDone, "resolve" ],
fail: [ fnFail, "reject" ]
}, 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 );
} 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 ) {
if ( promise ) {
return promise;
}
promise = obj = {};
}
var i = promiseMethods.length;
while( i-- ) {
obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
}
return obj;
}
});
// Make sure only one callback list will be used
deferred.done( failDeferred.cancel ).fail( deferred.cancel );
// Unexpose cancel
delete deferred.cancel;
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
return deferred;
},
// Deferred helper
when: function( firstParam ) {
var args = arguments,
i = 0,
length = args.length,
count = length,
deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
firstParam :
jQuery.Deferred();
function resolveFunc( i ) {
return function( value ) {
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
if ( !( --count ) ) {
// Strange bug in FF4:
// Values changed onto the arguments object sometimes end up as undefined values
// outside the $.when method. Cloning the object into a fresh array solves the issue
deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
}
};
}
if ( length > 1 ) {
for( ; i < length; i++ ) {
if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
args[ i ].promise().then( resolveFunc(i), deferred.reject );
} else {
--count;
}
}
if ( !count ) {
deferred.resolveWith( deferred, args );
}
} else if ( deferred !== firstParam ) {
deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
}
return deferred.promise();
}
});
})( jQuery );

View file

@ -1,69 +0,0 @@
(function( jQuery ) {
// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {
var type = name.toLowerCase();
// innerHeight and innerWidth
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem && elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
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" ) ) :
null;
};
jQuery.fn[ type ] = function( size ) {
// Get window width or height
var elem = this[0];
if ( !elem ) {
return size == null ? null : this;
}
if ( jQuery.isFunction( size ) ) {
return this.each(function( i ) {
var self = jQuery( this );
self[ type ]( size.call( this, i, self[ type ]() ) );
});
}
if ( jQuery.isWindow( elem ) ) {
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
var docElemProp = elem.document.documentElement[ "client" + name ];
return elem.document.compatMode === "CSS1Compat" && docElemProp ||
elem.document.body[ "client" + name ] || docElemProp;
// Get document width or height
} else if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
return Math.max(
elem.documentElement["client" + name],
elem.body["scroll" + name], elem.documentElement["scroll" + name],
elem.body["offset" + name], elem.documentElement["offset" + name]
);
// Get or set width or height on the element
} else if ( size === undefined ) {
var orig = jQuery.css( elem, type ),
ret = parseFloat( orig );
return jQuery.isNaN( ret ) ? orig : ret;
// Set the width or height on the element (default to pixels if value is unitless)
} else {
return this.css( type, typeof size === "string" ? size : size + "px" );
}
};
});
})( jQuery );

619
src/effects.js vendored
View file

@ -1,619 +0,0 @@
(function( jQuery ) {
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
// width animations
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
],
fxNow,
requestAnimationFrame = window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback);
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = elem.style.display;
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
display = elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = elem.style.display;
if ( display === "" || display === "none" ) {
elem.style.display = jQuery._data(elem, "olddisplay") || "";
}
}
}
return this;
}
},
hide: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
return this.animate( genFx("hide", 3), speed, easing, callback);
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
if ( this[i].style ) {
var display = jQuery.css( this[i], "display" );
if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
jQuery._data( this[i], "olddisplay", display );
}
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
if ( this[i].style ) {
this[i].style.display = "none";
}
}
return this;
}
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2, callback ) {
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
this._toggle.apply( this, arguments );
} else if ( fn == null || bool ) {
this.each(function() {
var state = bool ? fn : jQuery(this).is(":hidden");
jQuery(this)[ state ? "show" : "hide" ]();
});
} else {
this.animate(genFx("toggle", 3), fn, fn2, callback);
}
return this;
},
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed(speed, easing, callback);
if ( jQuery.isEmptyObject( prop ) ) {
return this.each( optall.complete, [ false ] );
}
// Do not change referenced properties as per-property easing will be lost
prop = jQuery.extend( {}, prop );
return this[ optall.queue === false ? "each" : "queue" ](function() {
// XXX 'this' does not always have a nodeName when running the
// test suite
if ( optall.queue === false ) {
jQuery._mark( this );
}
var opt = jQuery.extend( {}, optall ),
isElement = this.nodeType === 1,
hidden = isElement && jQuery(this).is(":hidden"),
name, val, p,
display, e,
parts, start, end, unit;
// will store per property easing and be used to determine when an animation is complete
opt.animatedProperties = {};
for ( p in prop ) {
// property name normalization
name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
delete prop[ p ];
}
val = prop[ name ];
// easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
if ( jQuery.isArray( val ) ) {
opt.animatedProperties[ name ] = val[ 1 ];
val = prop[ name ] = val[ 0 ];
} else {
opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
}
if ( val === "hide" && hidden || val === "show" && !hidden ) {
return opt.complete.call( this );
}
if ( isElement && ( name === "height" || name === "width" ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height
// animated
if ( jQuery.css( this, "display" ) === "inline" &&
jQuery.css( this, "float" ) === "none" ) {
if ( !jQuery.support.inlineBlockNeedsLayout ) {
this.style.display = "inline-block";
} else {
display = defaultDisplay( this.nodeName );
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( display === "inline" ) {
this.style.display = "inline-block";
} else {
this.style.display = "inline";
this.style.zoom = 1;
}
}
}
}
}
if ( opt.overflow != null ) {
this.style.overflow = "hidden";
}
for ( p in prop ) {
e = new jQuery.fx( this, opt, p );
val = prop[ p ];
if ( rfxtypes.test(val) ) {
e[ val === "toggle" ? hidden ? "show" : "hide" : val ]();
} else {
parts = rfxnum.exec( val );
start = e.cur();
if ( parts ) {
end = parseFloat( parts[2] );
unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" ) {
jQuery.style( this, p, (end || 1) + unit);
start = ((end || 1) / e.cur()) * start;
jQuery.style( this, p, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] ) {
end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
}
e.custom( start, end, unit );
} else {
e.custom( start, val, "" );
}
}
}
// For JS strict compliance
return true;
});
},
stop: function( clearQueue, gotoEnd ) {
if ( clearQueue ) {
this.queue([]);
}
this.each(function() {
var timers = jQuery.timers,
i = timers.length;
// clear marker counters if we know they won't be
if ( !gotoEnd ) {
jQuery._unmark( true, this );
}
while ( i-- ) {
if ( timers[i].elem === this ) {
if (gotoEnd) {
// force the next step to be the last
timers[i](true);
}
timers.splice(i, 1);
}
}
});
// start the next in the queue if the last step wasn't forced
if ( !gotoEnd ) {
this.dequeue();
}
return this;
}
});
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout( clearFxNow, 0 );
return ( fxNow = jQuery.now() );
}
function clearFxNow() {
fxNow = undefined;
}
// Generate parameters to create a standard animation
function genFx( type, num ) {
var obj = {};
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
obj[ this ] = type;
});
return obj;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show", 1),
slideUp: genFx("hide", 1),
slideToggle: genFx("toggle", 1),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.extend({
speed: function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
// Queueing
opt.old = opt.complete;
opt.complete = function( noUnmark ) {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue !== false ) {
jQuery.dequeue( this );
} else if ( noUnmark !== false ) {
jQuery._unmark( this );
}
};
return opt;
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
},
swing: function( p, n, firstNum, diff ) {
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
}
},
timers: [],
fx: function( elem, options, prop ) {
this.options = options;
this.elem = elem;
this.prop = prop;
options.orig = options.orig || {};
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
},
// Get the current size
cur: function() {
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
return this.elem[ this.prop ];
}
var parsed,
r = jQuery.css( this.elem, this.prop );
// Empty strings, null, undefined and "auto" are converted to 0,
// complex values such as "rotate(1rad)" are returned as is,
// simple values such as "10px" are parsed to Float.
return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
},
// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
fx = jQuery.fx,
raf;
this.startTime = fxNow || createFxNow();
this.start = from;
this.end = to;
this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
this.now = this.start;
this.pos = this.state = 0;
function t( gotoEnd ) {
return self.step(gotoEnd);
}
t.elem = this.elem;
if ( t() && jQuery.timers.push(t) && !timerId ) {
// Use requestAnimationFrame instead of setInterval if available
if ( requestAnimationFrame ) {
timerId = true;
raf = function() {
// When timerId gets set to null at any point, this stops
if ( timerId ) {
requestAnimationFrame( raf );
fx.tick();
}
};
requestAnimationFrame( raf );
} else {
timerId = setInterval( fx.tick, fx.interval );
}
}
},
// Simple 'show' function
show: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any
// flash of content
this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
// Start by showing the element
jQuery( this.elem ).show();
},
// Simple 'hide' function
hide: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.hide = true;
// Begin the animation
this.custom(this.cur(), 0);
},
// Each step of an animation
step: function( gotoEnd ) {
var t = fxNow || createFxNow(),
done = true,
elem = this.elem,
options = this.options,
i, n;
if ( gotoEnd || t >= options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
options.animatedProperties[ this.prop ] = true;
for ( i in options.animatedProperties ) {
if ( options.animatedProperties[i] !== true ) {
done = false;
}
}
if ( done ) {
// Reset the overflow
if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
jQuery.each( [ "", "X", "Y" ], function (index, value) {
elem.style[ "overflow" + value ] = options.overflow[index];
});
}
// Hide the element if the "hide" operation was done
if ( options.hide ) {
jQuery(elem).hide();
}
// Reset the properties, if the item has been hidden or shown
if ( options.hide || options.show ) {
for ( var p in options.animatedProperties ) {
jQuery.style( elem, p, options.orig[p] );
}
}
// Execute the complete function
options.complete.call( elem );
}
return false;
} else {
// classical easing cannot be used with an Infinity duration
if ( options.duration == Infinity ) {
this.now = t;
} else {
n = t - this.startTime;
this.state = n / options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[ options.animatedProperties[ this.prop ] ]( this.state, n, 0, 1, options.duration );
this.now = this.start + ((this.end - this.start) * this.pos);
}
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.extend( jQuery.fx, {
tick: function() {
for ( var timers = jQuery.timers, i = 0 ; i < timers.length ; ++i ) {
if ( !timers[i]() ) {
timers.splice(i--, 1);
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
},
interval: 13,
stop: function() {
clearInterval( timerId );
timerId = null;
},
speeds: {
slow: 600,
fast: 200,
// Default speed
_default: 400
},
step: {
opacity: function( fx ) {
jQuery.style( fx.elem, "opacity", fx.now );
},
_default: function( fx ) {
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
} else {
fx.elem[ fx.prop ] = fx.now;
}
}
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
// Try to restore the default display value of an element
function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
var body = document.body,
elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
display = elem.css( "display" );
elem.remove();
// If the simple way fails,
// get element's real default display by attaching it to a temp iframe
if ( display === "none" || display === "" ) {
// No iframe to use yet, so create it
if ( !iframe ) {
iframe = document.createElement( "iframe" );
iframe.frameBorder = iframe.width = iframe.height = 0;
}
body.appendChild( iframe );
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
iframeDoc.close();
}
elem = iframeDoc.createElement( nodeName );
iframeDoc.body.appendChild( elem );
display = jQuery.css( elem, "display" );
body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return elemdisplay[ nodeName ];
}
})( jQuery );

File diff suppressed because it is too large Load diff

421
src/fx.js Normal file
View file

@ -0,0 +1,421 @@
jQuery.fn.extend({
show: function(speed,callback){
return speed ?
this.animate({
height: "show", width: "show", opacity: "show"
}, speed, callback) :
this.filter(":hidden").each(function(){
this.style.display = this.oldblock || "";
if ( jQuery.css(this,"display") == "none" ) {
var elem = jQuery("<" + this.tagName + " />").appendTo("body");
this.style.display = elem.css("display");
// handle an edge condition where css is - div { display:none; } or similar
if (this.style.display == "none")
this.style.display = "block";
elem.remove();
}
}).end();
},
hide: function(speed,callback){
return speed ?
this.animate({
height: "hide", width: "hide", opacity: "hide"
}, speed, callback) :
this.filter(":visible").each(function(){
this.oldblock = this.oldblock || jQuery.css(this,"display");
this.style.display = "none";
}).end();
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2 ){
return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
this._toggle( fn, fn2 ) :
fn ?
this.animate({
height: "toggle", width: "toggle", opacity: "toggle"
}, fn, fn2) :
this.each(function(){
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
});
},
slideDown: function(speed,callback){
return this.animate({height: "show"}, speed, callback);
},
slideUp: function(speed,callback){
return this.animate({height: "hide"}, speed, callback);
},
slideToggle: function(speed, callback){
return this.animate({height: "toggle"}, speed, callback);
},
fadeIn: function(speed, callback){
return this.animate({opacity: "show"}, speed, callback);
},
fadeOut: function(speed, callback){
return this.animate({opacity: "hide"}, speed, callback);
},
fadeTo: function(speed,to,callback){
return this.animate({opacity: to}, speed, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed(speed, easing, callback);
return this[ optall.queue === false ? "each" : "queue" ](function(){
if ( this.nodeType != 1)
return false;
var opt = jQuery.extend({}, optall);
var hidden = jQuery(this).is(":hidden"), self = this;
for ( var p in prop ) {
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
if ( p == "height" || p == "width" ) {
// Store display property
opt.display = jQuery.css(this, "display");
// Make sure that nothing sneaks out
opt.overflow = this.style.overflow;
}
}
if ( opt.overflow != null )
this.style.overflow = "hidden";
opt.curAnim = jQuery.extend({}, prop);
jQuery.each( prop, function(name, val){
var e = new jQuery.fx( self, opt, name );
if ( /toggle|show|hide/.test(val) )
e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
else {
var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
start = e.cur(true) || 0;
if ( parts ) {
var end = parseFloat(parts[2]),
unit = parts[3] || "px";
// We need to compute starting value
if ( unit != "px" ) {
self.style[ name ] = (end || 1) + unit;
start = ((end || 1) / e.cur(true)) * start;
self.style[ name ] = start + unit;
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] )
end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
e.custom( start, end, unit );
} else
e.custom( start, val, "" );
}
});
// For JS strict compliance
return true;
});
},
queue: function(type, fn){
if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
fn = type;
type = "fx";
}
if ( !type || (typeof type == "string" && !fn) )
return queue( this[0], type );
return this.each(function(){
if ( fn.constructor == Array )
queue(this, type, fn);
else {
queue(this, type).push( fn );
if ( queue(this, type).length == 1 )
fn.apply(this);
}
});
},
stop: function(clearQueue, gotoEnd){
var timers = jQuery.timers;
if (clearQueue)
this.queue([]);
this.each(function(){
// go in reverse order so anything added to the queue during the loop is ignored
for ( var i = timers.length - 1; i >= 0; i-- )
if ( timers[i].elem == this ) {
if (gotoEnd)
// force the next step to be the last
timers[i](true);
timers.splice(i, 1);
}
});
// start the next in the queue if the last step wasn't forced
if (!gotoEnd)
this.dequeue();
return this;
}
});
var queue = function( elem, type, array ) {
if ( !elem )
return undefined;
type = type || "fx";
var q = jQuery.data( elem, type + "queue" );
if ( !q || array )
q = jQuery.data( elem, type + "queue",
array ? jQuery.makeArray(array) : [] );
return q;
};
jQuery.fn.dequeue = function(type){
type = type || "fx";
return this.each(function(){
var q = queue(this, type);
q.shift();
if ( q.length )
q[0].apply( this );
});
};
jQuery.extend({
speed: function(speed, easing, fn) {
var opt = speed && speed.constructor == Object ? speed : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && easing.constructor != Function && easing
};
opt.duration = (opt.duration && opt.duration.constructor == Number ?
opt.duration :
{ slow: 600, fast: 200 }[opt.duration]) || 400;
// Queueing
opt.old = opt.complete;
opt.complete = function(){
if ( opt.queue !== false )
jQuery(this).dequeue();
if ( jQuery.isFunction( opt.old ) )
opt.old.apply( this );
};
return opt;
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
},
swing: function( p, n, firstNum, diff ) {
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
}
},
timers: [],
timerId: null,
fx: function( elem, options, prop ){
this.options = options;
this.elem = elem;
this.prop = prop;
if ( !options.orig )
options.orig = {};
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function(){
if ( this.options.step )
this.options.step.apply( this.elem, [ this.now, this ] );
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
// Set display property to block for height/width animations
if ( this.prop == "height" || this.prop == "width" )
this.elem.style.display = "block";
},
// Get the current size
cur: function(force){
if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
return this.elem[ this.prop ];
var r = parseFloat(jQuery.css(this.elem, this.prop, force));
return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
},
// Start an animation from one number to another
custom: function(from, to, unit){
this.startTime = (new Date()).getTime();
this.start = from;
this.end = to;
this.unit = unit || this.unit || "px";
this.now = this.start;
this.pos = this.state = 0;
this.update();
var self = this;
function t(gotoEnd){
return self.step(gotoEnd);
}
t.elem = this.elem;
jQuery.timers.push(t);
if ( jQuery.timerId == null ) {
jQuery.timerId = setInterval(function(){
var timers = jQuery.timers;
for ( var i = 0; i < timers.length; i++ )
if ( !timers[i]() )
timers.splice(i--, 1);
if ( !timers.length ) {
clearInterval( jQuery.timerId );
jQuery.timerId = null;
}
}, 13);
}
},
// Simple 'show' function
show: function(){
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
this.options.show = true;
// Begin the animation
this.custom(0, this.cur());
// Make sure that we start at a small width/height to avoid any
// flash of content
if ( this.prop == "width" || this.prop == "height" )
this.elem.style[this.prop] = "1px";
// Start by showing the element
jQuery(this.elem).show();
},
// Simple 'hide' function
hide: function(){
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
this.options.hide = true;
// Begin the animation
this.custom(this.cur(), 0);
},
// Each step of an animation
step: function(gotoEnd){
var t = (new Date()).getTime();
if ( gotoEnd || t > this.options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
this.options.curAnim[ this.prop ] = true;
var done = true;
for ( var i in this.options.curAnim )
if ( this.options.curAnim[i] !== true )
done = false;
if ( done ) {
if ( this.options.display != null ) {
// Reset the overflow
this.elem.style.overflow = this.options.overflow;
// Reset the display
this.elem.style.display = this.options.display;
if ( jQuery.css(this.elem, "display") == "none" )
this.elem.style.display = "block";
}
// Hide the element if the "hide" operation was done
if ( this.options.hide )
this.elem.style.display = "none";
// Reset the properties, if the item has been hidden or shown
if ( this.options.hide || this.options.show )
for ( var p in this.options.curAnim )
jQuery.attr(this.elem.style, p, this.options.orig[p]);
}
// If a callback was provided, execute it
if ( done && jQuery.isFunction( this.options.complete ) )
// Execute the complete function
this.options.complete.apply( this.elem );
return false;
} else {
var n = t - this.startTime;
this.state = n / this.options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
this.now = this.start + ((this.end - this.start) * this.pos);
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.fx.step = {
scrollLeft: function(fx){
fx.elem.scrollLeft = fx.now;
},
scrollTop: function(fx){
fx.elem.scrollTop = fx.now;
},
opacity: function(fx){
jQuery.attr(fx.elem.style, "opacity", fx.now);
},
_default: function(fx){
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
}
};

View file

@ -1,21 +1 @@
/*! (function(){
* 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;

View file

@ -1,765 +0,0 @@
(function( jQuery ) {
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnocache = /<(?:script|object|embed|option|style)/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
};
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE can't serialize <link> and <script> tags normally
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "div<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
var self = jQuery( this );
self.text( text.call(this, i, self.text()) );
});
}
if ( typeof text !== "object" && text !== undefined ) {
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
}
return jQuery.text( this );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
return this.each(function() {
jQuery( this ).wrapAll( html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
} else if ( arguments.length ) {
var set = jQuery(arguments[0]);
set.push.apply( set, this.toArray() );
return this.pushStack( set, "before", arguments );
}
},
after: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
} else if ( arguments.length ) {
var set = this.pushStack( this, "after", arguments );
set.push.apply( set, jQuery(arguments[0]).toArray() );
return set;
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
// See if we can take a shortcut and just use innerHTML
} else if ( typeof value === "string" && !rnocache.test( value ) &&
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
value = value.replace(rxhtmlTag, "<$1></$2>");
try {
for ( var i = 0, l = this.length; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
if ( this[i].nodeType === 1 ) {
jQuery.cleanData( this[i].getElementsByTagName("*") );
this[i].innerHTML = value;
}
}
// If using innerHTML throws an exception, use the fallback method
} catch(e) {
this.empty().append( value );
}
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
var self = jQuery( this );
self.html( value.call(this, i, self.html()) );
});
} else {
this.empty().append( value );
}
return this;
},
replaceWith: function( value ) {
if ( this[0] && this[0].parentNode ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
} else {
return this.length ?
this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
this;
}
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
var results, first, fragment, parent,
value = args[0],
scripts = [];
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback, true );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call(this, i, table ? self.html() : undefined);
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
parent = value && value.parentNode;
// If we're in a fragment, just use that instead of building a new one
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
results = { fragment: parent };
} else {
results = jQuery.buildFragment( args, this, scripts );
}
fragment = results.fragment;
if ( fragment.childNodes.length === 1 ) {
first = fragment = fragment.firstChild;
} else {
first = fragment.firstChild;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
callback.call(
table ?
root(this[i], first) :
this[i],
// Make sure that we do not leak memory by inadvertently discarding
// the original fragment (which might have attached data) instead of
// using it; in addition, use the original fragment object for the last
// item instead of first because it can end up being emptied incorrectly
// in certain situations (Bug #8070).
// Fragments from the fragment cache must always be cloned and never used
// in place.
results.cacheable || (l > 1 && i < lastIndex) ?
jQuery.clone( fragment, true, true ) :
fragment
);
}
}
if ( scripts.length ) {
jQuery.each( scripts, evalScript );
}
}
return this;
}
});
function root( elem, cur ) {
return jQuery.nodeName(elem, "table") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var internalKey = jQuery.expando,
oldData = jQuery.data( src ),
curData = jQuery.data( dest, oldData );
// Switch to use the internal data object, if it exists, for the next
// stage of data copying
if ( (oldData = oldData[ internalKey ]) ) {
var events = oldData.events;
curData = curData[ internalKey ] = jQuery.extend({}, oldData);
if ( events ) {
delete curData.handle;
curData.events = {};
for ( var type in events ) {
for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
}
}
}
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 fail to clone children inside object elements that use
// the proprietary classid attribute value (rather than the type
// attribute) to identify the type of content to display
if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML;
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
if ( src.checked ) {
dest.defaultChecked = dest.checked = src.checked;
}
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
}
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults, doc;
// nodes may contain either an explicit document object,
// a jQuery collection or context object.
// If nodes[0] contains a valid object to assign to doc
if ( nodes && nodes[0] ) {
doc = nodes[0].ownerDocument || nodes[0];
}
// Ensure that an attr object doesn't incorrectly stand in as a document object
// Chrome and Firefox seem to allow this to occur and will throw exception
// Fixes #8950
if ( !doc.createDocumentFragment ) {
doc = document;
}
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
cacheable = true;
cacheresults = jQuery.fragments[ args[0] ];
if ( cacheresults && cacheresults !== 1 ) {
fragment = cacheresults;
}
}
if ( !fragment ) {
fragment = doc.createDocumentFragment();
jQuery.clean( args, doc, fragment, scripts );
}
if ( cacheable ) {
jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
}
return { fragment: fragment, cacheable: cacheable };
};
jQuery.fragments = {};
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var ret = [],
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = (i > 0 ? this.clone(true) : this).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
function getAll( elem ) {
if ( "getElementsByTagName" in elem ) {
return elem.getElementsByTagName( "*" );
} else if ( "querySelectorAll" in elem ) {
return elem.querySelectorAll( "*" );
} else {
return [];
}
}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( elem.type === "checkbox" || elem.type === "radio" ) {
elem.defaultChecked = elem.checked;
}
}
// Finds all inputs and passes them to fixDefaultChecked
function findInputs( elem ) {
if ( jQuery.nodeName( elem, "input" ) ) {
fixDefaultChecked( elem );
} else if ( "getElementsByTagName" in elem ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var clone = elem.cloneNode(true),
srcElements,
destElements,
i;
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// IE copies events bound via attachEvent when using cloneNode.
// Calling detachEvent on the clone will also remove the events
// from the original. In order to get around this, we use some
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
cloneFixAttributes( elem, clone );
// Using Sizzle here is crazy slow, so we use getElementsByTagName
// instead
srcElements = getAll( elem );
destElements = getAll( clone );
// Weird iteration because IE will replace the length property
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for ( i = 0; srcElements[i]; ++i ) {
cloneFixAttributes( srcElements[i], destElements[i] );
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
cloneCopyEvent( elem, clone );
if ( deepDataAndEvents ) {
srcElements = getAll( elem );
destElements = getAll( clone );
for ( i = 0; srcElements[i]; ++i ) {
cloneCopyEvent( srcElements[i], destElements[i] );
}
}
}
srcElements = destElements = null;
// Return the cloned set
return clone;
},
clean: function( elems, context, fragment, scripts ) {
var checkScriptType;
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" ) {
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
var ret = [], j;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
}
if ( !elem ) {
continue;
}
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
if ( !rhtml.test( elem ) ) {
elem = context.createTextNode( elem );
} else {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Trim whitespace, otherwise indexOf won't work as expected
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div");
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( depth-- ) {
div = div.lastChild;
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
var hasBody = rtbody.test(elem),
tbody = tag === "table" && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !hasBody ?
div.childNodes :
[];
for ( j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
}
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
}
elem = div.childNodes;
}
}
// Resets defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
var len;
if ( !jQuery.support.appendChecked ) {
if ( elem[0] && typeof (len = elem.length) === "number" ) {
for ( j = 0; j < len; j++ ) {
findInputs( elem[j] );
}
} else {
findInputs( elem );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
ret = jQuery.merge( ret, elem );
}
}
if ( fragment ) {
checkScriptType = function( elem ) {
return !elem.type || rscriptType.test( elem.type );
};
for ( i = 0; ret[i]; i++ ) {
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 ) {
var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
fragment.appendChild( ret[i] );
}
}
}
return ret;
},
cleanData: function( elems ) {
var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
continue;
}
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ] && cache[ id ][ internalKey ];
if ( data && data.events ) {
for ( var type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
// Null the DOM reference to avoid IE6/7/8 leak (#7054)
if ( data.handle ) {
data.handle.elem = null;
}
}
if ( deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];
}
}
}
});
function evalScript( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
})( jQuery );

View file

@ -1,308 +1,98 @@
(function( jQuery ) { // The Offset Method
// Originally By Brandon Aaron, part of the Dimension Plugin
var rtable = /^t(?:able|d|h)$/i, // http://jquery.com/plugins/project/dimensions
rroot = /^(?:body|html)$/i; jQuery.fn.offset = function() {
var left = 0, top = 0, elem = this[0], results;
if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.fn.offset = function( options ) { if ( elem ) with ( jQuery.browser ) {
var elem = this[0], box; var parent = elem.parentNode,
offsetChild = elem,
if ( options ) { offsetParent = elem.offsetParent,
return this.each(function( i ) { doc = elem.ownerDocument,
jQuery.offset.setOffset( this, options, i ); safari2 = safari && parseInt(version) < 522,
}); fixed = jQuery.css(elem, "position") == "fixed";
}
// Use getBoundingClientRect if available
if ( !elem || !elem.ownerDocument ) { if ( elem.getBoundingClientRect ) {
return null; var box = elem.getBoundingClientRect();
}
// Add the document scroll offsets
if ( elem === elem.ownerDocument.body ) { add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
return jQuery.offset.bodyOffset( elem ); box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
}
// IE adds the HTML element's border, by default it is medium which is 2px
try { // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
box = elem.getBoundingClientRect(); // IE 7 standards mode, the border is always 2px
} catch(e) {} // This border/offset is typically represented by the clientLeft and clientTop properties
// However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
var doc = elem.ownerDocument, // Therefore this method will be off by 2px in IE while in quirksmode
docElem = doc.documentElement; add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
// Make sure we're not dealing with a disconnected DOM node // Otherwise loop through the offsetParents and parentNodes
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 {
jQuery.fn.offset = function( options ) {
var elem = this[0];
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
jQuery.offset.initialize();
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
doc = elem.ownerDocument,
docElem = doc.documentElement,
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.offset.supportsFixedPosition && 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.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevOffsetParent = offsetParent;
offsetParent = elem.offsetParent;
}
if ( jQuery.offset.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.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
top += Math.max( docElem.scrollTop, body.scrollTop );
left += Math.max( docElem.scrollLeft, body.scrollLeft );
}
return { top: top, left: left };
};
}
jQuery.offset = {
initialize: function() {
var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
container.innerHTML = html;
body.insertBefore( container, body.firstChild );
innerDiv = container.firstChild;
checkDiv = innerDiv.firstChild;
td = innerDiv.nextSibling.firstChild.firstChild;
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
checkDiv.style.position = "fixed";
checkDiv.style.top = "20px";
// safari subtracts parent border width here which is 5px
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
checkDiv.style.position = checkDiv.style.top = "";
innerDiv.style.overflow = "hidden";
innerDiv.style.position = "relative";
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
body.removeChild( container );
jQuery.offset.initialize = jQuery.noop;
},
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
jQuery.offset.initialize();
if ( jQuery.offset.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 { } else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0; // Initial element offsets
} add( elem.offsetLeft, elem.offsetTop );
if ( jQuery.isFunction( options ) ) { // Get parent offsets
options = options.call( elem, i, curOffset ); while ( offsetParent ) {
} // Add offsetParent offsets
add( offsetParent.offsetLeft, offsetParent.offsetTop );
if (options.top != null) {
props.top = (options.top - curOffset.top) + curTop; // Mozilla and Safari > 2 does not include the border on offset parents
} // However Mozilla adds the border for table or table cells
if (options.left != null) { if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
props.left = (options.left - curOffset.left) + curLeft; border( offsetParent );
}
// Add the document scroll offsets if position is fixed on any offsetParent
if ( "using" in options ) { if ( !fixed && jQuery.css(offsetParent, "position") == "fixed" )
options.using.call( elem, props ); fixed = true;
} else {
curElem.css( props ); // Set offsetChild to previous offsetParent unless it is the body element
} offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
} // Get next offsetParent
};
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; offsetParent = offsetParent.offsetParent;
} }
return offsetParent;
}); // Get parent scroll offsets
} while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
}); // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) )
// Subtract parent scroll offsets
// Create scrollLeft and scrollTop methods add( -parent.scrollLeft, -parent.scrollTop );
jQuery.each( ["Left", "Top"], function( i, name ) {
var method = "scroll" + name; // Mozilla does not add the border for a parent that has overflow != visible
if ( mozilla && jQuery.css(parent, "overflow") != "visible" )
jQuery.fn[ method ] = function( val ) { border( parent );
var elem, win;
// Get next parent
if ( val === undefined ) { parent = parent.parentNode;
elem = this[ 0 ];
if ( !elem ) {
return null;
} }
win = getWindow( elem ); // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
// Mozilla doubles body offsets with a non-absolutely positioned offsetChild
// Return the scroll offset if ( (safari2 && (fixed || jQuery.css(offsetChild, "position") == "absolute")) ||
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : (mozilla && jQuery.css(offsetChild, "position") != "absolute") )
jQuery.support.boxModel && win.document.documentElement[ method ] || add( -doc.body.offsetLeft, -doc.body.offsetTop );
win.document.body[ method ] :
elem[ method ]; // Add the document scroll offsets if position is fixed
if ( fixed )
add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
} }
// Set the scroll offset // Return an object with top and left properties
return this.each(function() { results = { top: top, left: left };
win = getWindow( this ); }
if ( win ) { function border(elem) {
win.scrollTo( add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
!i ? val : jQuery( win ).scrollLeft(), }
i ? val : jQuery( win ).scrollTop()
);
} else { function add(l, t) {
this[ method ] = val; left += parseInt(l) || 0;
} top += parseInt(t) || 0;
}); }
};
});
function getWindow( elem ) { return results;
return jQuery.isWindow( elem ) ? };
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
})( jQuery );

View file

@ -1,3 +1 @@
// Expose jQuery to the global object })();
window.jQuery = window.$ = jQuery;
})(window);

View file

@ -1,172 +0,0 @@
(function( jQuery ) {
function handleQueueMarkDefer( elem, type, src ) {
var deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
defer = jQuery.data( elem, deferDataKey, undefined, true );
if ( defer &&
( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
// 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, undefined, true ) &&
!jQuery.data( elem, markDataKey, undefined, true ) ) {
jQuery.removeData( elem, deferDataKey, true );
defer.resolve();
}
}, 0 );
}
}
jQuery.extend({
_mark: function( elem, type ) {
if ( elem ) {
type = (type || "fx") + "mark";
jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
}
},
_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, undefined, true) || 1 ) - 1 );
if ( count ) {
jQuery.data( elem, key, count, true );
} else {
jQuery.removeData( elem, key, true );
handleQueueMarkDefer( elem, type, "mark" );
}
}
},
queue: function( elem, type, data ) {
if ( elem ) {
type = (type || "fx") + "queue";
var q = jQuery.data( elem, type, undefined, true );
// 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), true );
} else {
q.push( data );
}
}
return q || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
defer;
// 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");
}
fn.call(elem, function() {
jQuery.dequeue(elem, type);
});
}
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue", true );
handleQueueMarkDefer( elem, type, "queue" );
}
}
});
jQuery.fn.extend({
queue: function( type, data ) {
if ( typeof type !== "string" ) {
data = type;
type = "fx";
}
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
return 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() {
var elem = this;
setTimeout(function() {
jQuery.dequeue( elem, type );
}, time );
});
},
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._Deferred(), true ) )) {
count++;
tmp.done( resolve );
}
}
resolve();
return defer.promise();
}
});
})( jQuery );

445
src/selector.js Normal file
View file

@ -0,0 +1,445 @@
var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
"(?:[\\w*_-]|\\\\.)" :
"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
quickChild = new RegExp("^>\\s*(" + chars + "+)"),
quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
quickClass = new RegExp("^([#.]?)(" + chars + "*)");
jQuery.extend({
expr: {
"": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},
"#": function(a,i,m){return a.getAttribute("id")==m[2];},
":": {
// Position Checks
lt: function(a,i,m){return i<m[3]-0;},
gt: function(a,i,m){return i>m[3]-0;},
nth: function(a,i,m){return m[3]-0==i;},
eq: function(a,i,m){return m[3]-0==i;},
first: function(a,i){return i==0;},
last: function(a,i,m,r){return i==r.length-1;},
even: function(a,i){return i%2==0;},
odd: function(a,i){return i%2;},
// Child Checks
"first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},
"last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},
"only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},
// Parent Checks
parent: function(a){return a.firstChild;},
empty: function(a){return !a.firstChild;},
// Text Check
contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},
// Visibility
visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},
hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},
// Form attributes
enabled: function(a){return !a.disabled;},
disabled: function(a){return a.disabled;},
checked: function(a){return a.checked;},
selected: function(a){return a.selected||jQuery.attr(a,"selected");},
// Form elements
text: function(a){return "text"==a.type;},
radio: function(a){return "radio"==a.type;},
checkbox: function(a){return "checkbox"==a.type;},
file: function(a){return "file"==a.type;},
password: function(a){return "password"==a.type;},
submit: function(a){return "submit"==a.type;},
image: function(a){return "image"==a.type;},
reset: function(a){return "reset"==a.type;},
button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},
input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},
// :has()
has: function(a,i,m){return jQuery.find(m[3],a).length;},
// :header
header: function(a){return /h\d/i.test(a.nodeName);},
// :animated
animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}
}
},
// The regular expressions that power the parsing engine
parse: [
// Match: [@value='test'], [@foo]
/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
// Match: :contains('foo')
/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
// Match: :even, :last-chlid, #id, .class
new RegExp("^([:.#]*)(" + chars + "+)")
],
multiFilter: function( expr, elems, not ) {
var old, cur = [];
while ( expr && expr != old ) {
old = expr;
var f = jQuery.filter( expr, elems, not );
expr = f.t.replace(/^\s*,\s*/, "" );
cur = not ? elems = f.r : jQuery.merge( cur, f.r );
}
return cur;
},
find: function( t, context ) {
// Quickly handle non-string expressions
if ( typeof t != "string" )
return [ t ];
// check to make sure context is a DOM element or a document
if ( context && context.nodeType != 1 && context.nodeType != 9)
return [ ];
// Set the correct context (if none is provided)
context = context || document;
// Initialize the search
var ret = [context], done = [], last, nodeName;
// Continue while a selector expression exists, and while
// we're no longer looping upon ourselves
while ( t && last != t ) {
var r = [];
last = t;
t = jQuery.trim(t);
var foundToken = false;
// An attempt at speeding up child selectors that
// point to a specific element tag
var re = quickChild;
var m = re.exec(t);
if ( m ) {
nodeName = m[1].toUpperCase();
// Perform our own iteration and filter
for ( var i = 0; ret[i]; i++ )
for ( var c = ret[i].firstChild; c; c = c.nextSibling )
if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
r.push( c );
ret = r;
t = t.replace( re, "" );
if ( t.indexOf(" ") == 0 ) continue;
foundToken = true;
} else {
re = /^([>+~])\s*(\w*)/i;
if ( (m = re.exec(t)) != null ) {
r = [];
var merge = {};
nodeName = m[2].toUpperCase();
m = m[1];
for ( var j = 0, rl = ret.length; j < rl; j++ ) {
var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
for ( ; n; n = n.nextSibling )
if ( n.nodeType == 1 ) {
var id = jQuery.data(n);
if ( m == "~" && merge[id] ) break;
if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
if ( m == "~" ) merge[id] = true;
r.push( n );
}
if ( m == "+" ) break;
}
}
ret = r;
// And remove the token
t = jQuery.trim( t.replace( re, "" ) );
foundToken = true;
}
}
// See if there's still an expression, and that we haven't already
// matched a token
if ( t && !foundToken ) {
// Handle multiple expressions
if ( !t.indexOf(",") ) {
// Clean the result set
if ( context == ret[0] ) ret.shift();
// Merge the result sets
done = jQuery.merge( done, ret );
// Reset the context
r = ret = [context];
// Touch up the selector string
t = " " + t.substr(1,t.length);
} else {
// Optimize for the case nodeName#idName
var re2 = quickID;
var m = re2.exec(t);
// Re-organize the results, so that they're consistent
if ( m ) {
m = [ 0, m[2], m[3], m[1] ];
} else {
// Otherwise, do a traditional filter check for
// ID, class, and element selectors
re2 = quickClass;
m = re2.exec(t);
}
m[2] = m[2].replace(/\\/g, "");
var elem = ret[ret.length-1];
// Try to do a global search by ID, where we can
if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
// Optimization for HTML document case
var oid = elem.getElementById(m[2]);
// Do a quick check for the existence of the actual ID attribute
// to avoid selecting by the name attribute in IE
// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
// Do a quick check for node name (where applicable) so
// that div#foo searches will be really fast
ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
} else {
// We need to find all descendant elements
for ( var i = 0; ret[i]; i++ ) {
// Grab the tag name being searched for
var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
// Handle IE7 being really dumb about <object>s
if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
tag = "param";
r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
}
// It's faster to filter by class and be done with it
if ( m[1] == "." )
r = jQuery.classFilter( r, m[2] );
// Same with ID filtering
if ( m[1] == "#" ) {
var tmp = [];
// Try to find the element with the ID
for ( var i = 0; r[i]; i++ )
if ( r[i].getAttribute("id") == m[2] ) {
tmp = [ r[i] ];
break;
}
r = tmp;
}
ret = r;
}
t = t.replace( re2, "" );
}
}
// If a selector string still exists
if ( t ) {
// Attempt to filter it
var val = jQuery.filter(t,r);
ret = r = val.r;
t = jQuery.trim(val.t);
}
}
// An error occurred with the selector;
// just return an empty set instead
if ( t )
ret = [];
// Remove the root context
if ( ret && context == ret[0] )
ret.shift();
// And combine the results
done = jQuery.merge( done, ret );
return done;
},
classFilter: function(r,m,not){
m = " " + m + " ";
var tmp = [];
for ( var i = 0; r[i]; i++ ) {
var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
if ( !not && pass || not && !pass )
tmp.push( r[i] );
}
return tmp;
},
filter: function(t,r,not) {
var last;
// Look for common filter expressions
while ( t && t != last ) {
last = t;
var p = jQuery.parse, m;
for ( var i = 0; p[i]; i++ ) {
m = p[i].exec( t );
if ( m ) {
// Remove what we just matched
t = t.substring( m[0].length );
m[2] = m[2].replace(/\\/g, "");
break;
}
}
if ( !m )
break;
// :not() is a special case that can be optimized by
// keeping it out of the expression list
if ( m[1] == ":" && m[2] == "not" )
// optimize if only one selector found (most common case)
r = isSimple.test( m[3] ) ?
jQuery.filter(m[3], r, true).r :
jQuery( r ).not( m[3] );
// We can get a big speed boost by filtering by class here
else if ( m[1] == "." )
r = jQuery.classFilter(r, m[2], not);
else if ( m[1] == "[" ) {
var tmp = [], type = m[3];
for ( var i = 0, rl = r.length; i < rl; i++ ) {
var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
if ( z == null || /href|src|selected/.test(m[2]) )
z = jQuery.attr(a,m[2]) || '';
if ( (type == "" && !!z ||
type == "=" && z == m[5] ||
type == "!=" && z != m[5] ||
type == "^=" && z && !z.indexOf(m[5]) ||
type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
(type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
tmp.push( a );
}
r = tmp;
// We can get a speed boost by handling nth-child here
} else if ( m[1] == ":" && m[2] == "nth-child" ) {
var merge = {}, tmp = [],
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
!/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
// calculate the numbers (first)n+(last) including if they are negative
first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
// loop through all the elements left in the jQuery object
for ( var i = 0, rl = r.length; i < rl; i++ ) {
var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
if ( !merge[id] ) {
var c = 1;
for ( var n = parentNode.firstChild; n; n = n.nextSibling )
if ( n.nodeType == 1 )
n.nodeIndex = c++;
merge[id] = true;
}
var add = false;
if ( first == 0 ) {
if ( node.nodeIndex == last )
add = true;
} else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
add = true;
if ( add ^ not )
tmp.push( node );
}
r = tmp;
// Otherwise, find the expression to execute
} else {
var fn = jQuery.expr[ m[1] ];
if ( typeof fn == "object" )
fn = fn[ m[2] ];
if ( typeof fn == "string" )
fn = eval("false||function(a,i){return " + fn + ";}");
// Execute it against the current filter
r = jQuery.grep( r, function(elem, i){
return fn(elem, i, m, r);
}, not );
}
}
// Return an array of filtered elements (r)
// and the modified expression string (t)
return { r: r, t: t };
},
dir: function( elem, dir ){
var matched = [];
var cur = elem[dir];
while ( cur && cur != document ) {
if ( cur.nodeType == 1 )
matched.push( cur );
cur = cur[dir];
}
return matched;
},
nth: function(cur,result,dir,elem){
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] )
if ( cur.nodeType == 1 && ++num == result )
break;
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType == 1 && (!elem || n != elem) )
r.push( n );
}
return r;
}
});

@ -1 +0,0 @@
Subproject commit 3ba396e439a07c2a2facafbe07cdaa1b80a24c00

View file

@ -1,7 +0,0 @@
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;

View file

@ -1,256 +0,0 @@
(function( jQuery ) {
jQuery.support = (function() {
var div = document.createElement( "div" ),
documentElement = document.documentElement,
all,
a,
select,
opt,
input,
marginDiv,
support,
fragment,
body,
testElementParent,
testElement,
testElementStyle,
tds,
events,
eventName,
i,
isSupported;
// Preliminary tests
div.setAttribute("className", "t");
div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
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",
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true
};
// 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 it's 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");
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.firstChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
div.innerHTML = "";
// Figure out if the W3C box model works as expected
div.style.width = div.style.paddingLeft = "1px";
body = document.getElementsByTagName( "body" )[ 0 ];
// We use our own, invisible, body unless the body is already present
// in which case we use a div (#9239)
testElement = document.createElement( body ? "div" : "body" );
testElementStyle = {
visibility: "hidden",
width: 0,
height: 0,
border: 0,
margin: 0
};
if ( body ) {
jQuery.extend( testElementStyle, {
position: "absolute",
left: -1000,
top: -1000
});
}
for ( i in testElementStyle ) {
testElement.style[ i ] = testElementStyle[ i ];
}
testElement.appendChild( div );
testElementParent = body || documentElement;
testElementParent.insertBefore( testElement, testElementParent.firstChild );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
support.boxModel = div.offsetWidth === 2;
if ( "zoom" in div.style ) {
// 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.style.display = "inline";
div.style.zoom = 1;
support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "";
div.innerHTML = "<div style='width:4px;'></div>";
support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
}
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
tds = div.getElementsByTagName( "td" );
// 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)
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 );
div.innerHTML = "";
// 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 ( document.defaultView && document.defaultView.getComputedStyle ) {
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
// Remove the body element we added
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
// Technique from Juriy Zaytsev
// http://thinkweb2.com/projects/prototype/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;
}
}
// Null connected elements to avoid leaks in IE
testElement = fragment = select = opt = body = marginDiv = div = input = null;
return support;
})();
// Keep track of boxModel
jQuery.boxModel = jQuery.support.boxModel;
})( jQuery );

View file

@ -1,334 +0,0 @@
(function( jQuery ) {
var runtil = /Until$/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector = /,/,
isSimple = /^.[^:#\[\.,]*$/,
slice = Array.prototype.slice,
POS = jQuery.expr.match.POS,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var self = this,
i, l;
if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() {
for ( i = 0, l = self.length; i < l; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
});
}
var ret = this.pushStack( "", "find", selector ),
length, n, r;
for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( n = length; n < ret.length; n++ ) {
for ( r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var targets = jQuery( target );
return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && ( typeof selector === "string" ?
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0];
// Array
if ( jQuery.isArray( selectors ) ) {
var match, selector,
matches = {},
level = 1;
if ( cur && selectors.length ) {
for ( i = 0, l = selectors.length; i < l; i++ ) {
selector = selectors[i];
if ( !matches[ selector ] ) {
matches[ selector ] = POS.test( selector ) ?
jQuery( selector, context || this.context ) :
selector;
}
}
while ( cur && cur.ownerDocument && cur !== context ) {
for ( selector in matches ) {
match = matches[ selector ];
if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {
ret.push({ selector: selector, elem: cur, level: level });
}
}
cur = cur.parentNode;
level++;
}
}
return ret;
}
// String
var pos = POS.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
} else {
cur = cur.parentNode;
if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
break;
}
}
}
}
ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
if ( !elem || typeof elem === "string" ) {
return jQuery.inArray( this[0],
// If it receives a string, the selector is used
// If it receives nothing, the siblings are used
elem ? jQuery( elem ) : this.parent().children() );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
andSelf: function() {
return this.add( this.prevObject );
}
});
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return jQuery.nth( elem, 2, "nextSibling" );
},
prev: function( elem ) {
return jQuery.nth( elem, 2, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( elem.parentNode.firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.makeArray( elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until ),
// The variable 'args' was introduced in
// https://github.com/jquery/jquery/commit/52a0238
// to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
// http://code.google.com/p/v8/issues/detail?id=1050
args = slice.call(arguments);
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, args.join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
nth: function( cur, result, dir, elem ) {
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] ) {
if ( cur.nodeType === 1 && ++num === result ) {
break;
}
}
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return (elem === qualifier) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
});
}
})( jQuery );

View file

@ -1,31 +0,0 @@
<?php header("X-Content-Security-Policy-Report-Only: allow *"); ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSP Test Page</title>
<script src="../src/core.js"></script>
<script src="../src/deferred.js"></script>
<script src="../src/support.js"></script>
<script src="../src/data.js"></script>
<script src="../src/queue.js"></script>
<script src="../src/attributes.js"></script>
<script src="../src/event.js"></script>
<script src="../src/sizzle/sizzle.js"></script>
<script src="../src/sizzle-jquery.js"></script>
<script src="../src/traversing.js"></script>
<script src="../src/manipulation.js"></script>
<script src="../src/css.js"></script>
<script src="../src/ajax.js"></script>
<script src="../src/ajax/jsonp.js"></script>
<script src="../src/ajax/script.js"></script>
<script src="../src/ajax/xhr.js"></script>
<script src="../src/effects.js"></script>
<script src="../src/offset.js"></script>
<script src="../src/dimensions.js"></script>
</head>
<body>
<p>CSP Test Page</p>
</body>
</html>

View file

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

View file

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

BIN
test/data/cow.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1 @@
json_assigned_obj = { "test" : "worked" };

View file

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

View file

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

View file

@ -12,26 +12,12 @@
#absolute-1-1-1 { top: 1px; left: 1px; } #absolute-1-1-1 { top: 1px; left: 1px; }
#absolute-2 { top: 19px; left: 19px; } #absolute-2 { top: 19px; left: 19px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
p.instructions { position: absolute; bottom: 0; }
#positionTest { position: absolute; }
</style> </style>
<script src="../../../src/core.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" src="../../../dist/jquery.js"></script> <script type="text/javascript" src="../../../dist/jquery.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { $(function() {
$('.absolute').click(function() { $('.absolute').click(function() {
$('#marker').css( $(this).offset() ); $('#marker').css( $(this).offset() );
var pos = $(this).position();
$(this).css({ top: pos.top, left: pos.left });
return false; return false;
}); });
}); });
@ -44,8 +30,6 @@
</div> </div>
</div> </div>
<div id="absolute-2" class="absolute">absolute-2</div> <div id="absolute-2" class="absolute">absolute-2</div>
<div id="positionTest">Has absolute position but no values set for the location ('auto').</div>
<div id="marker"></div> <div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p>
</body> </body>
</html> </html>

View file

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

View file

@ -12,18 +12,9 @@
#forceScroll { width: 5000px; height: 5000px; } #forceScroll { width: 5000px; height: 5000px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script type="text/javascript" src="../../../dist/jquery.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { $(function() {
window.scrollTo(1000,1000); window.scrollTo(1000,1000);
$('.fixed').click(function() { $('.fixed').click(function() {
$('#marker').css( $(this).offset() ); $('#marker').css( $(this).offset() );
@ -35,9 +26,7 @@
<body> <body>
<div id="fixed-1" class="fixed"></div> <div id="fixed-1" class="fixed"></div>
<div id="fixed-2" class="fixed"></div> <div id="fixed-2" class="fixed"></div>
<div id="fixed-no-top-left" class="fixed"></div>
<div id="forceScroll"></div> <div id="forceScroll"></div>
<div id="marker"></div> <div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it.</p>
</body> </body>
</html> </html>

View file

@ -6,26 +6,15 @@
<title>relative</title> <title>relative</title>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
body { margin: 1px; padding: 5px; } body { margin: 1px; padding: 5px; }
div.relative { position: relative; top: 0; left: 0; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; } div.relative { position: relative; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
#relative-2 { top: 20px; left: 20px; } #relative-2 { top: 20px; left: 20px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script type="text/javascript" src="../../../dist/jquery.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { $(function() {
$('.relative').click(function() { $('.relative').click(function() {
$('#marker').css( $(this).offset() ); $('#marker').css( $(this).offset() );
var pos = $(this).position();
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
return false; return false;
}); });
}); });
@ -35,6 +24,5 @@
<div id="relative-1" class="relative"><div id="relative-1-1" class="relative"><div id="relative-1-1-1" class="relative"></div></div></div> <div id="relative-1" class="relative"><div id="relative-1-1" class="relative"><div id="relative-1-1-1" class="relative"></div></div></div>
<div id="relative-2" class="relative"></div> <div id="relative-2" class="relative"></div>
<div id="marker"></div> <div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p>
</body> </body>
</html> </html>

View file

@ -13,18 +13,9 @@
#forceScroll { width: 5000px; height: 5000px; } #forceScroll { width: 5000px; height: 5000px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script type="text/javascript" src="../../../dist/jquery.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { $(function() {
window.scrollTo(1000,1000); window.scrollTo(1000,1000);
$('#scroll-1')[0].scrollLeft = 5; $('#scroll-1')[0].scrollLeft = 5;
$('#scroll-1')[0].scrollTop = 5; $('#scroll-1')[0].scrollTop = 5;
@ -43,6 +34,5 @@
</div> </div>
<div id="forceScroll"></div> <div id="forceScroll"></div>
<div id="marker"></div> <div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it.</p>
</body> </body>
</html> </html>

View file

@ -6,26 +6,15 @@
<title>static</title> <title>static</title>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
body { margin: 1px; padding: 5px; } body { margin: 1px; padding: 5px; }
div.static { position: static; top: 0; left: 0; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; } div.static { position: static; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
#static-2 { top: 20px; left: 20px; } #static-2 { top: 20px; left: 20px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script type="text/javascript" src="../../../dist/jquery.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { $(function() {
$('.static').click(function() { $('.static').click(function() {
$('#marker').css( $(this).offset() ); $('#marker').css( $(this).offset() );
var pos = $(this).position();
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
return false; return false;
}); });
}); });
@ -35,6 +24,5 @@
<div id="static-1" class="static"><div id="static-1-1" class="static"><div id="static-1-1-1" class="static"></div></div></div> <div id="static-1" class="static"><div id="static-1-1" class="static"><div id="static-1-1-1" class="static"></div></div></div>
<div id="static-2" class="static"></div> <div id="static-2" class="static"></div>
<div id="marker"></div> <div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p>
</body> </body>
</html> </html>

View file

@ -10,18 +10,9 @@
th, td { border: 1px solid #000; width: 100px; height: 100px; } th, td { border: 1px solid #000; width: 100px; height: 100px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script type="text/javascript" src="../../../dist/jquery.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { $(function() {
$('table, th, td').click(function() { $('table, th, td').click(function() {
$('#marker').css( $(this).offset() ); $('#marker').css( $(this).offset() );
return false; return false;
@ -47,6 +38,5 @@
</tbody> </tbody>
</table> </table>
<div id="marker"></div> <div id="marker"></div>
<p class="instructions">Click the white box to move the marker to it.</p>
</body> </body>
</html> </html>

View file

@ -1,12 +0,0 @@
<div id="post">
<?php
foreach( $_POST as $key=>$value )
echo "<b id='$key'>$value</b>";
?>
</div>
<div id="get">
<?php
foreach( $_GET as $key=>$value )
echo "<b id='$key'>$value</b>";
?>
</div>

View file

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

View file

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

View file

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

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