From 8ed61acca0a1c1f1242ebb0cdb8291be6d4a0d91 Mon Sep 17 00:00:00 2001 From: Jeffrey Pearce Date: Wed, 27 May 2015 14:51:25 +0200 Subject: [PATCH] Closes #843 - adds npm components and package json for registry with npm. Watch for new 2.5.0 tag before using. --- bower.json | 6 +- bower_components/jquery/.bower.json | 39 +- bower_components/jquery/.gitattributes | 2 - bower_components/jquery/.gitignore | 10 - bower_components/jquery/.gitmodules | 6 - bower_components/jquery/GPL-LICENSE.txt | 278 - bower_components/jquery/MIT-LICENSE.txt | 3 +- bower_components/jquery/Makefile | 136 - bower_components/jquery/README.md | 147 - bower_components/jquery/bower.json | 28 + bower_components/jquery/build/freq.js | 79 - bower_components/jquery/build/jslint-check.js | 36 - bower_components/jquery/build/lib/jslint.js | 5504 -------- bower_components/jquery/build/lib/parse-js.js | 1315 -- bower_components/jquery/build/lib/process.js | 1666 --- .../jquery/build/lib/squeeze-more.js | 22 - bower_components/jquery/build/post-compile.js | 20 - .../jquery/build/release-notes.js | 54 - .../jquery/build/release-notes.txt | 27 - bower_components/jquery/build/release.js | 169 - bower_components/jquery/build/sizer.js | 36 - bower_components/jquery/build/uglify.js | 285 - bower_components/jquery/component.json | 8 - bower_components/jquery/dist/jquery.js | 10351 ++++++++++++++++ bower_components/jquery/dist/jquery.min.js | 6 + bower_components/jquery/dist/jquery.min.map | 1 + bower_components/jquery/jquery.js | 9300 -------------- bower_components/jquery/speed/benchmark.js | 15 - bower_components/jquery/speed/benchmarker.css | 65 - bower_components/jquery/speed/benchmarker.js | 181 - bower_components/jquery/speed/closest.html | 39 - bower_components/jquery/speed/css.html | 82 - bower_components/jquery/speed/event.html | 58 - bower_components/jquery/speed/filter.html | 183 - bower_components/jquery/speed/find.html | 179 - bower_components/jquery/speed/index.html | 72 - bower_components/jquery/speed/jquery-basis.js | 6238 ---------- .../jquery/speed/slice.vs.concat.html | 47 - bower_components/jquery/src/ajax.js | 1093 +- bower_components/jquery/src/ajax/jsonp.js | 106 +- bower_components/jquery/src/ajax/load.js | 75 + bower_components/jquery/src/ajax/parseJSON.js | 51 + bower_components/jquery/src/ajax/parseXML.js | 31 + bower_components/jquery/src/ajax/script.js | 28 +- bower_components/jquery/src/ajax/var/nonce.js | 5 + .../jquery/src/ajax/var/rquery.js | 3 + bower_components/jquery/src/ajax/xhr.js | 275 +- bower_components/jquery/src/attributes.js | 658 +- .../jquery/src/attributes/attr.js | 271 + .../jquery/src/attributes/classes.js | 157 + .../jquery/src/attributes/prop.js | 134 + .../jquery/src/attributes/support.js | 62 + bower_components/jquery/src/attributes/val.js | 178 + bower_components/jquery/src/callbacks.js | 193 +- bower_components/jquery/src/core.js | 798 +- bower_components/jquery/src/core/access.js | 60 + bower_components/jquery/src/core/init.js | 132 + bower_components/jquery/src/core/parseHTML.js | 39 + bower_components/jquery/src/core/ready.js | 152 + .../jquery/src/core/var/rsingleTag.js | 4 + bower_components/jquery/src/css.js | 569 +- .../jquery/src/css/addGetHookIf.js | 32 + bower_components/jquery/src/css/curCSS.js | 124 + .../jquery/src/css/defaultDisplay.js | 69 + .../jquery/src/css/hiddenVisibleSelectors.js | 20 + bower_components/jquery/src/css/support.js | 151 + bower_components/jquery/src/css/swap.js | 28 + .../jquery/src/css/var/cssExpand.js | 3 + .../jquery/src/css/var/isHidden.js | 13 + .../jquery/src/css/var/rmargin.js | 3 + .../jquery/src/css/var/rnumnonpx.js | 5 + bower_components/jquery/src/data.js | 501 +- bower_components/jquery/src/data/accepts.js | 21 + bower_components/jquery/src/data/support.js | 25 + bower_components/jquery/src/deferred.js | 210 +- bower_components/jquery/src/deprecated.js | 13 + bower_components/jquery/src/dimensions.js | 120 +- bower_components/jquery/src/effects.js | 1102 +- bower_components/jquery/src/effects/Tween.js | 114 + .../jquery/src/effects/animatedSelector.js | 13 + .../jquery/src/effects/support.js | 55 + bower_components/jquery/src/event.js | 880 +- bower_components/jquery/src/event/ajax.js | 13 + bower_components/jquery/src/event/alias.js | 39 + bower_components/jquery/src/event/support.js | 26 + bower_components/jquery/src/exports/amd.js | 24 + bower_components/jquery/src/exports/global.js | 32 + bower_components/jquery/src/intro.js | 45 +- bower_components/jquery/src/jquery.js | 38 + bower_components/jquery/src/manipulation.js | 1169 +- .../jquery/src/manipulation/_evalUrl.js | 18 + .../jquery/src/manipulation/support.js | 76 + .../src/manipulation/var/rcheckableType.js | 3 + bower_components/jquery/src/offset.js | 328 +- bower_components/jquery/src/outro.js | 4 +- bower_components/jquery/src/queue.js | 177 +- bower_components/jquery/src/queue/delay.js | 22 + .../{sizzle-jquery.js => selector-sizzle.js} | 12 +- bower_components/jquery/src/selector.js | 1 + bower_components/jquery/src/serialize.js | 110 + .../jquery/src/sizzle/dist/sizzle.js | 2067 +++ .../jquery/src/sizzle/dist/sizzle.min.js | 3 + .../jquery/src/sizzle/dist/sizzle.min.map | 1 + bower_components/jquery/src/support.js | 369 +- bower_components/jquery/src/traversing.js | 295 +- .../jquery/src/traversing/findFilter.js | 100 + .../src/traversing/var/rneedsContext.js | 6 + bower_components/jquery/src/var/class2type.js | 4 + bower_components/jquery/src/var/concat.js | 5 + bower_components/jquery/src/var/deletedIds.js | 3 + bower_components/jquery/src/var/hasOwn.js | 5 + bower_components/jquery/src/var/indexOf.js | 5 + bower_components/jquery/src/var/pnum.js | 3 + bower_components/jquery/src/var/push.js | 5 + bower_components/jquery/src/var/rnotwhite.js | 3 + bower_components/jquery/src/var/slice.js | 5 + .../jquery/src/var/strundefined.js | 3 + bower_components/jquery/src/var/support.js | 4 + bower_components/jquery/src/var/toString.js | 5 + bower_components/jquery/src/wrap.js | 76 + bower_components/jquery/test/csp.php | 31 - .../jquery/test/data/atom+xml.php | 4 - bower_components/jquery/test/data/badjson.js | 1 - .../jquery/test/data/dashboard.xml | 11 - .../jquery/test/data/echoData.php | 1 - .../jquery/test/data/echoQuery.php | 1 - .../jquery/test/data/errorWithText.php | 5 - bower_components/jquery/test/data/etag.php | 21 - bower_components/jquery/test/data/headers.php | 18 - .../jquery/test/data/if_modified_since.php | 20 - bower_components/jquery/test/data/iframe.html | 8 - bower_components/jquery/test/data/json.php | 13 - bower_components/jquery/test/data/json_obj.js | 1 - bower_components/jquery/test/data/jsonp.php | 14 - bower_components/jquery/test/data/name.html | 1 - bower_components/jquery/test/data/name.php | 24 - .../jquery/test/data/offset/absolute.html | 52 - .../jquery/test/data/offset/body.html | 34 - .../jquery/test/data/offset/fixed.html | 44 - .../jquery/test/data/offset/relative.html | 41 - .../jquery/test/data/offset/scroll.html | 49 - .../jquery/test/data/offset/static.html | 41 - .../jquery/test/data/offset/table.html | 53 - .../jquery/test/data/params_html.php | 12 - .../jquery/test/data/readywaitasset.js | 1 - .../jquery/test/data/readywaitloader.js | 25 - bower_components/jquery/test/data/script.php | 11 - .../test/data/selector/html5_selector.html | 133 - .../test/data/selector/sizzle_cache.html | 40 - .../jquery/test/data/statusText.php | 5 - .../test/data/support/bodyBackground.html | 40 - .../jquery/test/data/support/boxModelIE.html | 28 - .../test/data/support/hiddenIFrameFF.html | 26 - .../test/data/support/testElementCrash.html | 19 - bower_components/jquery/test/data/test.html | 7 - bower_components/jquery/test/data/test.js | 3 - bower_components/jquery/test/data/test.php | 7 - bower_components/jquery/test/data/test2.html | 5 - bower_components/jquery/test/data/test3.html | 3 - bower_components/jquery/test/data/testinit.js | 121 - .../jquery/test/data/testrunner.js | 33 - .../jquery/test/data/testsuite.css | 128 - bower_components/jquery/test/data/text.php | 12 - bower_components/jquery/test/data/ua.txt | 272 - .../jquery/test/data/versioncheck.js | 8 - .../jquery/test/data/with_fries.xml | 25 - .../test/data/with_fries_over_jsonp.php | 7 - .../jquery/test/delegatetest.html | 206 - bower_components/jquery/test/hovertest.html | 158 - bower_components/jquery/test/localfile.html | 93 - .../jquery/test/networkerror.html | 102 - bower_components/jquery/test/polluted.php | 99 - bower_components/jquery/test/readywait.html | 88 - bower_components/jquery/test/unit/ajax.js | 2315 ---- .../jquery/test/unit/attributes.js | 1172 -- .../jquery/test/unit/callbacks.js | 182 - bower_components/jquery/test/unit/core.js | 1262 -- bower_components/jquery/test/unit/css.js | 522 - bower_components/jquery/test/unit/data.js | 644 - bower_components/jquery/test/unit/deferred.js | 371 - .../jquery/test/unit/dimensions.js | 307 - bower_components/jquery/test/unit/effects.js | 1258 -- bower_components/jquery/test/unit/event.js | 2580 ---- .../jquery/test/unit/manipulation.js | 1533 --- bower_components/jquery/test/unit/offset.js | 498 - bower_components/jquery/test/unit/queue.js | 292 - bower_components/jquery/test/unit/selector.js | 142 - bower_components/jquery/test/unit/support.js | 62 - .../jquery/test/unit/traversing.js | 632 - bower_components/jquery/test/xhtml.php | 5 - bower_components/jquery/version.txt | 1 - node_modules/jquery/.bowerrc | 3 + node_modules/jquery/.jscsrc | 5 + node_modules/jquery/.npmignore | 14 + node_modules/jquery/AUTHORS.txt | 217 + node_modules/jquery/CONTRIBUTING.md | 214 + node_modules/jquery/MIT-LICENSE.txt | 21 + node_modules/jquery/README.md | 368 + node_modules/jquery/bower.json | 28 + node_modules/jquery/dist/jquery.js | 10351 ++++++++++++++++ node_modules/jquery/dist/jquery.min.js | 6 + node_modules/jquery/dist/jquery.min.map | 1 + node_modules/jquery/package.json | 89 + node_modules/jquery/src/ajax.js | 801 ++ node_modules/jquery/src/ajax/jsonp.js | 89 + node_modules/jquery/src/ajax/load.js | 75 + node_modules/jquery/src/ajax/parseJSON.js | 51 + node_modules/jquery/src/ajax/parseXML.js | 31 + node_modules/jquery/src/ajax/script.js | 93 + node_modules/jquery/src/ajax/var/nonce.js | 5 + node_modules/jquery/src/ajax/var/rquery.js | 3 + node_modules/jquery/src/ajax/xhr.js | 197 + node_modules/jquery/src/attributes.js | 11 + node_modules/jquery/src/attributes/attr.js | 271 + node_modules/jquery/src/attributes/classes.js | 157 + node_modules/jquery/src/attributes/prop.js | 134 + node_modules/jquery/src/attributes/support.js | 62 + node_modules/jquery/src/attributes/val.js | 178 + node_modules/jquery/src/callbacks.js | 205 + node_modules/jquery/src/core.js | 540 + node_modules/jquery/src/core/access.js | 60 + node_modules/jquery/src/core/init.js | 132 + node_modules/jquery/src/core/parseHTML.js | 39 + node_modules/jquery/src/core/ready.js | 152 + .../jquery/src/core/var/rsingleTag.js | 4 + node_modules/jquery/src/css.js | 504 + node_modules/jquery/src/css/addGetHookIf.js | 32 + node_modules/jquery/src/css/curCSS.js | 124 + node_modules/jquery/src/css/defaultDisplay.js | 69 + .../jquery/src/css/hiddenVisibleSelectors.js | 20 + node_modules/jquery/src/css/support.js | 151 + node_modules/jquery/src/css/swap.js | 28 + node_modules/jquery/src/css/var/cssExpand.js | 3 + node_modules/jquery/src/css/var/isHidden.js | 13 + node_modules/jquery/src/css/var/rmargin.js | 3 + node_modules/jquery/src/css/var/rnumnonpx.js | 5 + node_modules/jquery/src/data.js | 335 + node_modules/jquery/src/data/accepts.js | 21 + node_modules/jquery/src/data/support.js | 25 + node_modules/jquery/src/deferred.js | 150 + node_modules/jquery/src/deprecated.js | 13 + node_modules/jquery/src/dimensions.js | 50 + node_modules/jquery/src/effects.js | 656 + node_modules/jquery/src/effects/Tween.js | 114 + .../jquery/src/effects/animatedSelector.js | 13 + node_modules/jquery/src/effects/support.js | 55 + node_modules/jquery/src/event.js | 1037 ++ node_modules/jquery/src/event/ajax.js | 13 + node_modules/jquery/src/event/alias.js | 39 + node_modules/jquery/src/event/support.js | 26 + node_modules/jquery/src/exports/amd.js | 24 + node_modules/jquery/src/exports/global.js | 32 + node_modules/jquery/src/intro.js | 44 + node_modules/jquery/src/jquery.js | 38 + node_modules/jquery/src/manipulation.js | 744 ++ .../jquery/src/manipulation/_evalUrl.js | 18 + .../jquery/src/manipulation/support.js | 76 + .../src/manipulation/var/rcheckableType.js | 3 + node_modules/jquery/src/offset.js | 211 + node_modules/jquery/src/outro.js | 1 + node_modules/jquery/src/queue.js | 142 + node_modules/jquery/src/queue/delay.js | 22 + node_modules/jquery/src/selector-sizzle.js | 14 + node_modules/jquery/src/selector.js | 1 + node_modules/jquery/src/serialize.js | 110 + node_modules/jquery/src/sizzle/dist/sizzle.js | 2067 +++ .../jquery/src/sizzle/dist/sizzle.min.js | 3 + .../jquery/src/sizzle/dist/sizzle.min.map | 1 + .../jquery/src/sizzle/test/data/empty.js | 0 .../src/sizzle/test/data/mixed_sort.html | 22 + .../jquery/src/sizzle/test/data/testinit.js | 136 + .../jquery/src/sizzle}/test/index.html | 145 +- node_modules/jquery/src/sizzle/test/jquery.js | 9597 ++++++++++++++ .../jquery/src/sizzle/test/unit/extending.js | 95 + .../jquery/src/sizzle/test/unit/selector.js | 1149 ++ .../jquery/src/sizzle/test/unit/utilities.js | 169 + node_modules/jquery/src/support.js | 58 + node_modules/jquery/src/traversing.js | 200 + .../jquery/src/traversing/findFilter.js | 100 + .../src/traversing/var/rneedsContext.js | 6 + node_modules/jquery/src/var/class2type.js | 4 + node_modules/jquery/src/var/concat.js | 5 + node_modules/jquery/src/var/deletedIds.js | 3 + node_modules/jquery/src/var/hasOwn.js | 5 + node_modules/jquery/src/var/indexOf.js | 5 + node_modules/jquery/src/var/pnum.js | 3 + node_modules/jquery/src/var/push.js | 5 + node_modules/jquery/src/var/rnotwhite.js | 3 + node_modules/jquery/src/var/slice.js | 5 + node_modules/jquery/src/var/strundefined.js | 3 + node_modules/jquery/src/var/support.js | 4 + node_modules/jquery/src/var/toString.js | 5 + node_modules/jquery/src/wrap.js | 76 + package.json | 29 + 294 files changed, 52133 insertions(+), 47712 deletions(-) delete mode 100644 bower_components/jquery/.gitattributes delete mode 100644 bower_components/jquery/.gitignore delete mode 100644 bower_components/jquery/.gitmodules delete mode 100644 bower_components/jquery/GPL-LICENSE.txt delete mode 100644 bower_components/jquery/Makefile delete mode 100644 bower_components/jquery/README.md create mode 100644 bower_components/jquery/bower.json delete mode 100644 bower_components/jquery/build/freq.js delete mode 100644 bower_components/jquery/build/jslint-check.js delete mode 100644 bower_components/jquery/build/lib/jslint.js delete mode 100644 bower_components/jquery/build/lib/parse-js.js delete mode 100644 bower_components/jquery/build/lib/process.js delete mode 100644 bower_components/jquery/build/lib/squeeze-more.js delete mode 100644 bower_components/jquery/build/post-compile.js delete mode 100644 bower_components/jquery/build/release-notes.js delete mode 100644 bower_components/jquery/build/release-notes.txt delete mode 100644 bower_components/jquery/build/release.js delete mode 100644 bower_components/jquery/build/sizer.js delete mode 100644 bower_components/jquery/build/uglify.js delete mode 100755 bower_components/jquery/component.json create mode 100644 bower_components/jquery/dist/jquery.js create mode 100644 bower_components/jquery/dist/jquery.min.js create mode 100644 bower_components/jquery/dist/jquery.min.map delete mode 100755 bower_components/jquery/jquery.js delete mode 100644 bower_components/jquery/speed/benchmark.js delete mode 100644 bower_components/jquery/speed/benchmarker.css delete mode 100644 bower_components/jquery/speed/benchmarker.js delete mode 100644 bower_components/jquery/speed/closest.html delete mode 100644 bower_components/jquery/speed/css.html delete mode 100644 bower_components/jquery/speed/event.html delete mode 100644 bower_components/jquery/speed/filter.html delete mode 100644 bower_components/jquery/speed/find.html delete mode 100644 bower_components/jquery/speed/index.html delete mode 100644 bower_components/jquery/speed/jquery-basis.js delete mode 100644 bower_components/jquery/speed/slice.vs.concat.html create mode 100644 bower_components/jquery/src/ajax/load.js create mode 100644 bower_components/jquery/src/ajax/parseJSON.js create mode 100644 bower_components/jquery/src/ajax/parseXML.js create mode 100644 bower_components/jquery/src/ajax/var/nonce.js create mode 100644 bower_components/jquery/src/ajax/var/rquery.js create mode 100644 bower_components/jquery/src/attributes/attr.js create mode 100644 bower_components/jquery/src/attributes/classes.js create mode 100644 bower_components/jquery/src/attributes/prop.js create mode 100644 bower_components/jquery/src/attributes/support.js create mode 100644 bower_components/jquery/src/attributes/val.js create mode 100644 bower_components/jquery/src/core/access.js create mode 100644 bower_components/jquery/src/core/init.js create mode 100644 bower_components/jquery/src/core/parseHTML.js create mode 100644 bower_components/jquery/src/core/ready.js create mode 100644 bower_components/jquery/src/core/var/rsingleTag.js create mode 100644 bower_components/jquery/src/css/addGetHookIf.js create mode 100644 bower_components/jquery/src/css/curCSS.js create mode 100644 bower_components/jquery/src/css/defaultDisplay.js create mode 100644 bower_components/jquery/src/css/hiddenVisibleSelectors.js create mode 100644 bower_components/jquery/src/css/support.js create mode 100644 bower_components/jquery/src/css/swap.js create mode 100644 bower_components/jquery/src/css/var/cssExpand.js create mode 100644 bower_components/jquery/src/css/var/isHidden.js create mode 100644 bower_components/jquery/src/css/var/rmargin.js create mode 100644 bower_components/jquery/src/css/var/rnumnonpx.js create mode 100644 bower_components/jquery/src/data/accepts.js create mode 100644 bower_components/jquery/src/data/support.js create mode 100644 bower_components/jquery/src/deprecated.js create mode 100644 bower_components/jquery/src/effects/Tween.js create mode 100644 bower_components/jquery/src/effects/animatedSelector.js create mode 100644 bower_components/jquery/src/effects/support.js create mode 100644 bower_components/jquery/src/event/ajax.js create mode 100644 bower_components/jquery/src/event/alias.js create mode 100644 bower_components/jquery/src/event/support.js create mode 100644 bower_components/jquery/src/exports/amd.js create mode 100644 bower_components/jquery/src/exports/global.js create mode 100644 bower_components/jquery/src/jquery.js create mode 100644 bower_components/jquery/src/manipulation/_evalUrl.js create mode 100644 bower_components/jquery/src/manipulation/support.js create mode 100644 bower_components/jquery/src/manipulation/var/rcheckableType.js create mode 100644 bower_components/jquery/src/queue/delay.js rename bower_components/jquery/src/{sizzle-jquery.js => selector-sizzle.js} (57%) create mode 100644 bower_components/jquery/src/selector.js create mode 100644 bower_components/jquery/src/serialize.js create mode 100644 bower_components/jquery/src/sizzle/dist/sizzle.js create mode 100644 bower_components/jquery/src/sizzle/dist/sizzle.min.js create mode 100644 bower_components/jquery/src/sizzle/dist/sizzle.min.map create mode 100644 bower_components/jquery/src/traversing/findFilter.js create mode 100644 bower_components/jquery/src/traversing/var/rneedsContext.js create mode 100644 bower_components/jquery/src/var/class2type.js create mode 100644 bower_components/jquery/src/var/concat.js create mode 100644 bower_components/jquery/src/var/deletedIds.js create mode 100644 bower_components/jquery/src/var/hasOwn.js create mode 100644 bower_components/jquery/src/var/indexOf.js create mode 100644 bower_components/jquery/src/var/pnum.js create mode 100644 bower_components/jquery/src/var/push.js create mode 100644 bower_components/jquery/src/var/rnotwhite.js create mode 100644 bower_components/jquery/src/var/slice.js create mode 100644 bower_components/jquery/src/var/strundefined.js create mode 100644 bower_components/jquery/src/var/support.js create mode 100644 bower_components/jquery/src/var/toString.js create mode 100644 bower_components/jquery/src/wrap.js delete mode 100644 bower_components/jquery/test/csp.php delete mode 100644 bower_components/jquery/test/data/atom+xml.php delete mode 100644 bower_components/jquery/test/data/badjson.js delete mode 100644 bower_components/jquery/test/data/dashboard.xml delete mode 100644 bower_components/jquery/test/data/echoData.php delete mode 100644 bower_components/jquery/test/data/echoQuery.php delete mode 100644 bower_components/jquery/test/data/errorWithText.php delete mode 100644 bower_components/jquery/test/data/etag.php delete mode 100644 bower_components/jquery/test/data/headers.php delete mode 100644 bower_components/jquery/test/data/if_modified_since.php delete mode 100644 bower_components/jquery/test/data/iframe.html delete mode 100644 bower_components/jquery/test/data/json.php delete mode 100644 bower_components/jquery/test/data/json_obj.js delete mode 100644 bower_components/jquery/test/data/jsonp.php delete mode 100644 bower_components/jquery/test/data/name.html delete mode 100644 bower_components/jquery/test/data/name.php delete mode 100644 bower_components/jquery/test/data/offset/absolute.html delete mode 100644 bower_components/jquery/test/data/offset/body.html delete mode 100644 bower_components/jquery/test/data/offset/fixed.html delete mode 100644 bower_components/jquery/test/data/offset/relative.html delete mode 100644 bower_components/jquery/test/data/offset/scroll.html delete mode 100644 bower_components/jquery/test/data/offset/static.html delete mode 100644 bower_components/jquery/test/data/offset/table.html delete mode 100644 bower_components/jquery/test/data/params_html.php delete mode 100644 bower_components/jquery/test/data/readywaitasset.js delete mode 100644 bower_components/jquery/test/data/readywaitloader.js delete mode 100644 bower_components/jquery/test/data/script.php delete mode 100644 bower_components/jquery/test/data/selector/html5_selector.html delete mode 100644 bower_components/jquery/test/data/selector/sizzle_cache.html delete mode 100644 bower_components/jquery/test/data/statusText.php delete mode 100644 bower_components/jquery/test/data/support/bodyBackground.html delete mode 100644 bower_components/jquery/test/data/support/boxModelIE.html delete mode 100644 bower_components/jquery/test/data/support/hiddenIFrameFF.html delete mode 100644 bower_components/jquery/test/data/support/testElementCrash.html delete mode 100644 bower_components/jquery/test/data/test.html delete mode 100644 bower_components/jquery/test/data/test.js delete mode 100644 bower_components/jquery/test/data/test.php delete mode 100644 bower_components/jquery/test/data/test2.html delete mode 100644 bower_components/jquery/test/data/test3.html delete mode 100644 bower_components/jquery/test/data/testinit.js delete mode 100644 bower_components/jquery/test/data/testrunner.js delete mode 100644 bower_components/jquery/test/data/testsuite.css delete mode 100644 bower_components/jquery/test/data/text.php delete mode 100644 bower_components/jquery/test/data/ua.txt delete mode 100644 bower_components/jquery/test/data/versioncheck.js delete mode 100644 bower_components/jquery/test/data/with_fries.xml delete mode 100644 bower_components/jquery/test/data/with_fries_over_jsonp.php delete mode 100644 bower_components/jquery/test/delegatetest.html delete mode 100644 bower_components/jquery/test/hovertest.html delete mode 100644 bower_components/jquery/test/localfile.html delete mode 100644 bower_components/jquery/test/networkerror.html delete mode 100644 bower_components/jquery/test/polluted.php delete mode 100644 bower_components/jquery/test/readywait.html delete mode 100644 bower_components/jquery/test/unit/ajax.js delete mode 100644 bower_components/jquery/test/unit/attributes.js delete mode 100644 bower_components/jquery/test/unit/callbacks.js delete mode 100644 bower_components/jquery/test/unit/core.js delete mode 100644 bower_components/jquery/test/unit/css.js delete mode 100644 bower_components/jquery/test/unit/data.js delete mode 100644 bower_components/jquery/test/unit/deferred.js delete mode 100644 bower_components/jquery/test/unit/dimensions.js delete mode 100644 bower_components/jquery/test/unit/effects.js delete mode 100644 bower_components/jquery/test/unit/event.js delete mode 100644 bower_components/jquery/test/unit/manipulation.js delete mode 100644 bower_components/jquery/test/unit/offset.js delete mode 100644 bower_components/jquery/test/unit/queue.js delete mode 100644 bower_components/jquery/test/unit/selector.js delete mode 100644 bower_components/jquery/test/unit/support.js delete mode 100644 bower_components/jquery/test/unit/traversing.js delete mode 100644 bower_components/jquery/test/xhtml.php delete mode 100644 bower_components/jquery/version.txt create mode 100644 node_modules/jquery/.bowerrc create mode 100644 node_modules/jquery/.jscsrc create mode 100644 node_modules/jquery/.npmignore create mode 100644 node_modules/jquery/AUTHORS.txt create mode 100644 node_modules/jquery/CONTRIBUTING.md create mode 100644 node_modules/jquery/MIT-LICENSE.txt create mode 100644 node_modules/jquery/README.md create mode 100644 node_modules/jquery/bower.json create mode 100644 node_modules/jquery/dist/jquery.js create mode 100644 node_modules/jquery/dist/jquery.min.js create mode 100644 node_modules/jquery/dist/jquery.min.map create mode 100644 node_modules/jquery/package.json create mode 100644 node_modules/jquery/src/ajax.js create mode 100644 node_modules/jquery/src/ajax/jsonp.js create mode 100644 node_modules/jquery/src/ajax/load.js create mode 100644 node_modules/jquery/src/ajax/parseJSON.js create mode 100644 node_modules/jquery/src/ajax/parseXML.js create mode 100644 node_modules/jquery/src/ajax/script.js create mode 100644 node_modules/jquery/src/ajax/var/nonce.js create mode 100644 node_modules/jquery/src/ajax/var/rquery.js create mode 100644 node_modules/jquery/src/ajax/xhr.js create mode 100644 node_modules/jquery/src/attributes.js create mode 100644 node_modules/jquery/src/attributes/attr.js create mode 100644 node_modules/jquery/src/attributes/classes.js create mode 100644 node_modules/jquery/src/attributes/prop.js create mode 100644 node_modules/jquery/src/attributes/support.js create mode 100644 node_modules/jquery/src/attributes/val.js create mode 100644 node_modules/jquery/src/callbacks.js create mode 100644 node_modules/jquery/src/core.js create mode 100644 node_modules/jquery/src/core/access.js create mode 100644 node_modules/jquery/src/core/init.js create mode 100644 node_modules/jquery/src/core/parseHTML.js create mode 100644 node_modules/jquery/src/core/ready.js create mode 100644 node_modules/jquery/src/core/var/rsingleTag.js create mode 100644 node_modules/jquery/src/css.js create mode 100644 node_modules/jquery/src/css/addGetHookIf.js create mode 100644 node_modules/jquery/src/css/curCSS.js create mode 100644 node_modules/jquery/src/css/defaultDisplay.js create mode 100644 node_modules/jquery/src/css/hiddenVisibleSelectors.js create mode 100644 node_modules/jquery/src/css/support.js create mode 100644 node_modules/jquery/src/css/swap.js create mode 100644 node_modules/jquery/src/css/var/cssExpand.js create mode 100644 node_modules/jquery/src/css/var/isHidden.js create mode 100644 node_modules/jquery/src/css/var/rmargin.js create mode 100644 node_modules/jquery/src/css/var/rnumnonpx.js create mode 100644 node_modules/jquery/src/data.js create mode 100644 node_modules/jquery/src/data/accepts.js create mode 100644 node_modules/jquery/src/data/support.js create mode 100644 node_modules/jquery/src/deferred.js create mode 100644 node_modules/jquery/src/deprecated.js create mode 100644 node_modules/jquery/src/dimensions.js create mode 100644 node_modules/jquery/src/effects.js create mode 100644 node_modules/jquery/src/effects/Tween.js create mode 100644 node_modules/jquery/src/effects/animatedSelector.js create mode 100644 node_modules/jquery/src/effects/support.js create mode 100644 node_modules/jquery/src/event.js create mode 100644 node_modules/jquery/src/event/ajax.js create mode 100644 node_modules/jquery/src/event/alias.js create mode 100644 node_modules/jquery/src/event/support.js create mode 100644 node_modules/jquery/src/exports/amd.js create mode 100644 node_modules/jquery/src/exports/global.js create mode 100644 node_modules/jquery/src/intro.js create mode 100644 node_modules/jquery/src/jquery.js create mode 100644 node_modules/jquery/src/manipulation.js create mode 100644 node_modules/jquery/src/manipulation/_evalUrl.js create mode 100644 node_modules/jquery/src/manipulation/support.js create mode 100644 node_modules/jquery/src/manipulation/var/rcheckableType.js create mode 100644 node_modules/jquery/src/offset.js create mode 100644 node_modules/jquery/src/outro.js create mode 100644 node_modules/jquery/src/queue.js create mode 100644 node_modules/jquery/src/queue/delay.js create mode 100644 node_modules/jquery/src/selector-sizzle.js create mode 100644 node_modules/jquery/src/selector.js create mode 100644 node_modules/jquery/src/serialize.js create mode 100644 node_modules/jquery/src/sizzle/dist/sizzle.js create mode 100644 node_modules/jquery/src/sizzle/dist/sizzle.min.js create mode 100644 node_modules/jquery/src/sizzle/dist/sizzle.min.map create mode 100644 node_modules/jquery/src/sizzle/test/data/empty.js create mode 100644 node_modules/jquery/src/sizzle/test/data/mixed_sort.html create mode 100644 node_modules/jquery/src/sizzle/test/data/testinit.js rename {bower_components/jquery => node_modules/jquery/src/sizzle}/test/index.html (65%) create mode 100644 node_modules/jquery/src/sizzle/test/jquery.js create mode 100644 node_modules/jquery/src/sizzle/test/unit/extending.js create mode 100644 node_modules/jquery/src/sizzle/test/unit/selector.js create mode 100644 node_modules/jquery/src/sizzle/test/unit/utilities.js create mode 100644 node_modules/jquery/src/support.js create mode 100644 node_modules/jquery/src/traversing.js create mode 100644 node_modules/jquery/src/traversing/findFilter.js create mode 100644 node_modules/jquery/src/traversing/var/rneedsContext.js create mode 100644 node_modules/jquery/src/var/class2type.js create mode 100644 node_modules/jquery/src/var/concat.js create mode 100644 node_modules/jquery/src/var/deletedIds.js create mode 100644 node_modules/jquery/src/var/hasOwn.js create mode 100644 node_modules/jquery/src/var/indexOf.js create mode 100644 node_modules/jquery/src/var/pnum.js create mode 100644 node_modules/jquery/src/var/push.js create mode 100644 node_modules/jquery/src/var/rnotwhite.js create mode 100644 node_modules/jquery/src/var/slice.js create mode 100644 node_modules/jquery/src/var/strundefined.js create mode 100644 node_modules/jquery/src/var/support.js create mode 100644 node_modules/jquery/src/var/toString.js create mode 100644 node_modules/jquery/src/wrap.js create mode 100644 package.json diff --git a/bower.json b/bower.json index e2aa0d75..8a92e40e 100644 --- a/bower.json +++ b/bower.json @@ -13,7 +13,9 @@ "keywords": [ "flexslider", "jquery", - "slider" + "slider", + "woothemes", + "automattic" ], "license": "GPLv2 and later", "ignore": [ @@ -24,6 +26,6 @@ "tests" ], "dependencies": { - "jquery": "1.7.0" + "jquery": "1.11.3" } } diff --git a/bower_components/jquery/.bower.json b/bower_components/jquery/.bower.json index 1b339d17..c159ab22 100644 --- a/bower_components/jquery/.bower.json +++ b/bower_components/jquery/.bower.json @@ -1,17 +1,38 @@ { "name": "jquery", - "version": "1.7.0", - "main": "./jquery.js", - "dependencies": {}, + "version": "1.11.3", + "main": "dist/jquery.js", + "license": "MIT", + "ignore": [ + "**/.*", + "build", + "dist/cdn", + "speed", + "test", + "*.md", + "AUTHORS.txt", + "Gruntfile.js", + "package.json" + ], + "devDependencies": { + "sizzle": "2.1.1-jquery.2.1.2", + "requirejs": "2.1.10", + "qunit": "1.14.0", + "sinon": "1.8.1" + }, + "keywords": [ + "jquery", + "javascript", + "library" + ], "homepage": "https://github.com/jquery/jquery", - "_release": "1.7.0", + "_release": "1.11.3", "_resolution": { "type": "version", - "tag": "1.7.0", - "commit": "5876377b700b1bd26390a0a6d81e978dd822af14" + "tag": "1.11.3", + "commit": "1472290917f17af05e98007136096784f9051fab" }, "_source": "git://github.com/jquery/jquery.git", - "_target": "1.7.0", - "_originalSource": "jquery", - "_direct": true + "_target": "1.11.3", + "_originalSource": "jquery" } \ No newline at end of file diff --git a/bower_components/jquery/.gitattributes b/bower_components/jquery/.gitattributes deleted file mode 100644 index d6dc4705..00000000 --- a/bower_components/jquery/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -* eol=lf -*.jar binary diff --git a/bower_components/jquery/.gitignore b/bower_components/jquery/.gitignore deleted file mode 100644 index b3c04725..00000000 --- a/bower_components/jquery/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -src/selector.js -dist -.project -.settings -*~ -*.diff -*.patch -/*.html -.DS_Store -build/.sizecache.json diff --git a/bower_components/jquery/.gitmodules b/bower_components/jquery/.gitmodules deleted file mode 100644 index 19c60418..00000000 --- a/bower_components/jquery/.gitmodules +++ /dev/null @@ -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 diff --git a/bower_components/jquery/GPL-LICENSE.txt b/bower_components/jquery/GPL-LICENSE.txt deleted file mode 100644 index 11dddd00..00000000 --- a/bower_components/jquery/GPL-LICENSE.txt +++ /dev/null @@ -1,278 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. diff --git a/bower_components/jquery/MIT-LICENSE.txt b/bower_components/jquery/MIT-LICENSE.txt index 53270463..cdd31b5c 100644 --- a/bower_components/jquery/MIT-LICENSE.txt +++ b/bower_components/jquery/MIT-LICENSE.txt @@ -1,4 +1,5 @@ -Copyright (c) 2011 John Resig, http://jquery.com/ +Copyright 2014 jQuery Foundation and other contributors +http://jquery.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/bower_components/jquery/Makefile b/bower_components/jquery/Makefile deleted file mode 100644 index 77219e35..00000000 --- a/bower_components/jquery/Makefile +++ /dev/null @@ -1,136 +0,0 @@ -SRC_DIR = src -TEST_DIR = test -BUILD_DIR = build - -PREFIX = . -DIST_DIR = ${PREFIX}/dist - -JS_ENGINE ?= `which node nodejs` -COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe -POST_COMPILER = ${JS_ENGINE} ${BUILD_DIR}/post-compile.js - -BASE_FILES = ${SRC_DIR}/core.js\ - ${SRC_DIR}/callbacks.js\ - ${SRC_DIR}/deferred.js\ - ${SRC_DIR}/support.js\ - ${SRC_DIR}/data.js\ - ${SRC_DIR}/queue.js\ - ${SRC_DIR}/attributes.js\ - ${SRC_DIR}/event.js\ - ${SRC_DIR}/selector.js\ - ${SRC_DIR}/traversing.js\ - ${SRC_DIR}/manipulation.js\ - ${SRC_DIR}/css.js\ - ${SRC_DIR}/ajax.js\ - ${SRC_DIR}/ajax/jsonp.js\ - ${SRC_DIR}/ajax/script.js\ - ${SRC_DIR}/ajax/xhr.js\ - ${SRC_DIR}/effects.js\ - ${SRC_DIR}/offset.js\ - ${SRC_DIR}/dimensions.js - -MODULES = ${SRC_DIR}/intro.js\ - ${BASE_FILES}\ - ${SRC_DIR}/outro.js - -JQ = ${DIST_DIR}/jquery.js -JQ_MIN = ${DIST_DIR}/jquery.min.js - -SIZZLE_DIR = ${SRC_DIR}/sizzle - -JQ_VER = $(shell cat version.txt) -VER = sed "s/@VERSION/${JQ_VER}/" - -DATE=$(shell git log -1 --pretty=format:%ad) - -all: update_submodules core - -core: jquery min lint size - @@echo "jQuery build complete." - -${DIST_DIR}: - @@mkdir -p ${DIST_DIR} - -jquery: ${JQ} - -${JQ}: ${MODULES} | ${DIST_DIR} - @@echo "Building" ${JQ} - - @@cat ${MODULES} | \ - sed 's/.function..jQuery...{//' | \ - sed 's/}...jQuery..;//' | \ - sed 's/@DATE/'"${DATE}"'/' | \ - ${VER} > ${JQ}; - -${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js - @@echo "Building selector code from Sizzle" - @@sed '/EXPOSE/r src/sizzle-jquery.js' ${SIZZLE_DIR}/sizzle.js | grep -v window.Sizzle > ${SRC_DIR}/selector.js - -lint: jquery - @@if test ! -z ${JS_ENGINE}; then \ - 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 - -size: jquery min - @@if test ! -z ${JS_ENGINE}; then \ - gzip -c ${JQ_MIN} > ${JQ_MIN}.gz; \ - wc -c ${JQ} ${JQ_MIN} ${JQ_MIN}.gz | ${JS_ENGINE} ${BUILD_DIR}/sizer.js; \ - rm ${JQ_MIN}.gz; \ - else \ - echo "You must have NodeJS installed in order to size jQuery."; \ - fi - -freq: jquery min - @@if test ! -z ${JS_ENGINE}; then \ - ${JS_ENGINE} ${BUILD_DIR}/freq.js; \ - else \ - echo "You must have NodeJS installed to report the character frequency of minified jQuery."; \ - fi - -min: jquery ${JQ_MIN} - -${JQ_MIN}: ${JQ} - @@if test ! -z ${JS_ENGINE}; then \ - echo "Minifying jQuery" ${JQ_MIN}; \ - ${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \ - ${POST_COMPILER} ${JQ_MIN}.tmp > ${JQ_MIN}; \ - rm -f ${JQ_MIN}.tmp; \ - else \ - echo "You must have NodeJS installed in order to minify jQuery."; \ - fi - -clean: - @@echo "Removing Distribution directory:" ${DIST_DIR} - @@rm -rf ${DIST_DIR} - - @@echo "Removing built copy of Sizzle" - @@rm -f src/selector.js - -distclean: clean - @@echo "Removing submodules" - @@rm -rf test/qunit src/sizzle - -# change pointers for submodules and update them to what is specified in jQuery -# --merge doesn't work when doing an initial clone, thus test if we have non-existing -# submodules, then do an real update -update_submodules: - @@if [ -d .git ]; then \ - if git submodule status | grep -q -E '^-'; then \ - git submodule update --init --recursive; \ - else \ - git submodule update --init --recursive --merge; \ - fi; \ - fi; - -# update the submodules to the latest at the most logical branch -pull_submodules: - @@git submodule foreach "git pull \$$(git config remote.origin.url)" - @@git submodule summary - -pull: pull_submodules - @@git pull ${REMOTE} ${BRANCH} - -.PHONY: all jquery lint min clean distclean update_submodules pull_submodules pull core diff --git a/bower_components/jquery/README.md b/bower_components/jquery/README.md deleted file mode 100644 index a54a02df..00000000 --- a/bower_components/jquery/README.md +++ /dev/null @@ -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. diff --git a/bower_components/jquery/bower.json b/bower_components/jquery/bower.json new file mode 100644 index 00000000..5a7561c5 --- /dev/null +++ b/bower_components/jquery/bower.json @@ -0,0 +1,28 @@ +{ + "name": "jquery", + "version": "1.11.3", + "main": "dist/jquery.js", + "license": "MIT", + "ignore": [ + "**/.*", + "build", + "dist/cdn", + "speed", + "test", + "*.md", + "AUTHORS.txt", + "Gruntfile.js", + "package.json" + ], + "devDependencies": { + "sizzle": "2.1.1-jquery.2.1.2", + "requirejs": "2.1.10", + "qunit": "1.14.0", + "sinon": "1.8.1" + }, + "keywords": [ + "jquery", + "javascript", + "library" + ] +} diff --git a/bower_components/jquery/build/freq.js b/bower_components/jquery/build/freq.js deleted file mode 100644 index 0549f6af..00000000 --- a/bower_components/jquery/build/freq.js +++ /dev/null @@ -1,79 +0,0 @@ -#! /usr/bin/env node - -var fs = require( "fs" ); - -function isEmptyObject( obj ) { - for ( var name in obj ) { - return false; - } - return true; -} -function extend( obj ) { - var dest = obj, - src = [].slice.call( arguments, 1 ); - - Object.keys( src ).forEach(function( key ) { - var copy = src[ key ]; - - for ( var prop in copy ) { - dest[ prop ] = copy[ prop ]; - } - }); - - return dest; -}; - -function charSort( obj, callback ) { - - var ordered = [], - table = {}, - copied; - - copied = extend({}, obj ); - - (function order() { - - var largest = 0, - c; - - for ( var i in obj ) { - if ( obj[ i ] >= largest ) { - largest = obj[ i ]; - c = i; - } - } - - ordered.push( c ); - delete obj[ c ]; - - if ( !isEmptyObject( obj ) ) { - order(); - } else { - ordered.forEach(function( val ) { - table[ val ] = copied[ val ]; - }); - - callback( table ); - } - - })(); -} -function charFrequency( src, callback ) { - var obj = {}; - - src.replace(/[^\w]|\d/gi, "").split("").forEach(function( c ) { - obj[ c ] ? ++obj[ c ] : ( obj[ c ] = 1 ); - }); - - return charSort( obj, callback ); -} - - -charFrequency( fs.readFileSync( "dist/jquery.min.js", "utf8" ), function( obj ) { - var chr; - - for ( chr in obj ) { - console.log( " " + chr + " " + obj[ chr ] ); - } -}); - diff --git a/bower_components/jquery/build/jslint-check.js b/bower_components/jquery/build/jslint-check.js deleted file mode 100644 index 72d67018..00000000 --- a/bower_components/jquery/build/jslint-check.js +++ /dev/null @@ -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" ); -} diff --git a/bower_components/jquery/build/lib/jslint.js b/bower_components/jquery/build/lib/jslint.js deleted file mode 100644 index f563292b..00000000 --- a/bower_components/jquery/build/lib/jslint.js +++ /dev/null @@ -1,5504 +0,0 @@ -// jslint.js -// 2010-02-20 - -/* -Copyright (c) 2002 Douglas Crockford (www.JSLint.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. -*/ - -/* - JSLINT is a global function. It takes two parameters. - - var myResult = JSLINT(source, option); - - The first parameter is either a string or an array of strings. If it is a - string, it will be split on '\n' or '\r'. If it is an array of strings, it - is assumed that each string represents one line. The source can be a - JavaScript text, or HTML text, or a Konfabulator text. - - The second parameter is an optional object of options which control the - operation of JSLINT. Most of the options are booleans: They are all are - optional and have a default value of false. - - If it checks out, JSLINT returns true. Otherwise, it returns false. - - If false, you can inspect JSLINT.errors to find out the problems. - JSLINT.errors is an array of objects containing these members: - - { - line : The line (relative to 0) at which the lint was found - character : The character (relative to 0) at which the lint was found - reason : The problem - evidence : The text line in which the problem occurred - raw : The raw message before the details were inserted - a : The first detail - b : The second detail - c : The third detail - d : The fourth detail - } - - If a fatal error was found, a null will be the last element of the - JSLINT.errors array. - - You can request a Function Report, which shows all of the functions - and the parameters and vars that they use. This can be used to find - implied global variables and other problems. The report is in HTML and - can be inserted in an HTML . - - var myReport = JSLINT.report(limited); - - If limited is true, then the report will be limited to only errors. - - You can request a data structure which contains JSLint's results. - - var myData = JSLINT.data(); - - It returns a structure with this form: - - { - errors: [ - { - line: NUMBER, - character: NUMBER, - reason: STRING, - evidence: STRING - } - ], - functions: [ - name: STRING, - line: NUMBER, - last: NUMBER, - param: [ - STRING - ], - closure: [ - STRING - ], - var: [ - STRING - ], - exception: [ - STRING - ], - outer: [ - STRING - ], - unused: [ - STRING - ], - global: [ - STRING - ], - label: [ - STRING - ] - ], - globals: [ - STRING - ], - member: { - STRING: NUMBER - }, - unuseds: [ - { - name: STRING, - line: NUMBER - } - ], - implieds: [ - { - name: STRING, - line: NUMBER - } - ], - urls: [ - STRING - ], - json: BOOLEAN - } - - Empty arrays will not be included. - -*/ - -/*jslint - evil: true, nomen: false, onevar: false, regexp: false, strict: true -*/ - -/*members "\b", "\t", "\n", "\f", "\r", "!=", "!==", "\"", "%", - "(begin)", "(breakage)", "(context)", "(error)", "(global)", - "(identifier)", "(last)", "(line)", "(loopage)", "(name)", "(onevar)", - "(params)", "(scope)", "(verb)", "*", "+", "++", "-", "--", "\/", - "<", "<=", "==", "===", ">", ">=", ADSAFE, Array, Boolean, - COM, Canvas, CustomAnimation, Date, Debug, E, Error, EvalError, - FadeAnimation, Flash, FormField, Frame, Function, HotKey, Image, JSON, - LN10, LN2, LOG10E, LOG2E, MAX_VALUE, MIN_VALUE, Math, MenuItem, - MoveAnimation, NEGATIVE_INFINITY, Number, Object, Option, PI, - POSITIVE_INFINITY, Point, RangeError, Rectangle, ReferenceError, RegExp, - ResizeAnimation, RotateAnimation, SQRT1_2, SQRT2, ScrollBar, String, - Style, SyntaxError, System, Text, TextArea, Timer, TypeError, URIError, - URL, Web, Window, XMLDOM, XMLHttpRequest, "\\", a, abbr, acronym, - addEventListener, address, adsafe, alert, aliceblue, animator, - antiquewhite, appleScript, applet, apply, approved, aqua, aquamarine, - area, arguments, arity, autocomplete, azure, b, background, - "background-attachment", "background-color", "background-image", - "background-position", "background-repeat", base, bdo, beep, beige, big, - bisque, bitwise, black, blanchedalmond, block, blockquote, blue, - blueviolet, blur, body, border, "border-bottom", "border-bottom-color", - "border-bottom-style", "border-bottom-width", "border-collapse", - "border-color", "border-left", "border-left-color", "border-left-style", - "border-left-width", "border-right", "border-right-color", - "border-right-style", "border-right-width", "border-spacing", - "border-style", "border-top", "border-top-color", "border-top-style", - "border-top-width", "border-width", bottom, br, brown, browser, - burlywood, button, bytesToUIString, c, cadetblue, call, callee, caller, - canvas, cap, caption, "caption-side", cases, center, charAt, charCodeAt, - character, chartreuse, chocolate, chooseColor, chooseFile, chooseFolder, - cite, clear, clearInterval, clearTimeout, clip, close, closeWidget, - closed, closure, cm, code, col, colgroup, color, comment, condition, - confirm, console, constructor, content, convertPathToHFS, - convertPathToPlatform, coral, cornflowerblue, cornsilk, - "counter-increment", "counter-reset", create, crimson, css, cursor, - cyan, d, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen, - darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, - darksalmon, darkseagreen, darkslateblue, darkslategray, darkturquoise, - darkviolet, data, dd, debug, decodeURI, decodeURIComponent, deeppink, - deepskyblue, defaultStatus, defineClass, del, deserialize, devel, dfn, - dimension, dimgray, dir, direction, display, div, dl, document, - dodgerblue, dt, edition, else, em, embed, empty, "empty-cells", - encodeURI, encodeURIComponent, entityify, eqeqeq, errors, escape, eval, - event, evidence, evil, ex, exception, exec, exps, fieldset, filesystem, - firebrick, first, float, floor, floralwhite, focus, focusWidget, font, - "font-face", "font-family", "font-size", "font-size-adjust", - "font-stretch", "font-style", "font-variant", "font-weight", - forestgreen, forin, form, fragment, frame, frames, frameset, from, - fromCharCode, fuchsia, fud, funct, function, functions, g, gainsboro, - gc, getComputedStyle, ghostwhite, global, globals, gold, goldenrod, - gray, green, greenyellow, h1, h2, h3, h4, h5, h6, hasOwnProperty, head, - height, help, history, honeydew, hotpink, hr, html, i, iTunes, id, - identifier, iframe, img, immed, implieds, in, include, indent, indexOf, - indianred, indigo, init, input, ins, isAlpha, isApplicationRunning, - isDigit, isFinite, isNaN, ivory, join, jslint, json, kbd, khaki, - konfabulatorVersion, label, labelled, lang, last, lavender, - lavenderblush, lawngreen, laxbreak, lbp, led, left, legend, - lemonchiffon, length, "letter-spacing", li, lib, lightblue, lightcoral, - lightcyan, lightgoldenrodyellow, lightgreen, lightpink, lightsalmon, - lightseagreen, lightskyblue, lightslategray, lightsteelblue, - lightyellow, lime, limegreen, line, "line-height", linen, link, - "list-style", "list-style-image", "list-style-position", - "list-style-type", load, loadClass, location, log, m, magenta, map, - margin, "margin-bottom", "margin-left", "margin-right", "margin-top", - "marker-offset", maroon, match, "max-height", "max-width", maxerr, maxlen, - md5, media, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, - mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, - mediumvioletred, member, menu, message, meta, midnightblue, - "min-height", "min-width", mintcream, mistyrose, mm, moccasin, moveBy, - moveTo, name, navajowhite, navigator, navy, new, newcap, noframes, - nomen, noscript, nud, object, ol, oldlace, olive, olivedrab, on, - onbeforeunload, onblur, onerror, onevar, onfocus, onload, onresize, - onunload, opacity, open, openURL, opener, opera, optgroup, option, - orange, orangered, orchid, outer, outline, "outline-color", - "outline-style", "outline-width", overflow, "overflow-x", "overflow-y", - p, padding, "padding-bottom", "padding-left", "padding-right", - "padding-top", page, "page-break-after", "page-break-before", - palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, - param, parent, parseFloat, parseInt, passfail, pc, peachpuff, peru, - pink, play, plum, plusplus, pop, popupMenu, position, powderblue, pre, - predef, preferenceGroups, preferences, print, prompt, prototype, pt, - purple, push, px, q, quit, quotes, random, range, raw, reach, readFile, - readUrl, reason, red, regexp, reloadWidget, removeEventListener, - replace, report, reserved, resizeBy, resizeTo, resolvePath, - resumeUpdates, rhino, right, rosybrown, royalblue, runCommand, - runCommandInBg, saddlebrown, safe, salmon, samp, sandybrown, saveAs, - savePreferences, screen, script, scroll, scrollBy, scrollTo, seagreen, - seal, search, seashell, select, serialize, setInterval, setTimeout, - shift, showWidgetPreferences, sidebar, sienna, silver, skyblue, - slateblue, slategray, sleep, slice, small, snow, sort, span, spawn, - speak, split, springgreen, src, status, steelblue, strict, strong, - style, styleproperty, sub, substr, sup, supplant, suppressUpdates, sync, - system, table, "table-layout", tan, tbody, td, teal, tellWidget, test, - "text-align", "text-decoration", "text-indent", "text-shadow", - "text-transform", textarea, tfoot, th, thead, thistle, title, - toLowerCase, toString, toUpperCase, toint32, token, tomato, top, tr, tt, - turquoise, type, u, ul, undef, unescape, "unicode-bidi", unused, - unwatch, updateNow, urls, value, valueOf, var, version, - "vertical-align", violet, visibility, watch, wheat, white, - "white-space", whitesmoke, widget, width, "word-spacing", "word-wrap", - yahooCheckLogin, yahooLogin, yahooLogout, yellow, yellowgreen, - "z-index" -*/ - - -// We build the application inside a function so that we produce only a single -// global variable. The function will be invoked, its return value is the JSLINT -// application itself. - -"use strict"; - -var JSLINT = (function () { - var adsafe_id, // The widget's ADsafe id. - adsafe_may, // The widget may load approved scripts. - adsafe_went, // ADSAFE.go has been called. - anonname, // The guessed name for anonymous functions. - approved, // ADsafe approved urls. - - atrule = { - media : true, - 'font-face': true, - page : true - }, - -// These are operators that should not be used with the ! operator. - - bang = { - '<': true, - '<=': true, - '==': true, - '===': true, - '!==': true, - '!=': true, - '>': true, - '>=': true, - '+': true, - '-': true, - '*': true, - '/': true, - '%': true - }, - -// These are members that should not be permitted in the safe subset. - - banned = { // the member names that ADsafe prohibits. - 'arguments' : true, - callee : true, - caller : true, - constructor : true, - 'eval' : true, - prototype : true, - unwatch : true, - valueOf : true, - watch : true - }, - - -// These are the JSLint boolean options. - - boolOptions = { - adsafe : true, // if ADsafe should be enforced - bitwise : true, // if bitwise operators should not be allowed - browser : true, // if the standard browser globals should be predefined - cap : true, // if upper case HTML should be allowed - css : true, // if CSS workarounds should be tolerated - debug : true, // if debugger statements should be allowed - devel : true, // if logging should be allowed (console, alert, etc.) - eqeqeq : true, // if === should be required - evil : true, // if eval should be allowed - forin : true, // if for in statements must filter - fragment : true, // if HTML fragments should be allowed - immed : true, // if immediate invocations must be wrapped in parens - laxbreak : true, // if line breaks should not be checked - newcap : true, // if constructor names must be capitalized - nomen : true, // if names should be checked - on : true, // if HTML event handlers should be allowed - onevar : true, // if only one var statement per function should be allowed - passfail : true, // if the scan should stop on first error - plusplus : true, // if increment/decrement should not be allowed - regexp : true, // if the . should not be allowed in regexp literals - rhino : true, // if the Rhino environment globals should be predefined - undef : true, // if variables should be declared before used - safe : true, // if use of some browser features should be restricted - sidebar : true, // if the System object should be predefined - strict : true, // require the "use strict"; pragma - sub : true, // if all forms of subscript notation are tolerated - white : true, // if strict whitespace rules apply - widget : true // if the Yahoo Widgets globals should be predefined - }, - -// browser contains a set of global names which are commonly provided by a -// web browser environment. - - browser = { - addEventListener: false, - blur : false, - clearInterval : false, - clearTimeout : false, - close : false, - closed : false, - defaultStatus : false, - document : false, - event : false, - focus : false, - frames : false, - getComputedStyle: false, - history : false, - Image : false, - length : false, - location : false, - moveBy : false, - moveTo : false, - name : false, - navigator : false, - onbeforeunload : true, - onblur : true, - onerror : true, - onfocus : true, - onload : true, - onresize : true, - onunload : true, - open : false, - opener : false, - Option : false, - parent : false, - print : false, - removeEventListener: false, - resizeBy : false, - resizeTo : false, - screen : false, - scroll : false, - scrollBy : false, - scrollTo : false, - setInterval : false, - setTimeout : false, - status : false, - top : false, - XMLHttpRequest : false - }, - - cssAttributeData, - cssAny, - - cssColorData = { - "aliceblue" : true, - "antiquewhite" : true, - "aqua" : true, - "aquamarine" : true, - "azure" : true, - "beige" : true, - "bisque" : true, - "black" : true, - "blanchedalmond" : true, - "blue" : true, - "blueviolet" : true, - "brown" : true, - "burlywood" : true, - "cadetblue" : true, - "chartreuse" : true, - "chocolate" : true, - "coral" : true, - "cornflowerblue" : true, - "cornsilk" : true, - "crimson" : true, - "cyan" : true, - "darkblue" : true, - "darkcyan" : true, - "darkgoldenrod" : true, - "darkgray" : true, - "darkgreen" : true, - "darkkhaki" : true, - "darkmagenta" : true, - "darkolivegreen" : true, - "darkorange" : true, - "darkorchid" : true, - "darkred" : true, - "darksalmon" : true, - "darkseagreen" : true, - "darkslateblue" : true, - "darkslategray" : true, - "darkturquoise" : true, - "darkviolet" : true, - "deeppink" : true, - "deepskyblue" : true, - "dimgray" : true, - "dodgerblue" : true, - "firebrick" : true, - "floralwhite" : true, - "forestgreen" : true, - "fuchsia" : true, - "gainsboro" : true, - "ghostwhite" : true, - "gold" : true, - "goldenrod" : true, - "gray" : true, - "green" : true, - "greenyellow" : true, - "honeydew" : true, - "hotpink" : true, - "indianred" : true, - "indigo" : true, - "ivory" : true, - "khaki" : true, - "lavender" : true, - "lavenderblush" : true, - "lawngreen" : true, - "lemonchiffon" : true, - "lightblue" : true, - "lightcoral" : true, - "lightcyan" : true, - "lightgoldenrodyellow" : true, - "lightgreen" : true, - "lightpink" : true, - "lightsalmon" : true, - "lightseagreen" : true, - "lightskyblue" : true, - "lightslategray" : true, - "lightsteelblue" : true, - "lightyellow" : true, - "lime" : true, - "limegreen" : true, - "linen" : true, - "magenta" : true, - "maroon" : true, - "mediumaquamarine" : true, - "mediumblue" : true, - "mediumorchid" : true, - "mediumpurple" : true, - "mediumseagreen" : true, - "mediumslateblue" : true, - "mediumspringgreen" : true, - "mediumturquoise" : true, - "mediumvioletred" : true, - "midnightblue" : true, - "mintcream" : true, - "mistyrose" : true, - "moccasin" : true, - "navajowhite" : true, - "navy" : true, - "oldlace" : true, - "olive" : true, - "olivedrab" : true, - "orange" : true, - "orangered" : true, - "orchid" : true, - "palegoldenrod" : true, - "palegreen" : true, - "paleturquoise" : true, - "palevioletred" : true, - "papayawhip" : true, - "peachpuff" : true, - "peru" : true, - "pink" : true, - "plum" : true, - "powderblue" : true, - "purple" : true, - "red" : true, - "rosybrown" : true, - "royalblue" : true, - "saddlebrown" : true, - "salmon" : true, - "sandybrown" : true, - "seagreen" : true, - "seashell" : true, - "sienna" : true, - "silver" : true, - "skyblue" : true, - "slateblue" : true, - "slategray" : true, - "snow" : true, - "springgreen" : true, - "steelblue" : true, - "tan" : true, - "teal" : true, - "thistle" : true, - "tomato" : true, - "turquoise" : true, - "violet" : true, - "wheat" : true, - "white" : true, - "whitesmoke" : true, - "yellow" : true, - "yellowgreen" : true - }, - - cssBorderStyle, - cssBreak, - - cssLengthData = { - '%': true, - 'cm': true, - 'em': true, - 'ex': true, - 'in': true, - 'mm': true, - 'pc': true, - 'pt': true, - 'px': true - }, - - cssOverflow, - - devel = { - alert : false, - confirm : false, - console : false, - Debug : false, - opera : false, - prompt : false - }, - - escapes = { - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '/' : '\\/', - '\\': '\\\\' - }, - - funct, // The current function - - functionicity = [ - 'closure', 'exception', 'global', 'label', - 'outer', 'unused', 'var' - ], - - functions, // All of the functions - - global, // The global scope - htmltag = { - a: {}, - abbr: {}, - acronym: {}, - address: {}, - applet: {}, - area: {empty: true, parent: ' map '}, - b: {}, - base: {empty: true, parent: ' head '}, - bdo: {}, - big: {}, - blockquote: {}, - body: {parent: ' html noframes '}, - br: {empty: true}, - button: {}, - canvas: {parent: ' body p div th td '}, - caption: {parent: ' table '}, - center: {}, - cite: {}, - code: {}, - col: {empty: true, parent: ' table colgroup '}, - colgroup: {parent: ' table '}, - dd: {parent: ' dl '}, - del: {}, - dfn: {}, - dir: {}, - div: {}, - dl: {}, - dt: {parent: ' dl '}, - em: {}, - embed: {}, - fieldset: {}, - font: {}, - form: {}, - frame: {empty: true, parent: ' frameset '}, - frameset: {parent: ' html frameset '}, - h1: {}, - h2: {}, - h3: {}, - h4: {}, - h5: {}, - h6: {}, - head: {parent: ' html '}, - html: {parent: '*'}, - hr: {empty: true}, - i: {}, - iframe: {}, - img: {empty: true}, - input: {empty: true}, - ins: {}, - kbd: {}, - label: {}, - legend: {parent: ' fieldset '}, - li: {parent: ' dir menu ol ul '}, - link: {empty: true, parent: ' head '}, - map: {}, - menu: {}, - meta: {empty: true, parent: ' head noframes noscript '}, - noframes: {parent: ' html body '}, - noscript: {parent: ' body head noframes '}, - object: {}, - ol: {}, - optgroup: {parent: ' select '}, - option: {parent: ' optgroup select '}, - p: {}, - param: {empty: true, parent: ' applet object '}, - pre: {}, - q: {}, - samp: {}, - script: {empty: true, parent: ' body div frame head iframe p pre span '}, - select: {}, - small: {}, - span: {}, - strong: {}, - style: {parent: ' head ', empty: true}, - sub: {}, - sup: {}, - table: {}, - tbody: {parent: ' table '}, - td: {parent: ' tr '}, - textarea: {}, - tfoot: {parent: ' table '}, - th: {parent: ' tr '}, - thead: {parent: ' table '}, - title: {parent: ' head '}, - tr: {parent: ' table tbody thead tfoot '}, - tt: {}, - u: {}, - ul: {}, - 'var': {} - }, - - ids, // HTML ids - implied, // Implied globals - inblock, - indent, - jsonmode, - lines, - lookahead, - member, - membersOnly, - nexttoken, - noreach, - option, - predefined, // Global variables defined by option - prereg, - prevtoken, - - rhino = { - defineClass : false, - deserialize : false, - gc : false, - help : false, - load : false, - loadClass : false, - print : false, - quit : false, - readFile : false, - readUrl : false, - runCommand : false, - seal : false, - serialize : false, - spawn : false, - sync : false, - toint32 : false, - version : false - }, - - scope, // The current scope - - sidebar = { - System : false - }, - - src, - stack, - -// standard contains the global names that are provided by the -// ECMAScript standard. - - standard = { - Array : false, - Boolean : false, - Date : false, - decodeURI : false, - decodeURIComponent : false, - encodeURI : false, - encodeURIComponent : false, - Error : false, - 'eval' : false, - EvalError : false, - Function : false, - hasOwnProperty : false, - isFinite : false, - isNaN : false, - JSON : false, - Math : false, - Number : false, - Object : false, - parseInt : false, - parseFloat : false, - RangeError : false, - ReferenceError : false, - RegExp : false, - String : false, - SyntaxError : false, - TypeError : false, - URIError : false - }, - - standard_member = { - E : true, - LN2 : true, - LN10 : true, - LOG2E : true, - LOG10E : true, - PI : true, - SQRT1_2 : true, - SQRT2 : true, - MAX_VALUE : true, - MIN_VALUE : true, - NEGATIVE_INFINITY : true, - POSITIVE_INFINITY : true - }, - - strict_mode, - syntax = {}, - tab, - token, - urls, - warnings, - -// widget contains the global names which are provided to a Yahoo -// (fna Konfabulator) widget. - - widget = { - alert : true, - animator : true, - appleScript : true, - beep : true, - bytesToUIString : true, - Canvas : true, - chooseColor : true, - chooseFile : true, - chooseFolder : true, - closeWidget : true, - COM : true, - convertPathToHFS : true, - convertPathToPlatform : true, - CustomAnimation : true, - escape : true, - FadeAnimation : true, - filesystem : true, - Flash : true, - focusWidget : true, - form : true, - FormField : true, - Frame : true, - HotKey : true, - Image : true, - include : true, - isApplicationRunning : true, - iTunes : true, - konfabulatorVersion : true, - log : true, - md5 : true, - MenuItem : true, - MoveAnimation : true, - openURL : true, - play : true, - Point : true, - popupMenu : true, - preferenceGroups : true, - preferences : true, - print : true, - prompt : true, - random : true, - Rectangle : true, - reloadWidget : true, - ResizeAnimation : true, - resolvePath : true, - resumeUpdates : true, - RotateAnimation : true, - runCommand : true, - runCommandInBg : true, - saveAs : true, - savePreferences : true, - screen : true, - ScrollBar : true, - showWidgetPreferences : true, - sleep : true, - speak : true, - Style : true, - suppressUpdates : true, - system : true, - tellWidget : true, - Text : true, - TextArea : true, - Timer : true, - unescape : true, - updateNow : true, - URL : true, - Web : true, - widget : true, - Window : true, - XMLDOM : true, - XMLHttpRequest : true, - yahooCheckLogin : true, - yahooLogin : true, - yahooLogout : true - }, - -// xmode is used to adapt to the exceptions in html parsing. -// It can have these states: -// false .js script file -// html -// outer -// script -// style -// scriptstring -// styleproperty - - xmode, - xquote, - -// unsafe comment or string - ax = /@cc|<\/?|script|\]*s\]|<\s*!|</i, -// unsafe characters that are silently deleted by one or more browsers - cx = /[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/, -// token - tx = /^\s*([(){}\[.,:;'"~\?\]#@]|==?=?|\/(\*(jslint|members?|global)?|=|\/)?|\*[\/=]?|\+[+=]?|-[\-=]?|%=?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/, -// html token -//////// hx = /^\s*(['"=>\/&#]|<(?:\/|\!(?:--)?)?|[a-zA-Z][a-zA-Z0-9_\-]*|[0-9]+|--|.)/, - hx = /^\s*(['"=>\/&#]|<(?:\/|\!(?:--)?)?|[a-zA-Z][a-zA-Z0-9_\-]*|[0-9]+|--)/, -// characters in strings that need escapement - nx = /[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/, - nxg = /[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, -// outer html token - ox = /[>&]|<[\/!]?|--/, -// star slash - lx = /\*\/|\/\*/, -// identifier - ix = /^([a-zA-Z_$][a-zA-Z0-9_$]*)$/, -// javascript url - jx = /^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i, -// url badness - ux = /&|\+|\u00AD|\.\.|\/\*|%[^;]|base64|url|expression|data|mailto/i, -// style - sx = /^\s*([{:#%.=,>+\[\]@()"';]|\*=?|\$=|\|=|\^=|~=|[a-zA-Z_][a-zA-Z0-9_\-]*|[0-9]+|<\/|\/\*)/, - ssx = /^\s*([@#!"'};:\-%.=,+\[\]()*_]|[a-zA-Z][a-zA-Z0-9._\-]*|\/\*?|\d+(?:\.\d+)?|<\/)/, -// attributes characters - qx = /[^a-zA-Z0-9-_\/ ]/, -// query characters for ids - dx = /[\[\]\/\\"'*<>.&:(){}+=#]/, - - rx = { - outer: hx, - html: hx, - style: sx, - styleproperty: ssx - }; - - function F() {} - - if (typeof Object.create !== 'function') { - Object.create = function (o) { - F.prototype = o; - return new F(); - }; - } - - - function is_own(object, name) { - return Object.prototype.hasOwnProperty.call(object, name); - } - - - function combine(t, o) { - var n; - for (n in o) { - if (is_own(o, n)) { - t[n] = o[n]; - } - } - } - - String.prototype.entityify = function () { - return this. - replace(/&/g, '&'). - replace(//g, '>'); - }; - - String.prototype.isAlpha = function () { - return (this >= 'a' && this <= 'z\uffff') || - (this >= 'A' && this <= 'Z\uffff'); - }; - - - String.prototype.isDigit = function () { - return (this >= '0' && this <= '9'); - }; - - - String.prototype.supplant = function (o) { - return this.replace(/\{([^{}]*)\}/g, function (a, b) { - var r = o[b]; - return typeof r === 'string' || typeof r === 'number' ? r : a; - }); - }; - - String.prototype.name = function () { - -// If the string looks like an identifier, then we can return it as is. -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can simply slap some quotes around it. -// Otherwise we must also replace the offending characters with safe -// sequences. - - if (ix.test(this)) { - return this; - } - if (nx.test(this)) { - return '"' + this.replace(nxg, function (a) { - var c = escapes[a]; - if (c) { - return c; - } - return '\\u' + ('0000' + a.charCodeAt().toString(16)).slice(-4); - }) + '"'; - } - return '"' + this + '"'; - }; - - - function assume() { - if (!option.safe) { - if (option.rhino) { - combine(predefined, rhino); - } - if (option.devel) { - combine(predefined, devel); - } - if (option.browser || option.sidebar) { - combine(predefined, browser); - } - if (option.sidebar) { - combine(predefined, sidebar); - } - if (option.widget) { - combine(predefined, widget); - } - } - } - - -// Produce an error warning. - - function quit(m, l, ch) { - throw { - name: 'JSLintError', - line: l, - character: ch, - message: m + " (" + Math.floor((l / lines.length) * 100) + - "% scanned)." - }; - } - - function warning(m, t, a, b, c, d) { - var ch, l, w; - t = t || nexttoken; - if (t.id === '(end)') { // `~ - t = token; - } - l = t.line || 0; - ch = t.from || 0; - w = { - id: '(error)', - raw: m, - evidence: lines[l - 1] || '', - line: l, - character: ch, - a: a, - b: b, - c: c, - d: d - }; - w.reason = m.supplant(w); - JSLINT.errors.push(w); - if (option.passfail) { - quit('Stopping. ', l, ch); - } - warnings += 1; - if (warnings >= option.maxerr) { - quit("Too many errors.", l, ch); - } - return w; - } - - function warningAt(m, l, ch, a, b, c, d) { - return warning(m, { - line: l, - from: ch - }, a, b, c, d); - } - - function error(m, t, a, b, c, d) { - var w = warning(m, t, a, b, c, d); - quit("Stopping, unable to continue.", w.line, w.character); - } - - function errorAt(m, l, ch, a, b, c, d) { - return error(m, { - line: l, - from: ch - }, a, b, c, d); - } - - - -// lexical analysis - - var lex = (function lex() { - var character, from, line, s; - -// Private lex methods - - function nextLine() { - var at; - if (line >= lines.length) { - return false; - } - character = 1; - s = lines[line]; - line += 1; - at = s.search(/ \t/); - if (at >= 0) { - warningAt("Mixed spaces and tabs.", line, at + 1); - } - s = s.replace(/\t/g, tab); - at = s.search(cx); - if (at >= 0) { - warningAt("Unsafe character.", line, at); - } - if (option.maxlen && option.maxlen < s.length) { - warningAt("Line too long.", line, s.length); - } - return true; - } - -// Produce a token object. The token inherits from a syntax symbol. - - function it(type, value) { - var i, t; - if (type === '(color)') { - t = {type: type}; - } else if (type === '(punctuator)' || - (type === '(identifier)' && is_own(syntax, value))) { - t = syntax[value] || syntax['(error)']; - } else { - t = syntax[type]; - } - t = Object.create(t); - if (type === '(string)' || type === '(range)') { - if (jx.test(value)) { - warningAt("Script URL.", line, from); - } - } - if (type === '(identifier)') { - t.identifier = true; - if (value === '__iterator__' || value === '__proto__') { - errorAt("Reserved name '{a}'.", - line, from, value); - } else if (option.nomen && - (value.charAt(0) === '_' || - value.charAt(value.length - 1) === '_')) { - warningAt("Unexpected {a} in '{b}'.", line, from, - "dangling '_'", value); - } - } - t.value = value; - t.line = line; - t.character = character; - t.from = from; - i = t.id; - if (i !== '(endline)') { - prereg = i && - (('(,=:[!&|?{};'.indexOf(i.charAt(i.length - 1)) >= 0) || - i === 'return'); - } - return t; - } - -// Public lex methods - - return { - init: function (source) { - if (typeof source === 'string') { - lines = source. - replace(/\r\n/g, '\n'). - replace(/\r/g, '\n'). - split('\n'); - } else { - lines = source; - } - line = 0; - nextLine(); - from = 1; - }, - - range: function (begin, end) { - var c, value = ''; - from = character; - if (s.charAt(0) !== begin) { - errorAt("Expected '{a}' and instead saw '{b}'.", - line, character, begin, s.charAt(0)); - } - for (;;) { - s = s.slice(1); - character += 1; - c = s.charAt(0); - switch (c) { - case '': - errorAt("Missing '{a}'.", line, character, c); - break; - case end: - s = s.slice(1); - character += 1; - return it('(range)', value); - case xquote: - case '\\': - warningAt("Unexpected '{a}'.", line, character, c); - } - value += c; - } - - }, - -// token -- this is called by advance to get the next token. - - token: function () { - var b, c, captures, d, depth, high, i, l, low, q, t; - - function match(x) { - var r = x.exec(s), r1; - if (r) { - l = r[0].length; - r1 = r[1]; - c = r1.charAt(0); - s = s.substr(l); - from = character + l - r1.length; - character += l; - return r1; - } - } - - function string(x) { - var c, j, r = ''; - - if (jsonmode && x !== '"') { - warningAt("Strings must use doublequote.", - line, character); - } - - if (xquote === x || (xmode === 'scriptstring' && !xquote)) { - return it('(punctuator)', x); - } - - function esc(n) { - var i = parseInt(s.substr(j + 1, n), 16); - j += n; - if (i >= 32 && i <= 126 && - i !== 34 && i !== 92 && i !== 39) { - warningAt("Unnecessary escapement.", line, character); - } - character += n; - c = String.fromCharCode(i); - } - j = 0; - for (;;) { - while (j >= s.length) { - j = 0; - if (xmode !== 'html' || !nextLine()) { - errorAt("Unclosed string.", line, from); - } - } - c = s.charAt(j); - if (c === x) { - character += 1; - s = s.substr(j + 1); - return it('(string)', r, x); - } - if (c < ' ') { - if (c === '\n' || c === '\r') { - break; - } - warningAt("Control character in string: {a}.", - line, character + j, s.slice(0, j)); - } else if (c === xquote) { - warningAt("Bad HTML string", line, character + j); - } else if (c === '<') { - if (option.safe && xmode === 'html') { - warningAt("ADsafe string violation.", - line, character + j); - } else if (s.charAt(j + 1) === '/' && (xmode || option.safe)) { - warningAt("Expected '<\\/' and instead saw ' 0) { - character += 1; - s = s.slice(i); - break; - } else { - if (!nextLine()) { - return it('(end)', ''); - } - } - } -// t = match(rx[xmode] || tx); -// if (!t) { -// if (xmode === 'html') { -// return it('(error)', s.charAt(0)); -// } else { -// t = ''; -// c = ''; -// while (s && s < '!') { -// s = s.substr(1); -// } -// if (s) { -// errorAt("Unexpected '{a}'.", -// line, character, s.substr(0, 1)); -// } -// } - t = match(rx[xmode] || tx); - if (!t) { - t = ''; - c = ''; - while (s && s < '!') { - s = s.substr(1); - } - if (s) { - if (xmode === 'html') { - return it('(error)', s.charAt(0)); - } else { - errorAt("Unexpected '{a}'.", - line, character, s.substr(0, 1)); - } - } - } else { - - // identifier - - if (c.isAlpha() || c === '_' || c === '$') { - return it('(identifier)', t); - } - - // number - - if (c.isDigit()) { - if (xmode !== 'style' && !isFinite(Number(t))) { - warningAt("Bad number '{a}'.", - line, character, t); - } - if (xmode !== 'style' && - xmode !== 'styleproperty' && - s.substr(0, 1).isAlpha()) { - warningAt("Missing space after '{a}'.", - line, character, t); - } - if (c === '0') { - d = t.substr(1, 1); - if (d.isDigit()) { - if (token.id !== '.' && xmode !== 'styleproperty') { - warningAt("Don't use extra leading zeros '{a}'.", - line, character, t); - } - } else if (jsonmode && (d === 'x' || d === 'X')) { - warningAt("Avoid 0x-. '{a}'.", - line, character, t); - } - } - if (t.substr(t.length - 1) === '.') { - warningAt( - "A trailing decimal point can be confused with a dot '{a}'.", - line, character, t); - } - return it('(number)', t); - } - switch (t) { - - // string - - case '"': - case "'": - return string(t); - - // // comment - - case '//': - if (src || (xmode && xmode !== 'script')) { - warningAt("Unexpected comment.", line, character); - } else if (xmode === 'script' && /<\s*\//i.test(s)) { - warningAt("Unexpected <\/ in comment.", line, character); - } else if ((option.safe || xmode === 'script') && ax.test(s)) { - warningAt("Dangerous comment.", line, character); - } - s = ''; - token.comment = true; - break; - - // /* comment - - case '/*': - if (src || (xmode && xmode !== 'script' && xmode !== 'style' && xmode !== 'styleproperty')) { - warningAt("Unexpected comment.", line, character); - } - if (option.safe && ax.test(s)) { - warningAt("ADsafe comment violation.", line, character); - } - for (;;) { - i = s.search(lx); - if (i >= 0) { - break; - } - if (!nextLine()) { - errorAt("Unclosed comment.", line, character); - } else { - if (option.safe && ax.test(s)) { - warningAt("ADsafe comment violation.", line, character); - } - } - } - character += i + 2; - if (s.substr(i, 1) === '/') { - errorAt("Nested comment.", line, character); - } - s = s.substr(i + 2); - token.comment = true; - break; - - // /*members /*jslint /*global - - case '/*members': - case '/*member': - case '/*jslint': - case '/*global': - case '*/': - return { - value: t, - type: 'special', - line: line, - character: character, - from: from - }; - - case '': - break; - // / - case '/': - if (token.id === '/=') { - errorAt( -"A regular expression literal can be confused with '/='.", line, from); - } - if (prereg) { - depth = 0; - captures = 0; - l = 0; - for (;;) { - b = true; - c = s.charAt(l); - l += 1; - switch (c) { - case '': - errorAt("Unclosed regular expression.", line, from); - return; - case '/': - if (depth > 0) { - warningAt("Unescaped '{a}'.", line, from + l, '/'); - } - c = s.substr(0, l - 1); - q = { - g: true, - i: true, - m: true - }; - while (q[s.charAt(l)] === true) { - q[s.charAt(l)] = false; - l += 1; - } - character += l; - s = s.substr(l); - q = s.charAt(0); - if (q === '/' || q === '*') { - errorAt("Confusing regular expression.", line, from); - } - return it('(regexp)', c); - case '\\': - c = s.charAt(l); - if (c < ' ') { - warningAt("Unexpected control character in regular expression.", line, from + l); - } else if (c === '<') { - warningAt("Unexpected escaped character '{a}' in regular expression.", line, from + l, c); - } - l += 1; - break; - case '(': - depth += 1; - b = false; - if (s.charAt(l) === '?') { - l += 1; - switch (s.charAt(l)) { - case ':': - case '=': - case '!': - l += 1; - break; - default: - warningAt("Expected '{a}' and instead saw '{b}'.", line, from + l, ':', s.charAt(l)); - } - } else { - captures += 1; - } - break; - case '|': - b = false; - break; - case ')': - if (depth === 0) { - warningAt("Unescaped '{a}'.", line, from + l, ')'); - } else { - depth -= 1; - } - break; - case ' ': - q = 1; - while (s.charAt(l) === ' ') { - l += 1; - q += 1; - } - if (q > 1) { - warningAt("Spaces are hard to count. Use {{a}}.", line, from + l, q); - } - break; - case '[': - c = s.charAt(l); - if (c === '^') { - l += 1; - if (option.regexp) { - warningAt("Insecure '{a}'.", line, from + l, c); - } - } - q = false; - if (c === ']') { - warningAt("Empty class.", line, from + l - 1); - q = true; - } - klass: do { - c = s.charAt(l); - l += 1; - switch (c) { - case '[': - case '^': - warningAt("Unescaped '{a}'.", line, from + l, c); - q = true; - break; - case '-': - if (q) { - q = false; - } else { - warningAt("Unescaped '{a}'.", line, from + l, '-'); - q = true; - } - break; - case ']': - if (!q) { - warningAt("Unescaped '{a}'.", line, from + l - 1, '-'); - } - break klass; - case '\\': - c = s.charAt(l); - if (c < ' ') { - warningAt("Unexpected control character in regular expression.", line, from + l); - } else if (c === '<') { - warningAt("Unexpected escaped character '{a}' in regular expression.", line, from + l, c); - } - l += 1; - q = true; - break; - case '/': - warningAt("Unescaped '{a}'.", line, from + l - 1, '/'); - q = true; - break; - case '<': - if (xmode === 'script') { - c = s.charAt(l); - if (c === '!' || c === '/') { - warningAt("HTML confusion in regular expression '<{a}'.", line, from + l, c); - } - } - q = true; - break; - default: - q = true; - } - } while (c); - break; - case '.': - if (option.regexp) { - warningAt("Insecure '{a}'.", line, from + l, c); - } - break; - case ']': - case '?': - case '{': - case '}': - case '+': - case '*': - warningAt("Unescaped '{a}'.", line, from + l, c); - break; - case '<': - if (xmode === 'script') { - c = s.charAt(l); - if (c === '!' || c === '/') { - warningAt("HTML confusion in regular expression '<{a}'.", line, from + l, c); - } - } - } - if (b) { - switch (s.charAt(l)) { - case '?': - case '+': - case '*': - l += 1; - if (s.charAt(l) === '?') { - l += 1; - } - break; - case '{': - l += 1; - c = s.charAt(l); - if (c < '0' || c > '9') { - warningAt("Expected a number and instead saw '{a}'.", line, from + l, c); - } - l += 1; - low = +c; - for (;;) { - c = s.charAt(l); - if (c < '0' || c > '9') { - break; - } - l += 1; - low = +c + (low * 10); - } - high = low; - if (c === ',') { - l += 1; - high = Infinity; - c = s.charAt(l); - if (c >= '0' && c <= '9') { - l += 1; - high = +c; - for (;;) { - c = s.charAt(l); - if (c < '0' || c > '9') { - break; - } - l += 1; - high = +c + (high * 10); - } - } - } - if (s.charAt(l) !== '}') { - warningAt("Expected '{a}' and instead saw '{b}'.", line, from + l, '}', c); - } else { - l += 1; - } - if (s.charAt(l) === '?') { - l += 1; - } - if (low > high) { - warningAt("'{a}' should not be greater than '{b}'.", line, from + l, low, high); - } - } - } - } - c = s.substr(0, l - 1); - character += l; - s = s.substr(l); - return it('(regexp)', c); - } - return it('(punctuator)', t); - - // punctuator - - case '.", line, character); - } - character += 3; - s = s.slice(i + 3); - break; - case '#': - if (xmode === 'html' || xmode === 'styleproperty') { - for (;;) { - c = s.charAt(0); - if ((c < '0' || c > '9') && - (c < 'a' || c > 'f') && - (c < 'A' || c > 'F')) { - break; - } - character += 1; - s = s.substr(1); - t += c; - } - if (t.length !== 4 && t.length !== 7) { - warningAt("Bad hex color '{a}'.", line, - from + l, t); - } - return it('(color)', t); - } - return it('(punctuator)', t); - default: - if (xmode === 'outer' && c === '&') { - character += 1; - s = s.substr(1); - for (;;) { - c = s.charAt(0); - character += 1; - s = s.substr(1); - if (c === ';') { - break; - } - if (!((c >= '0' && c <= '9') || - (c >= 'a' && c <= 'z') || - c === '#')) { - errorAt("Bad entity", line, from + l, - character); - } - } - break; - } - return it('(punctuator)', t); - } - } - } - } - }; - }()); - - - function addlabel(t, type) { - - if (option.safe && funct['(global)'] && typeof predefined[t] !== 'boolean') { - warning('ADsafe global: ' + t + '.', token); - } else if (t === 'hasOwnProperty') { - warning("'hasOwnProperty' is a really bad name."); - } - -// Define t in the current function in the current scope. - - if (is_own(funct, t) && !funct['(global)']) { - warning(funct[t] === true ? - "'{a}' was used before it was defined." : - "'{a}' is already defined.", - nexttoken, t); - } - funct[t] = type; - if (funct['(global)']) { - global[t] = funct; - if (is_own(implied, t)) { - warning("'{a}' was used before it was defined.", nexttoken, t); - delete implied[t]; - } - } else { - scope[t] = funct; - } - } - - - function doOption() { - var b, obj, filter, o = nexttoken.value, t, v; - switch (o) { - case '*/': - error("Unbegun comment."); - break; - case '/*members': - case '/*member': - o = '/*members'; - if (!membersOnly) { - membersOnly = {}; - } - obj = membersOnly; - break; - case '/*jslint': - if (option.safe) { - warning("ADsafe restriction."); - } - obj = option; - filter = boolOptions; - break; - case '/*global': - if (option.safe) { - warning("ADsafe restriction."); - } - obj = predefined; - break; - default: - } - t = lex.token(); -loop: for (;;) { - for (;;) { - if (t.type === 'special' && t.value === '*/') { - break loop; - } - if (t.id !== '(endline)' && t.id !== ',') { - break; - } - t = lex.token(); - } - if (t.type !== '(string)' && t.type !== '(identifier)' && - o !== '/*members') { - error("Bad option.", t); - } - v = lex.token(); - if (v.id === ':') { - v = lex.token(); - if (obj === membersOnly) { - error("Expected '{a}' and instead saw '{b}'.", - t, '*/', ':'); - } - if (t.value === 'indent' && o === '/*jslint') { - b = +v.value; - if (typeof b !== 'number' || !isFinite(b) || b <= 0 || - Math.floor(b) !== b) { - error("Expected a small integer and instead saw '{a}'.", - v, v.value); - } - obj.white = true; - obj.indent = b; - } else if (t.value === 'maxerr' && o === '/*jslint') { - b = +v.value; - if (typeof b !== 'number' || !isFinite(b) || b <= 0 || - Math.floor(b) !== b) { - error("Expected a small integer and instead saw '{a}'.", - v, v.value); - } - obj.maxerr = b; - } else if (t.value === 'maxlen' && o === '/*jslint') { - b = +v.value; - if (typeof b !== 'number' || !isFinite(b) || b <= 0 || - Math.floor(b) !== b) { - error("Expected a small integer and instead saw '{a}'.", - v, v.value); - } - obj.maxlen = b; - } else if (v.value === 'true') { - obj[t.value] = true; - } else if (v.value === 'false') { - obj[t.value] = false; - } else { - error("Bad option value.", v); - } - t = lex.token(); - } else { - if (o === '/*jslint') { - error("Missing option value.", t); - } - obj[t.value] = false; - t = v; - } - } - if (filter) { - assume(); - } - } - - -// We need a peek function. If it has an argument, it peeks that much farther -// ahead. It is used to distinguish -// for ( var i in ... -// from -// for ( var i = ... - - function peek(p) { - var i = p || 0, j = 0, t; - - while (j <= i) { - t = lookahead[j]; - if (!t) { - t = lookahead[j] = lex.token(); - } - j += 1; - } - return t; - } - - - -// Produce the next token. It looks for programming errors. - - function advance(id, t) { - switch (token.id) { - case '(number)': - if (nexttoken.id === '.') { - warning( -"A dot following a number can be confused with a decimal point.", token); - } - break; - case '-': - if (nexttoken.id === '-' || nexttoken.id === '--') { - warning("Confusing minusses."); - } - break; - case '+': - if (nexttoken.id === '+' || nexttoken.id === '++') { - warning("Confusing plusses."); - } - break; - } - if (token.type === '(string)' || token.identifier) { - anonname = token.value; - } - - if (id && nexttoken.id !== id) { - if (t) { - if (nexttoken.id === '(end)') { - warning("Unmatched '{a}'.", t, t.id); - } else { - warning("Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.", - nexttoken, id, t.id, t.line, nexttoken.value); - } - } else if (nexttoken.type !== '(identifier)' || - nexttoken.value !== id) { - warning("Expected '{a}' and instead saw '{b}'.", - nexttoken, id, nexttoken.value); - } - } - prevtoken = token; - token = nexttoken; - for (;;) { - nexttoken = lookahead.shift() || lex.token(); - if (nexttoken.id === '(end)' || nexttoken.id === '(error)') { - return; - } - if (nexttoken.type === 'special') { - doOption(); - } else { - if (nexttoken.id !== '(endline)') { - break; - } - } - } - } - - -// This is the heart of JSLINT, the Pratt parser. In addition to parsing, it -// is looking for ad hoc lint patterns. We add to Pratt's model .fud, which is -// like nud except that it is only used on the first token of a statement. -// Having .fud makes it much easier to define JavaScript. I retained Pratt's -// nomenclature. - -// .nud Null denotation -// .fud First null denotation -// .led Left denotation -// lbp Left binding power -// rbp Right binding power - -// They are key to the parsing method called Top Down Operator Precedence. - - function parse(rbp, initial) { - var left; - if (nexttoken.id === '(end)') { - error("Unexpected early end of program.", token); - } - advance(); - if (option.safe && typeof predefined[token.value] === 'boolean' && - (nexttoken.id !== '(' && nexttoken.id !== '.')) { - warning('ADsafe violation.', token); - } - if (initial) { - anonname = 'anonymous'; - funct['(verb)'] = token.value; - } - if (initial === true && token.fud) { - left = token.fud(); - } else { - if (token.nud) { - left = token.nud(); - } else { - if (nexttoken.type === '(number)' && token.id === '.') { - warning( -"A leading decimal point can be confused with a dot: '.{a}'.", - token, nexttoken.value); - advance(); - return token; - } else { - error("Expected an identifier and instead saw '{a}'.", - token, token.id); - } - } - while (rbp < nexttoken.lbp) { - advance(); - if (token.led) { - left = token.led(left); - } else { - error("Expected an operator and instead saw '{a}'.", - token, token.id); - } - } - } - return left; - } - - -// Functions for conformance of style. - - function adjacent(left, right) { - left = left || token; - right = right || nexttoken; - if (option.white || xmode === 'styleproperty' || xmode === 'style') { - if (left.character !== right.from && left.line === right.line) { - warning("Unexpected space after '{a}'.", right, left.value); - } - } - } - - function nospace(left, right) { - left = left || token; - right = right || nexttoken; - if (option.white && !left.comment) { - if (left.line === right.line) { - adjacent(left, right); - } - } - } - - - function nonadjacent(left, right) { - if (option.white) { - left = left || token; - right = right || nexttoken; - if (left.line === right.line && left.character === right.from) { - warning("Missing space after '{a}'.", - nexttoken, left.value); - } - } - } - - function nobreaknonadjacent(left, right) { - left = left || token; - right = right || nexttoken; - if (!option.laxbreak && left.line !== right.line) { - warning("Bad line breaking before '{a}'.", right, right.id); - } else if (option.white) { - left = left || token; - right = right || nexttoken; - if (left.character === right.from) { - warning("Missing space after '{a}'.", - nexttoken, left.value); - } - } - } - - function indentation(bias) { - var i; - if (option.white && nexttoken.id !== '(end)') { - i = indent + (bias || 0); - if (nexttoken.from !== i) { - warning("Expected '{a}' to have an indentation at {b} instead at {c}.", - nexttoken, nexttoken.value, i, nexttoken.from); - } - } - } - - function nolinebreak(t) { - t = t || token; - if (t.line !== nexttoken.line) { - warning("Line breaking error '{a}'.", t, t.value); - } - } - - - function comma() { - if (token.line !== nexttoken.line) { - if (!option.laxbreak) { - warning("Bad line breaking before '{a}'.", token, nexttoken.id); - } - } else if (token.character !== nexttoken.from && option.white) { - warning("Unexpected space after '{a}'.", nexttoken, token.value); - } - advance(','); - nonadjacent(token, nexttoken); - } - - -// Functional constructors for making the symbols that will be inherited by -// tokens. - - function symbol(s, p) { - var x = syntax[s]; - if (!x || typeof x !== 'object') { - syntax[s] = x = { - id: s, - lbp: p, - value: s - }; - } - return x; - } - - - function delim(s) { - return symbol(s, 0); - } - - - function stmt(s, f) { - var x = delim(s); - x.identifier = x.reserved = true; - x.fud = f; - return x; - } - - - function blockstmt(s, f) { - var x = stmt(s, f); - x.block = true; - return x; - } - - - function reserveName(x) { - var c = x.id.charAt(0); - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { - x.identifier = x.reserved = true; - } - return x; - } - - - function prefix(s, f) { - var x = symbol(s, 150); - reserveName(x); - x.nud = (typeof f === 'function') ? f : function () { - this.right = parse(150); - this.arity = 'unary'; - if (this.id === '++' || this.id === '--') { - if (option.plusplus) { - warning("Unexpected use of '{a}'.", this, this.id); - } else if ((!this.right.identifier || this.right.reserved) && - this.right.id !== '.' && this.right.id !== '[') { - warning("Bad operand.", this); - } - } - return this; - }; - return x; - } - - - function type(s, f) { - var x = delim(s); - x.type = s; - x.nud = f; - return x; - } - - - function reserve(s, f) { - var x = type(s, f); - x.identifier = x.reserved = true; - return x; - } - - - function reservevar(s, v) { - return reserve(s, function () { - if (this.id === 'this' || this.id === 'arguments') { - if (strict_mode && funct['(global)']) { - warning("Strict violation.", this); - } else if (option.safe) { - warning("ADsafe violation.", this); - } - } - return this; - }); - } - - - function infix(s, f, p, w) { - var x = symbol(s, p); - reserveName(x); - x.led = function (left) { - if (!w) { - nobreaknonadjacent(prevtoken, token); - nonadjacent(token, nexttoken); - } - if (typeof f === 'function') { - return f(left, this); - } else { - this.left = left; - this.right = parse(p); - return this; - } - }; - return x; - } - - - function relation(s, f) { - var x = symbol(s, 100); - x.led = function (left) { - nobreaknonadjacent(prevtoken, token); - nonadjacent(token, nexttoken); - var right = parse(100); - if ((left && left.id === 'NaN') || (right && right.id === 'NaN')) { - warning("Use the isNaN function to compare with NaN.", this); - } else if (f) { - f.apply(this, [left, right]); - } - if (left.id === '!') { - warning("Confusing use of '{a}'.", left, '!'); - } - if (right.id === '!') { - warning("Confusing use of '{a}'.", left, '!'); - } - this.left = left; - this.right = right; - return this; - }; - return x; - } - - - function isPoorRelation(node) { - return node && - ((node.type === '(number)' && +node.value === 0) || - (node.type === '(string)' && node.value === ' ') || - node.type === 'true' || - node.type === 'false' || - node.type === 'undefined' || - node.type === 'null'); - } - - - function assignop(s, f) { - symbol(s, 20).exps = true; - return infix(s, function (left, that) { - var l; - that.left = left; - if (predefined[left.value] === false && - scope[left.value]['(global)'] === true) { - warning('Read only.', left); - } - if (option.safe) { - l = left; - do { - if (typeof predefined[l.value] === 'boolean') { - warning('ADsafe violation.', l); - } - l = l.left; - } while (l); - } - if (left) { - if (left.id === '.' || left.id === '[') { - if (!left.left || left.left.value === 'arguments') { - warning('Bad assignment.', that); - } - that.right = parse(19); - return that; - } else if (left.identifier && !left.reserved) { - if (funct[left.value] === 'exception') { - warning("Do not assign to the exception parameter.", left); - } - that.right = parse(19); - return that; - } - if (left === syntax['function']) { - warning( -"Expected an identifier in an assignment and instead saw a function invocation.", - token); - } - } - error("Bad assignment.", that); - }, 20); - } - - function bitwise(s, f, p) { - var x = symbol(s, p); - reserveName(x); - x.led = (typeof f === 'function') ? f : function (left) { - if (option.bitwise) { - warning("Unexpected use of '{a}'.", this, this.id); - } - this.left = left; - this.right = parse(p); - return this; - }; - return x; - } - - function bitwiseassignop(s) { - symbol(s, 20).exps = true; - return infix(s, function (left, that) { - if (option.bitwise) { - warning("Unexpected use of '{a}'.", that, that.id); - } - nonadjacent(prevtoken, token); - nonadjacent(token, nexttoken); - if (left) { - if (left.id === '.' || left.id === '[' || - (left.identifier && !left.reserved)) { - parse(19); - return that; - } - if (left === syntax['function']) { - warning( -"Expected an identifier in an assignment, and instead saw a function invocation.", - token); - } - return that; - } - error("Bad assignment.", that); - }, 20); - } - - - function suffix(s, f) { - var x = symbol(s, 150); - x.led = function (left) { - if (option.plusplus) { - warning("Unexpected use of '{a}'.", this, this.id); - } else if ((!left.identifier || left.reserved) && left.id !== '.' && left.id !== '[') { - warning("Bad operand.", this); - } - this.left = left; - return this; - }; - return x; - } - - - function optionalidentifier() { - if (nexttoken.reserved) { - warning("Expected an identifier and instead saw '{a}' (a reserved word).", - nexttoken, nexttoken.id); - } - if (nexttoken.identifier) { - advance(); - return token.value; - } - } - - - function identifier() { - var i = optionalidentifier(); - if (i) { - return i; - } - if (token.id === 'function' && nexttoken.id === '(') { - warning("Missing name in function statement."); - } else { - error("Expected an identifier and instead saw '{a}'.", - nexttoken, nexttoken.value); - } - } - - function reachable(s) { - var i = 0, t; - if (nexttoken.id !== ';' || noreach) { - return; - } - for (;;) { - t = peek(i); - if (t.reach) { - return; - } - if (t.id !== '(endline)') { - if (t.id === 'function') { - warning( -"Inner functions should be listed at the top of the outer function.", t); - break; - } - warning("Unreachable '{a}' after '{b}'.", t, t.value, s); - break; - } - i += 1; - } - } - - - function statement(noindent) { - var i = indent, r, s = scope, t = nexttoken; - -// We don't like the empty statement. - - if (t.id === ';') { - warning("Unnecessary semicolon.", t); - advance(';'); - return; - } - -// Is this a labelled statement? - - if (t.identifier && !t.reserved && peek().id === ':') { - advance(); - advance(':'); - scope = Object.create(s); - addlabel(t.value, 'label'); - if (!nexttoken.labelled) { - warning("Label '{a}' on {b} statement.", - nexttoken, t.value, nexttoken.value); - } - if (jx.test(t.value + ':')) { - warning("Label '{a}' looks like a javascript url.", - t, t.value); - } - nexttoken.label = t.value; - t = nexttoken; - } - -// Parse the statement. - - if (!noindent) { - indentation(); - } - r = parse(0, true); - -// Look for the final semicolon. - - if (!t.block) { - if (!r || !r.exps) { - warning( -"Expected an assignment or function call and instead saw an expression.", - token); - } else if (r.id === '(' && r.left.id === 'new') { - warning("Do not use 'new' for side effects."); - } - if (nexttoken.id !== ';') { - warningAt("Missing semicolon.", token.line, - token.from + token.value.length); - } else { - adjacent(token, nexttoken); - advance(';'); - nonadjacent(token, nexttoken); - } - } - -// Restore the indentation. - - indent = i; - scope = s; - return r; - } - - - function use_strict() { - if (nexttoken.value === 'use strict') { - advance(); - advance(';'); - strict_mode = true; - return true; - } else { - return false; - } - } - - - function statements(begin) { - var a = [], f, p; - if (begin && !use_strict() && option.strict) { - warning('Missing "use strict" statement.', nexttoken); - } - if (option.adsafe) { - switch (begin) { - case 'script': - if (!adsafe_may) { - if (nexttoken.value !== 'ADSAFE' || - peek(0).id !== '.' || - (peek(1).value !== 'id' && - peek(1).value !== 'go')) { - error('ADsafe violation: Missing ADSAFE.id or ADSAFE.go.', - nexttoken); - } - } - if (nexttoken.value === 'ADSAFE' && - peek(0).id === '.' && - peek(1).value === 'id') { - if (adsafe_may) { - error('ADsafe violation.', nexttoken); - } - advance('ADSAFE'); - advance('.'); - advance('id'); - advance('('); - if (nexttoken.value !== adsafe_id) { - error('ADsafe violation: id does not match.', nexttoken); - } - advance('(string)'); - advance(')'); - advance(';'); - adsafe_may = true; - } - break; - case 'lib': - if (nexttoken.value === 'ADSAFE') { - advance('ADSAFE'); - advance('.'); - advance('lib'); - advance('('); - advance('(string)'); - comma(); - f = parse(0); - if (f.id !== 'function') { - error('The second argument to lib must be a function.', f); - } - p = f.funct['(params)']; - p = p && p.join(', '); - if (p && p !== 'lib') { - error("Expected '{a}' and instead saw '{b}'.", - f, '(lib)', '(' + p + ')'); - } - advance(')'); - advance(';'); - return a; - } else { - error("ADsafe lib violation."); - } - } - } - while (!nexttoken.reach && nexttoken.id !== '(end)') { - if (nexttoken.id === ';') { - warning("Unnecessary semicolon."); - advance(';'); - } else { - a.push(statement()); - } - } - return a; - } - - - function block(f) { - var a, b = inblock, old_indent = indent, s = scope, t; - inblock = f; - scope = Object.create(scope); - nonadjacent(token, nexttoken); - t = nexttoken; - if (nexttoken.id === '{') { - advance('{'); - if (nexttoken.id !== '}' || token.line !== nexttoken.line) { - indent += option.indent; - while (!f && nexttoken.from > indent) { - indent += option.indent; - } - if (!f) { - use_strict(); - } - a = statements(); - indent -= option.indent; - indentation(); - } - advance('}', t); - indent = old_indent; - } else { - warning("Expected '{a}' and instead saw '{b}'.", - nexttoken, '{', nexttoken.value); - noreach = true; - a = [statement()]; - noreach = false; - } - funct['(verb)'] = null; - scope = s; - inblock = b; - return a; - } - - -// An identity function, used by string and number tokens. - - function idValue() { - return this; - } - - - function countMember(m) { - if (membersOnly && typeof membersOnly[m] !== 'boolean') { - warning("Unexpected /*member '{a}'.", token, m); - } - if (typeof member[m] === 'number') { - member[m] += 1; - } else { - member[m] = 1; - } - } - - - function note_implied(token) { - var name = token.value, line = token.line, a = implied[name]; - if (typeof a === 'function') { - a = false; - } - if (!a) { - a = [line]; - implied[name] = a; - } else if (a[a.length - 1] !== line) { - a.push(line); - } - } - -// CSS parsing. - - - function cssName() { - if (nexttoken.identifier) { - advance(); - return true; - } - } - - function cssNumber() { - if (nexttoken.id === '-') { - advance('-'); - adjacent(); - nolinebreak(); - } - if (nexttoken.type === '(number)') { - advance('(number)'); - return true; - } - } - - function cssString() { - if (nexttoken.type === '(string)') { - advance(); - return true; - } - } - - function cssColor() { - var i, number, value; - if (nexttoken.identifier) { - value = nexttoken.value; - if (value === 'rgb' || value === 'rgba') { - advance(); - advance('('); - for (i = 0; i < 3; i += 1) { - if (i) { - advance(','); - } - number = nexttoken.value; - if (nexttoken.type !== '(number)' || number < 0) { - warning("Expected a positive number and instead saw '{a}'", - nexttoken, number); - advance(); - } else { - advance(); - if (nexttoken.id === '%') { - advance('%'); - if (number > 100) { - warning("Expected a percentage and instead saw '{a}'", - token, number); - } - } else { - if (number > 255) { - warning("Expected a small number and instead saw '{a}'", - token, number); - } - } - } - } - if (value === 'rgba') { - advance(','); - number = +nexttoken.value; - if (nexttoken.type !== '(number)' || number < 0 || number > 1) { - warning("Expected a number between 0 and 1 and instead saw '{a}'", - nexttoken, number); - } - advance(); - if (nexttoken.id === '%') { - warning("Unexpected '%'."); - advance('%'); - } - } - advance(')'); - return true; - } else if (cssColorData[nexttoken.value] === true) { - advance(); - return true; - } - } else if (nexttoken.type === '(color)') { - advance(); - return true; - } - return false; - } - - function cssLength() { - if (nexttoken.id === '-') { - advance('-'); - adjacent(); - nolinebreak(); - } - if (nexttoken.type === '(number)') { - advance(); - if (nexttoken.type !== '(string)' && - cssLengthData[nexttoken.value] === true) { - adjacent(); - advance(); - } else if (+token.value !== 0) { - warning("Expected a linear unit and instead saw '{a}'.", - nexttoken, nexttoken.value); - } - return true; - } - return false; - } - - function cssLineHeight() { - if (nexttoken.id === '-') { - advance('-'); - adjacent(); - } - if (nexttoken.type === '(number)') { - advance(); - if (nexttoken.type !== '(string)' && - cssLengthData[nexttoken.value] === true) { - adjacent(); - advance(); - } - return true; - } - return false; - } - - function cssWidth() { - if (nexttoken.identifier) { - switch (nexttoken.value) { - case 'thin': - case 'medium': - case 'thick': - advance(); - return true; - } - } else { - return cssLength(); - } - } - - function cssMargin() { - if (nexttoken.identifier) { - if (nexttoken.value === 'auto') { - advance(); - return true; - } - } else { - return cssLength(); - } - } - - function cssAttr() { - if (nexttoken.identifier && nexttoken.value === 'attr') { - advance(); - advance('('); - if (!nexttoken.identifier) { - warning("Expected a name and instead saw '{a}'.", - nexttoken, nexttoken.value); - } - advance(); - advance(')'); - return true; - } - return false; - } - - function cssCommaList() { - while (nexttoken.id !== ';') { - if (!cssName() && !cssString()) { - warning("Expected a name and instead saw '{a}'.", - nexttoken, nexttoken.value); - } - if (nexttoken.id !== ',') { - return true; - } - comma(); - } - } - - function cssCounter() { - if (nexttoken.identifier && nexttoken.value === 'counter') { - advance(); - advance('('); - if (!nexttoken.identifier) { - } - advance(); - if (nexttoken.id === ',') { - comma(); - if (nexttoken.type !== '(string)') { - warning("Expected a string and instead saw '{a}'.", - nexttoken, nexttoken.value); - } - advance(); - } - advance(')'); - return true; - } - if (nexttoken.identifier && nexttoken.value === 'counters') { - advance(); - advance('('); - if (!nexttoken.identifier) { - warning("Expected a name and instead saw '{a}'.", - nexttoken, nexttoken.value); - } - advance(); - if (nexttoken.id === ',') { - comma(); - if (nexttoken.type !== '(string)') { - warning("Expected a string and instead saw '{a}'.", - nexttoken, nexttoken.value); - } - advance(); - } - if (nexttoken.id === ',') { - comma(); - if (nexttoken.type !== '(string)') { - warning("Expected a string and instead saw '{a}'.", - nexttoken, nexttoken.value); - } - advance(); - } - advance(')'); - return true; - } - return false; - } - - - function cssShape() { - var i; - if (nexttoken.identifier && nexttoken.value === 'rect') { - advance(); - advance('('); - for (i = 0; i < 4; i += 1) { - if (!cssLength()) { - warning("Expected a number and instead saw '{a}'.", - nexttoken, nexttoken.value); - break; - } - } - advance(')'); - return true; - } - return false; - } - - function cssUrl() { - var c, url; - if (nexttoken.identifier && nexttoken.value === 'url') { - nexttoken = lex.range('(', ')'); - url = nexttoken.value; - c = url.charAt(0); - if (c === '"' || c === '\'') { - if (url.slice(-1) !== c) { - warning("Bad url string."); - } else { - url = url.slice(1, -1); - if (url.indexOf(c) >= 0) { - warning("Bad url string."); - } - } - } - if (!url) { - warning("Missing url."); - } - advance(); - if (option.safe && ux.test(url)) { - error("ADsafe URL violation."); - } - urls.push(url); - return true; - } - return false; - } - - cssAny = [cssUrl, function () { - for (;;) { - if (nexttoken.identifier) { - switch (nexttoken.value.toLowerCase()) { - case 'url': - cssUrl(); - break; - case 'expression': - warning("Unexpected expression '{a}'.", - nexttoken, nexttoken.value); - advance(); - break; - default: - advance(); - } - } else { - if (nexttoken.id === ';' || nexttoken.id === '!' || - nexttoken.id === '(end)' || nexttoken.id === '}') { - return true; - } - advance(); - } - } - }]; - - cssBorderStyle = [ - 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'ridge', - 'inset', 'outset' - ]; - - cssBreak = [ - 'auto', 'always', 'avoid', 'left', 'right' - ]; - - cssOverflow = [ - 'auto', 'hidden', 'scroll', 'visible' - ]; - - cssAttributeData = { - background: [ - true, 'background-attachment', 'background-color', - 'background-image', 'background-position', 'background-repeat' - ], - 'background-attachment': ['scroll', 'fixed'], - 'background-color': ['transparent', cssColor], - 'background-image': ['none', cssUrl], - 'background-position': [ - 2, [cssLength, 'top', 'bottom', 'left', 'right', 'center'] - ], - 'background-repeat': [ - 'repeat', 'repeat-x', 'repeat-y', 'no-repeat' - ], - 'border': [true, 'border-color', 'border-style', 'border-width'], - 'border-bottom': [ - true, 'border-bottom-color', 'border-bottom-style', - 'border-bottom-width' - ], - 'border-bottom-color': cssColor, - 'border-bottom-style': cssBorderStyle, - 'border-bottom-width': cssWidth, - 'border-collapse': ['collapse', 'separate'], - 'border-color': ['transparent', 4, cssColor], - 'border-left': [ - true, 'border-left-color', 'border-left-style', 'border-left-width' - ], - 'border-left-color': cssColor, - 'border-left-style': cssBorderStyle, - 'border-left-width': cssWidth, - 'border-right': [ - true, 'border-right-color', 'border-right-style', - 'border-right-width' - ], - 'border-right-color': cssColor, - 'border-right-style': cssBorderStyle, - 'border-right-width': cssWidth, - 'border-spacing': [2, cssLength], - 'border-style': [4, cssBorderStyle], - 'border-top': [ - true, 'border-top-color', 'border-top-style', 'border-top-width' - ], - 'border-top-color': cssColor, - 'border-top-style': cssBorderStyle, - 'border-top-width': cssWidth, - 'border-width': [4, cssWidth], - bottom: [cssLength, 'auto'], - 'caption-side' : ['bottom', 'left', 'right', 'top'], - clear: ['both', 'left', 'none', 'right'], - clip: [cssShape, 'auto'], - color: cssColor, - content: [ - 'open-quote', 'close-quote', 'no-open-quote', 'no-close-quote', - cssString, cssUrl, cssCounter, cssAttr - ], - 'counter-increment': [ - cssName, 'none' - ], - 'counter-reset': [ - cssName, 'none' - ], - cursor: [ - cssUrl, 'auto', 'crosshair', 'default', 'e-resize', 'help', 'move', - 'n-resize', 'ne-resize', 'nw-resize', 'pointer', 's-resize', - 'se-resize', 'sw-resize', 'w-resize', 'text', 'wait' - ], - direction: ['ltr', 'rtl'], - display: [ - 'block', 'compact', 'inline', 'inline-block', 'inline-table', - 'list-item', 'marker', 'none', 'run-in', 'table', 'table-caption', - 'table-cell', 'table-column', 'table-column-group', - 'table-footer-group', 'table-header-group', 'table-row', - 'table-row-group' - ], - 'empty-cells': ['show', 'hide'], - 'float': ['left', 'none', 'right'], - font: [ - 'caption', 'icon', 'menu', 'message-box', 'small-caption', - 'status-bar', true, 'font-size', 'font-style', 'font-weight', - 'font-family' - ], - 'font-family': cssCommaList, - 'font-size': [ - 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', - 'xx-large', 'larger', 'smaller', cssLength - ], - 'font-size-adjust': ['none', cssNumber], - 'font-stretch': [ - 'normal', 'wider', 'narrower', 'ultra-condensed', - 'extra-condensed', 'condensed', 'semi-condensed', - 'semi-expanded', 'expanded', 'extra-expanded' - ], - 'font-style': [ - 'normal', 'italic', 'oblique' - ], - 'font-variant': [ - 'normal', 'small-caps' - ], - 'font-weight': [ - 'normal', 'bold', 'bolder', 'lighter', cssNumber - ], - height: [cssLength, 'auto'], - left: [cssLength, 'auto'], - 'letter-spacing': ['normal', cssLength], - 'line-height': ['normal', cssLineHeight], - 'list-style': [ - true, 'list-style-image', 'list-style-position', 'list-style-type' - ], - 'list-style-image': ['none', cssUrl], - 'list-style-position': ['inside', 'outside'], - 'list-style-type': [ - 'circle', 'disc', 'square', 'decimal', 'decimal-leading-zero', - 'lower-roman', 'upper-roman', 'lower-greek', 'lower-alpha', - 'lower-latin', 'upper-alpha', 'upper-latin', 'hebrew', 'katakana', - 'hiragana-iroha', 'katakana-oroha', 'none' - ], - margin: [4, cssMargin], - 'margin-bottom': cssMargin, - 'margin-left': cssMargin, - 'margin-right': cssMargin, - 'margin-top': cssMargin, - 'marker-offset': [cssLength, 'auto'], - 'max-height': [cssLength, 'none'], - 'max-width': [cssLength, 'none'], - 'min-height': cssLength, - 'min-width': cssLength, - opacity: cssNumber, - outline: [true, 'outline-color', 'outline-style', 'outline-width'], - 'outline-color': ['invert', cssColor], - 'outline-style': [ - 'dashed', 'dotted', 'double', 'groove', 'inset', 'none', - 'outset', 'ridge', 'solid' - ], - 'outline-width': cssWidth, - overflow: cssOverflow, - 'overflow-x': cssOverflow, - 'overflow-y': cssOverflow, - padding: [4, cssLength], - 'padding-bottom': cssLength, - 'padding-left': cssLength, - 'padding-right': cssLength, - 'padding-top': cssLength, - 'page-break-after': cssBreak, - 'page-break-before': cssBreak, - position: ['absolute', 'fixed', 'relative', 'static'], - quotes: [8, cssString], - right: [cssLength, 'auto'], - 'table-layout': ['auto', 'fixed'], - 'text-align': ['center', 'justify', 'left', 'right'], - 'text-decoration': [ - 'none', 'underline', 'overline', 'line-through', 'blink' - ], - 'text-indent': cssLength, - 'text-shadow': ['none', 4, [cssColor, cssLength]], - 'text-transform': ['capitalize', 'uppercase', 'lowercase', 'none'], - top: [cssLength, 'auto'], - 'unicode-bidi': ['normal', 'embed', 'bidi-override'], - 'vertical-align': [ - 'baseline', 'bottom', 'sub', 'super', 'top', 'text-top', 'middle', - 'text-bottom', cssLength - ], - visibility: ['visible', 'hidden', 'collapse'], - 'white-space': [ - 'normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'inherit' - ], - width: [cssLength, 'auto'], - 'word-spacing': ['normal', cssLength], - 'word-wrap': ['break-word', 'normal'], - 'z-index': ['auto', cssNumber] - }; - - function styleAttribute() { - var v; - while (nexttoken.id === '*' || nexttoken.id === '#' || - nexttoken.value === '_') { - if (!option.css) { - warning("Unexpected '{a}'.", nexttoken, nexttoken.value); - } - advance(); - } - if (nexttoken.id === '-') { - if (!option.css) { - warning("Unexpected '{a}'.", nexttoken, nexttoken.value); - } - advance('-'); - if (!nexttoken.identifier) { - warning( -"Expected a non-standard style attribute and instead saw '{a}'.", - nexttoken, nexttoken.value); - } - advance(); - return cssAny; - } else { - if (!nexttoken.identifier) { - warning("Excepted a style attribute, and instead saw '{a}'.", - nexttoken, nexttoken.value); - } else { - if (is_own(cssAttributeData, nexttoken.value)) { - v = cssAttributeData[nexttoken.value]; - } else { - v = cssAny; - if (!option.css) { - warning("Unrecognized style attribute '{a}'.", - nexttoken, nexttoken.value); - } - } - } - advance(); - return v; - } - } - - function styleValue(v) { - var i = 0, - n, - once, - match, - round, - start = 0, - vi; - switch (typeof v) { - case 'function': - return v(); - case 'string': - if (nexttoken.identifier && nexttoken.value === v) { - advance(); - return true; - } - return false; - } - for (;;) { - if (i >= v.length) { - return false; - } - vi = v[i]; - i += 1; - if (vi === true) { - break; - } else if (typeof vi === 'number') { - n = vi; - vi = v[i]; - i += 1; - } else { - n = 1; - } - match = false; - while (n > 0) { - if (styleValue(vi)) { - match = true; - n -= 1; - } else { - break; - } - } - if (match) { - return true; - } - } - start = i; - once = []; - for (;;) { - round = false; - for (i = start; i < v.length; i += 1) { - if (!once[i]) { - if (styleValue(cssAttributeData[v[i]])) { - match = true; - round = true; - once[i] = true; - break; - } - } - } - if (!round) { - return match; - } - } - } - - function styleChild() { - if (nexttoken.id === '(number)') { - advance(); - if (nexttoken.value === 'n' && nexttoken.identifier) { - adjacent(); - advance(); - if (nexttoken.id === '+') { - adjacent(); - advance('+'); - adjacent(); - advance('(number)'); - } - } - return; - } else { - switch (nexttoken.value) { - case 'odd': - case 'even': - if (nexttoken.identifier) { - advance(); - return; - } - } - } - warning("Unexpected token '{a}'.", nexttoken, nexttoken.value); - } - - function substyle() { - var v; - for (;;) { - if (nexttoken.id === '}' || nexttoken.id === '(end)' || - xquote && nexttoken.id === xquote) { - return; - } - while (nexttoken.id === ';') { - warning("Misplaced ';'."); - advance(';'); - } - v = styleAttribute(); - advance(':'); - if (nexttoken.identifier && nexttoken.value === 'inherit') { - advance(); - } else { - if (!styleValue(v)) { - warning("Unexpected token '{a}'.", nexttoken, - nexttoken.value); - advance(); - } - } - if (nexttoken.id === '!') { - advance('!'); - adjacent(); - if (nexttoken.identifier && nexttoken.value === 'important') { - advance(); - } else { - warning("Expected '{a}' and instead saw '{b}'.", - nexttoken, 'important', nexttoken.value); - } - } - if (nexttoken.id === '}' || nexttoken.id === xquote) { - warning("Missing '{a}'.", nexttoken, ';'); - } else { - advance(';'); - } - } - } - - function styleSelector() { - if (nexttoken.identifier) { - if (!is_own(htmltag, nexttoken.value)) { - warning("Expected a tagName, and instead saw {a}.", - nexttoken, nexttoken.value); - } - advance(); - } else { - switch (nexttoken.id) { - case '>': - case '+': - advance(); - styleSelector(); - break; - case ':': - advance(':'); - switch (nexttoken.value) { - case 'active': - case 'after': - case 'before': - case 'checked': - case 'disabled': - case 'empty': - case 'enabled': - case 'first-child': - case 'first-letter': - case 'first-line': - case 'first-of-type': - case 'focus': - case 'hover': - case 'last-of-type': - case 'link': - case 'only-of-type': - case 'root': - case 'target': - case 'visited': - advance(); - break; - case 'lang': - advance(); - advance('('); - if (!nexttoken.identifier) { - warning("Expected a lang code, and instead saw :{a}.", - nexttoken, nexttoken.value); - } - advance(')'); - break; - case 'nth-child': - case 'nth-last-child': - case 'nth-last-of-type': - case 'nth-of-type': - advance(); - advance('('); - styleChild(); - advance(')'); - break; - case 'not': - advance(); - advance('('); - if (nexttoken.id === ':' && peek(0).value === 'not') { - warning("Nested not."); - } - styleSelector(); - advance(')'); - break; - default: - warning("Expected a pseudo, and instead saw :{a}.", - nexttoken, nexttoken.value); - } - break; - case '#': - advance('#'); - if (!nexttoken.identifier) { - warning("Expected an id, and instead saw #{a}.", - nexttoken, nexttoken.value); - } - advance(); - break; - case '*': - advance('*'); - break; - case '.': - advance('.'); - if (!nexttoken.identifier) { - warning("Expected a class, and instead saw #.{a}.", - nexttoken, nexttoken.value); - } - advance(); - break; - case '[': - advance('['); - if (!nexttoken.identifier) { - warning("Expected an attribute, and instead saw [{a}].", - nexttoken, nexttoken.value); - } - advance(); - if (nexttoken.id === '=' || nexttoken.value === '~=' || - nexttoken.value === '$=' || - nexttoken.value === '|=' || - nexttoken.id === '*=' || - nexttoken.id === '^=') { - advance(); - if (nexttoken.type !== '(string)') { - warning("Expected a string, and instead saw {a}.", - nexttoken, nexttoken.value); - } - advance(); - } - advance(']'); - break; - default: - error("Expected a CSS selector, and instead saw {a}.", - nexttoken, nexttoken.value); - } - } - } - - function stylePattern() { - var name; - if (nexttoken.id === '{') { - warning("Expected a style pattern, and instead saw '{a}'.", nexttoken, - nexttoken.id); - } else if (nexttoken.id === '@') { - advance('@'); - name = nexttoken.value; - if (nexttoken.identifier && atrule[name] === true) { - advance(); - return name; - } - warning("Expected an at-rule, and instead saw @{a}.", nexttoken, name); - } - for (;;) { - styleSelector(); - if (nexttoken.id === ' fragments and .js files.", token); - } - if (option.fragment) { - if (n !== 'div') { - error("ADsafe violation: Wrap the widget in a div.", token); - } - } else { - error("Use the fragment option.", token); - } - } - option.browser = true; - assume(); - } - - function doAttribute(n, a, v) { - var u, x; - if (a === 'id') { - u = typeof v === 'string' ? v.toUpperCase() : ''; - if (ids[u] === true) { - warning("Duplicate id='{a}'.", nexttoken, v); - } - if (!/^[A-Za-z][A-Za-z0-9._:\-]*$/.test(v)) { - warning("Bad id: '{a}'.", nexttoken, v); - } else if (option.adsafe) { - if (adsafe_id) { - if (v.slice(0, adsafe_id.length) !== adsafe_id) { - warning("ADsafe violation: An id must have a '{a}' prefix", - nexttoken, adsafe_id); - } else if (!/^[A-Z]+_[A-Z]+$/.test(v)) { - warning("ADSAFE violation: bad id."); - } - } else { - adsafe_id = v; - if (!/^[A-Z]+_$/.test(v)) { - warning("ADSAFE violation: bad id."); - } - } - } - x = v.search(dx); - if (x >= 0) { - warning("Unexpected character '{a}' in {b}.", token, v.charAt(x), a); - } - ids[u] = true; - } else if (a === 'class' || a === 'type' || a === 'name') { - x = v.search(qx); - if (x >= 0) { - warning("Unexpected character '{a}' in {b}.", token, v.charAt(x), a); - } - ids[u] = true; - } else if (a === 'href' || a === 'background' || - a === 'content' || a === 'data' || - a.indexOf('src') >= 0 || a.indexOf('url') >= 0) { - if (option.safe && ux.test(v)) { - error("ADsafe URL violation."); - } - urls.push(v); - } else if (a === 'for') { - if (option.adsafe) { - if (adsafe_id) { - if (v.slice(0, adsafe_id.length) !== adsafe_id) { - warning("ADsafe violation: An id must have a '{a}' prefix", - nexttoken, adsafe_id); - } else if (!/^[A-Z]+_[A-Z]+$/.test(v)) { - warning("ADSAFE violation: bad id."); - } - } else { - warning("ADSAFE violation: bad id."); - } - } - } else if (a === 'name') { - if (option.adsafe && v.indexOf('_') >= 0) { - warning("ADsafe name violation."); - } - } - } - - function doTag(n, a) { - var i, t = htmltag[n], x; - src = false; - if (!t) { - error("Unrecognized tag '<{a}>'.", - nexttoken, - n === n.toLowerCase() ? n : - n + ' (capitalization error)'); - } - if (stack.length > 0) { - if (n === 'html') { - error("Too many tags.", token); - } - x = t.parent; - if (x) { - if (x.indexOf(' ' + stack[stack.length - 1].name + ' ') < 0) { - error("A '<{a}>' must be within '<{b}>'.", - token, n, x); - } - } else if (!option.adsafe && !option.fragment) { - i = stack.length; - do { - if (i <= 0) { - error("A '<{a}>' must be within '<{b}>'.", - token, n, 'body'); - } - i -= 1; - } while (stack[i].name !== 'body'); - } - } - switch (n) { - case 'div': - if (option.adsafe && stack.length === 1 && !adsafe_id) { - warning("ADSAFE violation: missing ID_."); - } - break; - case 'script': - xmode = 'script'; - advance('>'); - indent = nexttoken.from; - if (a.lang) { - warning("lang is deprecated.", token); - } - if (option.adsafe && stack.length !== 1) { - warning("ADsafe script placement violation.", token); - } - if (a.src) { - if (option.adsafe && (!adsafe_may || !approved[a.src])) { - warning("ADsafe unapproved script source.", token); - } - if (a.type) { - warning("type is unnecessary.", token); - } - } else { - if (adsafe_went) { - error("ADsafe script violation.", token); - } - statements('script'); - } - xmode = 'html'; - advance(''); - styles(); - xmode = 'html'; - advance(''; - } - - function html() { - var a, attributes, e, n, q, t, v, w = option.white, wmode; - xmode = 'html'; - xquote = ''; - stack = null; - for (;;) { - switch (nexttoken.value) { - case '<': - xmode = 'html'; - advance('<'); - attributes = {}; - t = nexttoken; - if (!t.identifier) { - warning("Bad identifier {a}.", t, t.value); - } - n = t.value; - if (option.cap) { - n = n.toLowerCase(); - } - t.name = n; - advance(); - if (!stack) { - stack = []; - doBegin(n); - } - v = htmltag[n]; - if (typeof v !== 'object') { - error("Unrecognized tag '<{a}>'.", t, n); - } - e = v.empty; - t.type = n; - for (;;) { - if (nexttoken.id === '/') { - advance('/'); - if (nexttoken.id !== '>') { - warning("Expected '{a}' and instead saw '{b}'.", - nexttoken, '>', nexttoken.value); - } - break; - } - if (nexttoken.id && nexttoken.id.substr(0, 1) === '>') { - break; - } - if (!nexttoken.identifier) { - if (nexttoken.id === '(end)' || nexttoken.id === '(error)') { - error("Missing '>'.", nexttoken); - } - warning("Bad identifier."); - } - option.white = true; - nonadjacent(token, nexttoken); - a = nexttoken.value; - option.white = w; - advance(); - if (!option.cap && a !== a.toLowerCase()) { - warning("Attribute '{a}' not all lower case.", nexttoken, a); - } - a = a.toLowerCase(); - xquote = ''; - if (is_own(attributes, a)) { - warning("Attribute '{a}' repeated.", nexttoken, a); - } - if (a.slice(0, 2) === 'on') { - if (!option.on) { - warning("Avoid HTML event handlers."); - } - xmode = 'scriptstring'; - advance('='); - q = nexttoken.id; - if (q !== '"' && q !== "'") { - error("Missing quote."); - } - xquote = q; - wmode = option.white; - option.white = false; - advance(q); - statements('on'); - option.white = wmode; - if (nexttoken.id !== q) { - error("Missing close quote on script attribute."); - } - xmode = 'html'; - xquote = ''; - advance(q); - v = false; - } else if (a === 'style') { - xmode = 'scriptstring'; - advance('='); - q = nexttoken.id; - if (q !== '"' && q !== "'") { - error("Missing quote."); - } - xmode = 'styleproperty'; - xquote = q; - advance(q); - substyle(); - xmode = 'html'; - xquote = ''; - advance(q); - v = false; - } else { - if (nexttoken.id === '=') { - advance('='); - v = nexttoken.value; - if (!nexttoken.identifier && - nexttoken.id !== '"' && - nexttoken.id !== '\'' && - nexttoken.type !== '(string)' && - nexttoken.type !== '(number)' && - nexttoken.type !== '(color)') { - warning("Expected an attribute value and instead saw '{a}'.", token, a); - } - advance(); - } else { - v = true; - } - } - attributes[a] = v; - doAttribute(n, a, v); - } - doTag(n, attributes); - if (!e) { - stack.push(t); - } - xmode = 'outer'; - advance('>'); - break; - case '') { - error("Missing '{a}'.", nexttoken, '>'); - } - xmode = 'outer'; - advance('>'); - break; - case '' || nexttoken.id === '(end)') { - break; - } - if (nexttoken.value.indexOf('--') >= 0) { - warning("Unexpected --."); - } - if (nexttoken.value.indexOf('<') >= 0) { - warning("Unexpected <."); - } - if (nexttoken.value.indexOf('>') >= 0) { - warning("Unexpected >."); - } - } - xmode = 'outer'; - advance('>'); - break; - case '(end)': - return; - default: - if (nexttoken.id === '(end)') { - error("Missing '{a}'.", nexttoken, - ''); - } else { - advance(); - } - } - if (stack && stack.length === 0 && (option.adsafe || - !option.fragment || nexttoken.id === '(end)')) { - break; - } - } - if (nexttoken.id !== '(end)') { - error("Unexpected material after the end."); - } - } - - -// Build the syntax table by declaring the syntactic elements of the language. - - type('(number)', idValue); - type('(string)', idValue); - - syntax['(identifier)'] = { - type: '(identifier)', - lbp: 0, - identifier: true, - nud: function () { - var v = this.value, - s = scope[v], - f; - if (typeof s === 'function') { - s = undefined; - } else if (typeof s === 'boolean') { - f = funct; - funct = functions[0]; - addlabel(v, 'var'); - s = funct; - funct = f; - } - -// The name is in scope and defined in the current function. - - if (funct === s) { - -// Change 'unused' to 'var', and reject labels. - - switch (funct[v]) { - case 'unused': - funct[v] = 'var'; - break; - case 'label': - warning("'{a}' is a statement label.", token, v); - break; - } - -// The name is not defined in the function. If we are in the global scope, -// then we have an undefined variable. - - } else if (funct['(global)']) { - if (option.undef && predefined[v] !== 'boolean') { - warning("'{a}' is not defined.", token, v); - } - note_implied(token); - -// If the name is already defined in the current -// function, but not as outer, then there is a scope error. - - } else { - switch (funct[v]) { - case 'closure': - case 'function': - case 'var': - case 'unused': - warning("'{a}' used out of scope.", token, v); - break; - case 'label': - warning("'{a}' is a statement label.", token, v); - break; - case 'outer': - case 'global': - break; - default: - -// If the name is defined in an outer function, make an outer entry, and if -// it was unused, make it var. - - if (s === true) { - funct[v] = true; - } else if (s === null) { - warning("'{a}' is not allowed.", token, v); - note_implied(token); - } else if (typeof s !== 'object') { - if (option.undef) { - warning("'{a}' is not defined.", token, v); - } else { - funct[v] = true; - } - note_implied(token); - } else { - switch (s[v]) { - case 'function': - case 'var': - case 'unused': - s[v] = 'closure'; - funct[v] = s['(global)'] ? 'global' : 'outer'; - break; - case 'closure': - case 'parameter': - funct[v] = s['(global)'] ? 'global' : 'outer'; - break; - case 'label': - warning("'{a}' is a statement label.", token, v); - } - } - } - } - return this; - }, - led: function () { - error("Expected an operator and instead saw '{a}'.", - nexttoken, nexttoken.value); - } - }; - - type('(regexp)', function () { - return this; - }); - - delim('(endline)'); - delim('(begin)'); - delim('(end)').reach = true; - delim(''); - delim('(error)').reach = true; - delim('}').reach = true; - delim(')'); - delim(']'); - delim('"').reach = true; - delim("'").reach = true; - delim(';'); - delim(':').reach = true; - delim(','); - delim('#'); - delim('@'); - reserve('else'); - reserve('case').reach = true; - reserve('catch'); - reserve('default').reach = true; - reserve('finally'); - reservevar('arguments'); - reservevar('eval'); - reservevar('false'); - reservevar('Infinity'); - reservevar('NaN'); - reservevar('null'); - reservevar('this'); - reservevar('true'); - reservevar('undefined'); - assignop('=', 'assign', 20); - assignop('+=', 'assignadd', 20); - assignop('-=', 'assignsub', 20); - assignop('*=', 'assignmult', 20); - assignop('/=', 'assigndiv', 20).nud = function () { - error("A regular expression literal can be confused with '/='."); - }; - assignop('%=', 'assignmod', 20); - bitwiseassignop('&=', 'assignbitand', 20); - bitwiseassignop('|=', 'assignbitor', 20); - bitwiseassignop('^=', 'assignbitxor', 20); - bitwiseassignop('<<=', 'assignshiftleft', 20); - bitwiseassignop('>>=', 'assignshiftright', 20); - bitwiseassignop('>>>=', 'assignshiftrightunsigned', 20); - infix('?', function (left, that) { - that.left = left; - that.right = parse(10); - advance(':'); - that['else'] = parse(10); - return that; - }, 30); - - infix('||', 'or', 40); - infix('&&', 'and', 50); - bitwise('|', 'bitor', 70); - bitwise('^', 'bitxor', 80); - bitwise('&', 'bitand', 90); - relation('==', function (left, right) { - if (option.eqeqeq) { - warning("Expected '{a}' and instead saw '{b}'.", - this, '===', '=='); - } else if (isPoorRelation(left)) { - warning("Use '{a}' to compare with '{b}'.", - this, '===', left.value); - } else if (isPoorRelation(right)) { - warning("Use '{a}' to compare with '{b}'.", - this, '===', right.value); - } - return this; - }); - relation('==='); - relation('!=', function (left, right) { - if (option.eqeqeq) { - warning("Expected '{a}' and instead saw '{b}'.", - this, '!==', '!='); - } else if (isPoorRelation(left)) { - warning("Use '{a}' to compare with '{b}'.", - this, '!==', left.value); - } else if (isPoorRelation(right)) { - warning("Use '{a}' to compare with '{b}'.", - this, '!==', right.value); - } - return this; - }); - relation('!=='); - relation('<'); - relation('>'); - relation('<='); - relation('>='); - bitwise('<<', 'shiftleft', 120); - bitwise('>>', 'shiftright', 120); - bitwise('>>>', 'shiftrightunsigned', 120); - infix('in', 'in', 120); - infix('instanceof', 'instanceof', 120); - infix('+', function (left, that) { - var right = parse(130); - if (left && right && left.id === '(string)' && right.id === '(string)') { - left.value += right.value; - left.character = right.character; - if (jx.test(left.value)) { - warning("JavaScript URL.", left); - } - return left; - } - that.left = left; - that.right = right; - return that; - }, 130); - prefix('+', 'num'); - infix('-', 'sub', 130); - prefix('-', 'neg'); - infix('*', 'mult', 140); - infix('/', 'div', 140); - infix('%', 'mod', 140); - - suffix('++', 'postinc'); - prefix('++', 'preinc'); - syntax['++'].exps = true; - - suffix('--', 'postdec'); - prefix('--', 'predec'); - syntax['--'].exps = true; - prefix('delete', function () { - var p = parse(0); - if (!p || (p.id !== '.' && p.id !== '[')) { - warning("Expected '{a}' and instead saw '{b}'.", - nexttoken, '.', nexttoken.value); - } - this.first = p; - return this; - }).exps = true; - - - prefix('~', function () { - if (option.bitwise) { - warning("Unexpected '{a}'.", this, '~'); - } - parse(150); - return this; - }); - prefix('!', function () { - this.right = parse(150); - this.arity = 'unary'; - if (bang[this.right.id] === true) { - warning("Confusing use of '{a}'.", this, '!'); - } - return this; - }); - prefix('typeof', 'typeof'); - prefix('new', function () { - var c = parse(155), i; - if (c && c.id !== 'function') { - if (c.identifier) { - c['new'] = true; - switch (c.value) { - case 'Object': - warning("Use the object literal notation {}.", token); - break; - case 'Array': - if (nexttoken.id !== '(') { - warning("Use the array literal notation [].", token); - } else { - advance('('); - if (nexttoken.id === ')') { - warning("Use the array literal notation [].", token); - } else { - i = parse(0); - c.dimension = i; - if ((i.id === '(number)' && /[.+\-Ee]/.test(i.value)) || - (i.id === '-' && !i.right) || - i.id === '(string)' || i.id === '[' || - i.id === '{' || i.id === 'true' || - i.id === 'false' || - i.id === 'null' || i.id === 'undefined' || - i.id === 'Infinity') { - warning("Use the array literal notation [].", token); - } - if (nexttoken.id !== ')') { - error("Use the array literal notation [].", token); - } - } - advance(')'); - } - this.first = c; - return this; - case 'Number': - case 'String': - case 'Boolean': - case 'Math': - case 'JSON': - warning("Do not use {a} as a constructor.", token, c.value); - break; - case 'Function': - if (!option.evil) { - warning("The Function constructor is eval."); - } - break; - case 'Date': - case 'RegExp': - break; - default: - if (c.id !== 'function') { - i = c.value.substr(0, 1); - if (option.newcap && (i < 'A' || i > 'Z')) { - warning( - "A constructor name should start with an uppercase letter.", - token); - } - } - } - } else { - if (c.id !== '.' && c.id !== '[' && c.id !== '(') { - warning("Bad constructor.", token); - } - } - } else { - warning("Weird construction. Delete 'new'.", this); - } - adjacent(token, nexttoken); - if (nexttoken.id !== '(') { - warning("Missing '()' invoking a constructor."); - } - this.first = c; - return this; - }); - syntax['new'].exps = true; - - infix('.', function (left, that) { - adjacent(prevtoken, token); - var m = identifier(); - if (typeof m === 'string') { - countMember(m); - } - that.left = left; - that.right = m; - if (!option.evil && left && left.value === 'document' && - (m === 'write' || m === 'writeln')) { - warning("document.write can be a form of eval.", left); - } else if (option.adsafe) { - if (left && left.value === 'ADSAFE') { - if (m === 'id' || m === 'lib') { - warning("ADsafe violation.", that); - } else if (m === 'go') { - if (xmode !== 'script') { - warning("ADsafe violation.", that); - } else if (adsafe_went || nexttoken.id !== '(' || - peek(0).id !== '(string)' || - peek(0).value !== adsafe_id || - peek(1).id !== ',') { - error("ADsafe violation: go.", that); - } - adsafe_went = true; - adsafe_may = false; - } - } - } - if (!option.evil && (m === 'eval' || m === 'execScript')) { - warning('eval is evil.'); - } else if (option.safe) { - for (;;) { - if (banned[m] === true) { - warning("ADsafe restricted word '{a}'.", token, m); - } - if (typeof predefined[left.value] !== 'boolean' || - nexttoken.id === '(') { - break; - } - if (standard_member[m] === true) { - if (nexttoken.id === '.') { - warning("ADsafe violation.", that); - } - break; - } - if (nexttoken.id !== '.') { - warning("ADsafe violation.", that); - break; - } - advance('.'); - token.left = that; - token.right = m; - that = token; - m = identifier(); - if (typeof m === 'string') { - countMember(m); - } - } - } - return that; - }, 160, true); - - infix('(', function (left, that) { - adjacent(prevtoken, token); - nospace(); - var n = 0, - p = []; - if (left) { - if (left.type === '(identifier)') { - if (left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)) { - if (left.value !== 'Number' && left.value !== 'String' && - left.value !== 'Boolean' && - left.value !== 'Date') { - if (left.value === 'Math') { - warning("Math is not a function.", left); - } else if (option.newcap) { - warning( -"Missing 'new' prefix when invoking a constructor.", left); - } - } - } - } else if (left.id === '.') { - if (option.safe && left.left.value === 'Math' && - left.right === 'random') { - warning("ADsafe violation.", left); - } - } - } - if (nexttoken.id !== ')') { - for (;;) { - p[p.length] = parse(10); - n += 1; - if (nexttoken.id !== ',') { - break; - } - comma(); - } - } - advance(')'); - if (option.immed && left.id === 'function' && nexttoken.id !== ')') { - warning("Wrap the entire immediate function invocation in parens.", - that); - } - nospace(prevtoken, token); - if (typeof left === 'object') { - if (left.value === 'parseInt' && n === 1) { - warning("Missing radix parameter.", left); - } - if (!option.evil) { - if (left.value === 'eval' || left.value === 'Function' || - left.value === 'execScript') { - warning("eval is evil.", left); - } else if (p[0] && p[0].id === '(string)' && - (left.value === 'setTimeout' || - left.value === 'setInterval')) { - warning( - "Implied eval is evil. Pass a function instead of a string.", left); - } - } - if (!left.identifier && left.id !== '.' && left.id !== '[' && - left.id !== '(' && left.id !== '&&' && left.id !== '||' && - left.id !== '?') { - warning("Bad invocation.", left); - } - } - that.left = left; - return that; - }, 155, true).exps = true; - - prefix('(', function () { - nospace(); - var v = parse(0); - advance(')', this); - nospace(prevtoken, token); - if (option.immed && v.id === 'function') { - if (nexttoken.id === '(') { - warning( -"Move the invocation into the parens that contain the function.", nexttoken); - } else { - warning( -"Do not wrap function literals in parens unless they are to be immediately invoked.", - this); - } - } - return v; - }); - - infix('[', function (left, that) { - nospace(); - var e = parse(0), s; - if (e && e.type === '(string)') { - if (option.safe && banned[e.value] === true) { - warning("ADsafe restricted word '{a}'.", that, e.value); - } else if (!option.evil && - (e.value === 'eval' || e.value === 'execScript')) { - warning("eval is evil.", that); - } else if (option.safe && - (e.value.charAt(0) === '_' || e.value.charAt(0) === '-')) { - warning("ADsafe restricted subscript '{a}'.", that, e.value); - } - countMember(e.value); - if (!option.sub && ix.test(e.value)) { - s = syntax[e.value]; - if (!s || !s.reserved) { - warning("['{a}'] is better written in dot notation.", - e, e.value); - } - } - } else if (!e || e.type !== '(number)' || e.value < 0) { - if (option.safe) { - warning('ADsafe subscripting.'); - } - } - advance(']', that); - nospace(prevtoken, token); - that.left = left; - that.right = e; - return that; - }, 160, true); - - prefix('[', function () { - var b = token.line !== nexttoken.line; - this.first = []; - if (b) { - indent += option.indent; - if (nexttoken.from === indent + option.indent) { - indent += option.indent; - } - } - while (nexttoken.id !== '(end)') { - while (nexttoken.id === ',') { - warning("Extra comma."); - advance(','); - } - if (nexttoken.id === ']') { - break; - } - if (b && token.line !== nexttoken.line) { - indentation(); - } - this.first.push(parse(10)); - if (nexttoken.id === ',') { - comma(); - if (nexttoken.id === ']') { - warning("Extra comma.", token); - break; - } - } else { - break; - } - } - if (b) { - indent -= option.indent; - indentation(); - } - advance(']', this); - return this; - }, 160); - - (function (x) { - x.nud = function () { - var b, i, s, seen = {}; - b = token.line !== nexttoken.line; - if (b) { - indent += option.indent; - if (nexttoken.from === indent + option.indent) { - indent += option.indent; - } - } - for (;;) { - if (nexttoken.id === '}') { - break; - } - if (b) { - indentation(); - } - i = optionalidentifier(true); - if (!i) { - if (nexttoken.id === '(string)') { - i = nexttoken.value; - if (ix.test(i)) { - s = syntax[i]; - } - advance(); - } else if (nexttoken.id === '(number)') { - i = nexttoken.value.toString(); - advance(); - } else { - error("Expected '{a}' and instead saw '{b}'.", - nexttoken, '}', nexttoken.value); - } - } - if (seen[i] === true) { - warning("Duplicate member '{a}'.", nexttoken, i); - } - seen[i] = true; - countMember(i); - advance(':'); - nonadjacent(token, nexttoken); - parse(10); - if (nexttoken.id === ',') { - comma(); - if (nexttoken.id === ',' || nexttoken.id === '}') { - warning("Extra comma.", token); - } - } else { - break; - } - } - if (b) { - indent -= option.indent; - indentation(); - } - advance('}', this); - return this; - }; - x.fud = function () { - error("Expected to see a statement and instead saw a block.", token); - }; - }(delim('{'))); - - - function varstatement(prefix) { - -// JavaScript does not have block scope. It only has function scope. So, -// declaring a variable in a block can have unexpected consequences. - - var id, name, value; - - if (funct['(onevar)'] && option.onevar) { - warning("Too many var statements."); - } else if (!funct['(global)']) { - funct['(onevar)'] = true; - } - this.first = []; - for (;;) { - nonadjacent(token, nexttoken); - id = identifier(); - if (funct['(global)'] && predefined[id] === false) { - warning("Redefinition of '{a}'.", token, id); - } - addlabel(id, 'unused'); - if (prefix) { - break; - } - name = token; - this.first.push(token); - if (nexttoken.id === '=') { - nonadjacent(token, nexttoken); - advance('='); - nonadjacent(token, nexttoken); - if (nexttoken.id === 'undefined') { - warning("It is not necessary to initialize '{a}' to 'undefined'.", token, id); - } - if (peek(0).id === '=' && nexttoken.identifier) { - error("Variable {a} was not declared correctly.", - nexttoken, nexttoken.value); - } - value = parse(0); - name.first = value; - } - if (nexttoken.id !== ',') { - break; - } - comma(); - } - return this; - } - - - stmt('var', varstatement).exps = true; - - - function functionparams() { - var i, t = nexttoken, p = []; - advance('('); - nospace(); - if (nexttoken.id === ')') { - advance(')'); - nospace(prevtoken, token); - return; - } - for (;;) { - i = identifier(); - p.push(i); - addlabel(i, 'parameter'); - if (nexttoken.id === ',') { - comma(); - } else { - advance(')', t); - nospace(prevtoken, token); - return p; - } - } - } - - function doFunction(i) { - var s = scope; - scope = Object.create(s); - funct = { - '(name)' : i || '"' + anonname + '"', - '(line)' : nexttoken.line, - '(context)' : funct, - '(breakage)': 0, - '(loopage)' : 0, - '(scope)' : scope - }; - token.funct = funct; - functions.push(funct); - if (i) { - addlabel(i, 'function'); - } - funct['(params)'] = functionparams(); - - block(false); - scope = s; - funct['(last)'] = token.line; - funct = funct['(context)']; - } - - - blockstmt('function', function () { - if (inblock) { - warning( -"Function statements cannot be placed in blocks. Use a function expression or move the statement to the top of the outer function.", token); - - } - var i = identifier(); - adjacent(token, nexttoken); - addlabel(i, 'unused'); - doFunction(i); - if (nexttoken.id === '(' && nexttoken.line === token.line) { - error( -"Function statements are not invocable. Wrap the whole function invocation in parens."); - } - return this; - }); - - prefix('function', function () { - var i = optionalidentifier(); - if (i) { - adjacent(token, nexttoken); - } else { - nonadjacent(token, nexttoken); - } - doFunction(i); - if (funct['(loopage)']) { - warning("Don't make functions within a loop."); - } - return this; - }); - - blockstmt('if', function () { - var t = nexttoken; - advance('('); - nonadjacent(this, t); - nospace(); - parse(20); - if (nexttoken.id === '=') { - warning("Expected a conditional expression and instead saw an assignment."); - advance('='); - parse(20); - } - advance(')', t); - nospace(prevtoken, token); - block(true); - if (nexttoken.id === 'else') { - nonadjacent(token, nexttoken); - advance('else'); - if (nexttoken.id === 'if' || nexttoken.id === 'switch') { - statement(true); - } else { - block(true); - } - } - return this; - }); - - blockstmt('try', function () { - var b, e, s; - if (option.adsafe) { - warning("ADsafe try violation.", this); - } - block(false); - if (nexttoken.id === 'catch') { - advance('catch'); - nonadjacent(token, nexttoken); - advance('('); - s = scope; - scope = Object.create(s); - e = nexttoken.value; - if (nexttoken.type !== '(identifier)') { - warning("Expected an identifier and instead saw '{a}'.", - nexttoken, e); - } else { - addlabel(e, 'exception'); - } - advance(); - advance(')'); - block(false); - b = true; - scope = s; - } - if (nexttoken.id === 'finally') { - advance('finally'); - block(false); - return; - } else if (!b) { - error("Expected '{a}' and instead saw '{b}'.", - nexttoken, 'catch', nexttoken.value); - } - return this; - }); - - blockstmt('while', function () { - var t = nexttoken; - funct['(breakage)'] += 1; - funct['(loopage)'] += 1; - advance('('); - nonadjacent(this, t); - nospace(); - parse(20); - if (nexttoken.id === '=') { - warning("Expected a conditional expression and instead saw an assignment."); - advance('='); - parse(20); - } - advance(')', t); - nospace(prevtoken, token); - block(true); - funct['(breakage)'] -= 1; - funct['(loopage)'] -= 1; - return this; - }).labelled = true; - - reserve('with'); - - blockstmt('switch', function () { - var t = nexttoken, - g = false; - funct['(breakage)'] += 1; - advance('('); - nonadjacent(this, t); - nospace(); - this.condition = parse(20); - advance(')', t); - nospace(prevtoken, token); - nonadjacent(token, nexttoken); - t = nexttoken; - advance('{'); - nonadjacent(token, nexttoken); - indent += option.indent; - this.cases = []; - for (;;) { - switch (nexttoken.id) { - case 'case': - switch (funct['(verb)']) { - case 'break': - case 'case': - case 'continue': - case 'return': - case 'switch': - case 'throw': - break; - default: - warning( - "Expected a 'break' statement before 'case'.", - token); - } - indentation(-option.indent); - advance('case'); - this.cases.push(parse(20)); - g = true; - advance(':'); - funct['(verb)'] = 'case'; - break; - case 'default': - switch (funct['(verb)']) { - case 'break': - case 'continue': - case 'return': - case 'throw': - break; - default: - warning( - "Expected a 'break' statement before 'default'.", - token); - } - indentation(-option.indent); - advance('default'); - g = true; - advance(':'); - break; - case '}': - indent -= option.indent; - indentation(); - advance('}', t); - if (this.cases.length === 1 || this.condition.id === 'true' || - this.condition.id === 'false') { - warning("This 'switch' should be an 'if'.", this); - } - funct['(breakage)'] -= 1; - funct['(verb)'] = undefined; - return; - case '(end)': - error("Missing '{a}'.", nexttoken, '}'); - return; - default: - if (g) { - switch (token.id) { - case ',': - error("Each value should have its own case label."); - return; - case ':': - statements(); - break; - default: - error("Missing ':' on a case clause.", token); - } - } else { - error("Expected '{a}' and instead saw '{b}'.", - nexttoken, 'case', nexttoken.value); - } - } - } - }).labelled = true; - - stmt('debugger', function () { - if (!option.debug) { - warning("All 'debugger' statements should be removed."); - } - return this; - }).exps = true; - - (function () { - var x = stmt('do', function () { - funct['(breakage)'] += 1; - funct['(loopage)'] += 1; - this.first = block(true); - advance('while'); - var t = nexttoken; - nonadjacent(token, t); - advance('('); - nospace(); - parse(20); - if (nexttoken.id === '=') { - warning("Expected a conditional expression and instead saw an assignment."); - advance('='); - parse(20); - } - advance(')', t); - nospace(prevtoken, token); - funct['(breakage)'] -= 1; - funct['(loopage)'] -= 1; - return this; - }); - x.labelled = true; - x.exps = true; - }()); - - blockstmt('for', function () { - var f = option.forin, s, t = nexttoken; - funct['(breakage)'] += 1; - funct['(loopage)'] += 1; - advance('('); - nonadjacent(this, t); - nospace(); - if (peek(nexttoken.id === 'var' ? 1 : 0).id === 'in') { - if (nexttoken.id === 'var') { - advance('var'); - varstatement(true); - } else { - switch (funct[nexttoken.value]) { - case 'unused': - funct[nexttoken.value] = 'var'; - break; - case 'var': - break; - default: - warning("Bad for in variable '{a}'.", - nexttoken, nexttoken.value); - } - advance(); - } - advance('in'); - parse(20); - advance(')', t); - s = block(true); - if (!f && (s.length > 1 || typeof s[0] !== 'object' || - s[0].value !== 'if')) { - warning("The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.", this); - } - funct['(breakage)'] -= 1; - funct['(loopage)'] -= 1; - return this; - } else { - if (nexttoken.id !== ';') { - if (nexttoken.id === 'var') { - advance('var'); - varstatement(); - } else { - for (;;) { - parse(0, 'for'); - if (nexttoken.id !== ',') { - break; - } - comma(); - } - } - } - nolinebreak(token); - advance(';'); - if (nexttoken.id !== ';') { - parse(20); - if (nexttoken.id === '=') { - warning("Expected a conditional expression and instead saw an assignment."); - advance('='); - parse(20); - } - } - nolinebreak(token); - advance(';'); - if (nexttoken.id === ';') { - error("Expected '{a}' and instead saw '{b}'.", - nexttoken, ')', ';'); - } - if (nexttoken.id !== ')') { - for (;;) { - parse(0, 'for'); - if (nexttoken.id !== ',') { - break; - } - comma(); - } - } - advance(')', t); - nospace(prevtoken, token); - block(true); - funct['(breakage)'] -= 1; - funct['(loopage)'] -= 1; - return this; - } - }).labelled = true; - - - stmt('break', function () { - var v = nexttoken.value; - if (funct['(breakage)'] === 0) { - warning("Unexpected '{a}'.", nexttoken, this.value); - } - nolinebreak(this); - if (nexttoken.id !== ';') { - if (token.line === nexttoken.line) { - if (funct[v] !== 'label') { - warning("'{a}' is not a statement label.", nexttoken, v); - } else if (scope[v] !== funct) { - warning("'{a}' is out of scope.", nexttoken, v); - } - this.first = nexttoken; - advance(); - } - } - reachable('break'); - return this; - }).exps = true; - - - stmt('continue', function () { - var v = nexttoken.value; - if (funct['(breakage)'] === 0) { - warning("Unexpected '{a}'.", nexttoken, this.value); - } - nolinebreak(this); - if (nexttoken.id !== ';') { - if (token.line === nexttoken.line) { - if (funct[v] !== 'label') { - warning("'{a}' is not a statement label.", nexttoken, v); - } else if (scope[v] !== funct) { - warning("'{a}' is out of scope.", nexttoken, v); - } - this.first = nexttoken; - advance(); - } - } else if (!funct['(loopage)']) { - warning("Unexpected '{a}'.", nexttoken, this.value); - } - reachable('continue'); - return this; - }).exps = true; - - - stmt('return', function () { - nolinebreak(this); - if (nexttoken.id === '(regexp)') { - warning("Wrap the /regexp/ literal in parens to disambiguate the slash operator."); - } - if (nexttoken.id !== ';' && !nexttoken.reach) { - nonadjacent(token, nexttoken); - this.first = parse(20); - } - reachable('return'); - return this; - }).exps = true; - - - stmt('throw', function () { - nolinebreak(this); - nonadjacent(token, nexttoken); - this.first = parse(20); - reachable('throw'); - return this; - }).exps = true; - - reserve('void'); - -// Superfluous reserved words - - reserve('class'); - reserve('const'); - reserve('enum'); - reserve('export'); - reserve('extends'); - reserve('import'); - reserve('super'); - - reserve('let'); - reserve('yield'); - reserve('implements'); - reserve('interface'); - reserve('package'); - reserve('private'); - reserve('protected'); - reserve('public'); - reserve('static'); - - function jsonValue() { - - function jsonObject() { - var o = {}, t = nexttoken; - advance('{'); - if (nexttoken.id !== '}') { - for (;;) { - if (nexttoken.id === '(end)') { - error("Missing '}' to match '{' from line {a}.", - nexttoken, t.line); - } else if (nexttoken.id === '}') { - warning("Unexpected comma.", token); - break; - } else if (nexttoken.id === ',') { - error("Unexpected comma.", nexttoken); - } else if (nexttoken.id !== '(string)') { - warning("Expected a string and instead saw {a}.", - nexttoken, nexttoken.value); - } - if (o[nexttoken.value] === true) { - warning("Duplicate key '{a}'.", - nexttoken, nexttoken.value); - } else if (nexttoken.value === '__proto__') { - warning("Stupid key '{a}'.", - nexttoken, nexttoken.value); - } else { - o[nexttoken.value] = true; - } - advance(); - advance(':'); - jsonValue(); - if (nexttoken.id !== ',') { - break; - } - advance(','); - } - } - advance('}'); - } - - function jsonArray() { - var t = nexttoken; - advance('['); - if (nexttoken.id !== ']') { - for (;;) { - if (nexttoken.id === '(end)') { - error("Missing ']' to match '[' from line {a}.", - nexttoken, t.line); - } else if (nexttoken.id === ']') { - warning("Unexpected comma.", token); - break; - } else if (nexttoken.id === ',') { - error("Unexpected comma.", nexttoken); - } - jsonValue(); - if (nexttoken.id !== ',') { - break; - } - advance(','); - } - } - advance(']'); - } - - switch (nexttoken.id) { - case '{': - jsonObject(); - break; - case '[': - jsonArray(); - break; - case 'true': - case 'false': - case 'null': - case '(number)': - case '(string)': - advance(); - break; - case '-': - advance('-'); - if (token.character !== nexttoken.from) { - warning("Unexpected space after '-'.", token); - } - adjacent(token, nexttoken); - advance('(number)'); - break; - default: - error("Expected a JSON value.", nexttoken); - } - } - - -// The actual JSLINT function itself. - - var itself = function (s, o) { - var a, i; - JSLINT.errors = []; - predefined = Object.create(standard); - if (o) { - a = o.predef; - if (a instanceof Array) { - for (i = 0; i < a.length; i += 1) { - predefined[a[i]] = true; - } - } - if (o.adsafe) { - o.safe = true; - } - if (o.safe) { - o.browser = false; - o.css = false; - o.debug = false; - o.devel = false; - o.eqeqeq = true; - o.evil = false; - o.forin = false; - o.nomen = true; - o.on = false; - o.rhino = false; - o.safe = true; - o.sidebar = false; - o.strict = true; - o.sub = false; - o.undef = true; - o.widget = false; - predefined.Date = null; - predefined['eval'] = null; - predefined.Function = null; - predefined.Object = null; - predefined.ADSAFE = false; - predefined.lib = false; - } - option = o; - } else { - option = {}; - } - option.indent = option.indent || 4; - option.maxerr = option.maxerr || 50; - adsafe_id = ''; - adsafe_may = false; - adsafe_went = false; - approved = {}; - if (option.approved) { - for (i = 0; i < option.approved.length; i += 1) { - approved[option.approved[i]] = option.approved[i]; - } - } else { - approved.test = 'test'; - } - tab = ''; - for (i = 0; i < option.indent; i += 1) { - tab += ' '; - } - indent = 1; - global = Object.create(predefined); - scope = global; - funct = { - '(global)': true, - '(name)': '(global)', - '(scope)': scope, - '(breakage)': 0, - '(loopage)': 0 - }; - functions = [funct]; - ids = {}; - urls = []; - src = false; - xmode = false; - stack = null; - member = {}; - membersOnly = null; - implied = {}; - inblock = false; - lookahead = []; - jsonmode = false; - warnings = 0; - lex.init(s); - prereg = true; - strict_mode = false; - - prevtoken = token = nexttoken = syntax['(begin)']; - assume(); - - try { - advance(); - if (nexttoken.value.charAt(0) === '<') { - html(); - if (option.adsafe && !adsafe_went) { - warning("ADsafe violation: Missing ADSAFE.go.", this); - } - } else { - switch (nexttoken.id) { - case '{': - case '[': - option.laxbreak = true; - jsonmode = true; - jsonValue(); - break; - case '@': - case '*': - case '#': - case '.': - case ':': - xmode = 'style'; - advance(); - if (token.id !== '@' || !nexttoken.identifier || - nexttoken.value !== 'charset' || token.line !== 1 || - token.from !== 1) { - error('A css file should begin with @charset "UTF-8";'); - } - advance(); - if (nexttoken.type !== '(string)' && - nexttoken.value !== 'UTF-8') { - error('A css file should begin with @charset "UTF-8";'); - } - advance(); - advance(';'); - styles(); - break; - - default: - if (option.adsafe && option.fragment) { - error("Expected '{a}' and instead saw '{b}'.", - nexttoken, '
', nexttoken.value); - } - statements('lib'); - } - } - advance('(end)'); - } catch (e) { - if (e) { - JSLINT.errors.push({ - reason : e.message, - line : e.line || nexttoken.line, - character : e.character || nexttoken.from - }, null); - } - } - return JSLINT.errors.length === 0; - }; - - function is_array(o) { - return Object.prototype.toString.apply(o) === '[object Array]'; - } - - function to_array(o) { - var a = [], k; - for (k in o) { - if (is_own(o, k)) { - a.push(k); - } - } - return a; - } - -// Data summary. - - itself.data = function () { - - var data = {functions: []}, fu, globals, implieds = [], f, i, j, - members = [], n, unused = [], v; - if (itself.errors.length) { - data.errors = itself.errors; - } - - if (jsonmode) { - data.json = true; - } - - for (n in implied) { - if (is_own(implied, n)) { - implieds.push({ - name: n, - line: implied[n] - }); - } - } - if (implieds.length > 0) { - data.implieds = implieds; - } - - if (urls.length > 0) { - data.urls = urls; - } - - globals = to_array(scope); - if (globals.length > 0) { - data.globals = globals; - } - - for (i = 1; i < functions.length; i += 1) { - f = functions[i]; - fu = {}; - for (j = 0; j < functionicity.length; j += 1) { - fu[functionicity[j]] = []; - } - for (n in f) { - if (is_own(f, n) && n.charAt(0) !== '(') { - v = f[n]; - if (is_array(fu[v])) { - fu[v].push(n); - if (v === 'unused') { - unused.push({ - name: n, - line: f['(line)'], - 'function': f['(name)'] - }); - } - } - } - } - for (j = 0; j < functionicity.length; j += 1) { - if (fu[functionicity[j]].length === 0) { - delete fu[functionicity[j]]; - } - } - fu.name = f['(name)']; - fu.param = f['(params)']; - fu.line = f['(line)']; - fu.last = f['(last)']; - data.functions.push(fu); - } - - if (unused.length > 0) { - data.unused = unused; - } - - members = []; - for (n in member) { - if (typeof member[n] === 'number') { - data.member = member; - break; - } - } - - return data; - }; - - itself.report = function (option) { - var data = itself.data(); - - var a = [], c, e, err, f, i, k, l, m = '', n, o = [], s; - - function detail(h, array) { - var b, i, singularity; - if (array) { - o.push('
' + h + ' '); - array = array.sort(); - for (i = 0; i < array.length; i += 1) { - if (array[i] !== singularity) { - singularity = array[i]; - o.push((b ? ', ' : '') + singularity); - b = true; - } - } - o.push('
'); - } - } - - - if (data.errors || data.implieds || data.unused) { - err = true; - o.push('
Error:'); - if (data.errors) { - for (i = 0; i < data.errors.length; i += 1) { - c = data.errors[i]; - if (c) { - e = c.evidence || ''; - o.push('

Problem' + (isFinite(c.line) ? ' at line ' + - c.line + ' character ' + c.character : '') + - ': ' + c.reason.entityify() + - '

' + - (e && (e.length > 80 ? e.slice(0, 77) + '...' : - e).entityify()) + '

'); - } - } - } - - if (data.implieds) { - s = []; - for (i = 0; i < data.implieds.length; i += 1) { - s[i] = '' + data.implieds[i].name + ' ' + - data.implieds[i].line + ''; - } - o.push('

Implied global: ' + s.join(', ') + '

'); - } - - if (data.unused) { - s = []; - for (i = 0; i < data.unused.length; i += 1) { - s[i] = '' + data.unused[i].name + ' ' + - data.unused[i].line + ' ' + - data.unused[i]['function'] + ''; - } - o.push('

Unused variable: ' + s.join(', ') + '

'); - } - if (data.json) { - o.push('

JSON: bad.

'); - } - o.push('
'); - } - - if (!option) { - - o.push('
'); - - if (data.urls) { - detail("URLs
", data.urls, '
'); - } - - if (xmode === 'style') { - o.push('

CSS.

'); - } else if (data.json && !err) { - o.push('

JSON: good.

'); - } else if (data.globals) { - o.push('
Global ' + - data.globals.sort().join(', ') + '
'); - } else { - o.push('
No new global variables introduced.
'); - } - - for (i = 0; i < data.functions.length; i += 1) { - f = data.functions[i]; - - o.push('
' + f.line + '-' + - f.last + ' ' + (f.name || '') + '(' + - (f.param ? f.param.join(', ') : '') + ')
'); - detail('Unused', f.unused); - detail('Closure', f.closure); - detail('Variable', f['var']); - detail('Exception', f.exception); - detail('Outer', f.outer); - detail('Global', f.global); - detail('Label', f.label); - } - - if (data.member) { - a = to_array(data.member); - if (a.length) { - a = a.sort(); - m = '
/*members ';
-                    l = 10;
-                    for (i = 0; i < a.length; i += 1) {
-                        k = a[i];
-                        n = k.name();
-                        if (l + n.length > 72) {
-                            o.push(m + '
'); - m = ' '; - l = 1; - } - l += n.length + 2; - if (data.member[k] === 1) { - n = '' + n + ''; - } - if (i < a.length - 1) { - n += ', '; - } - m += n; - } - o.push(m + '
*/
'); - } - o.push('
'); - } - } - return o.join(''); - }; - itself.jslint = itself; - - itself.edition = '2010-02-20'; - - if (typeof exports !== "undefined") { - exports.JSLINT = itself; - } - - return itself; - -}()); diff --git a/bower_components/jquery/build/lib/parse-js.js b/bower_components/jquery/build/lib/parse-js.js deleted file mode 100644 index 8edecb73..00000000 --- a/bower_components/jquery/build/lib/parse-js.js +++ /dev/null @@ -1,1315 +0,0 @@ -/*********************************************************************** - - A JavaScript tokenizer / parser / beautifier / compressor. - - This version is suitable for Node.js. With minimal changes (the - exports stuff) it should work on any JS platform. - - This file contains the tokenizer/parser. It is a port to JavaScript - of parse-js [1], a JavaScript parser library written in Common Lisp - by Marijn Haverbeke. Thank you Marijn! - - [1] http://marijn.haverbeke.nl/parse-js/ - - Exported functions: - - - tokenizer(code) -- returns a function. Call the returned - function to fetch the next token. - - - parse(code) -- returns an AST of the given JavaScript code. - - -------------------------------- (C) --------------------------------- - - Author: Mihai Bazon - - http://mihai.bazon.net/blog - - Distributed under the BSD license: - - Copyright 2010 (c) Mihai Bazon - Based on parse-js (http://marijn.haverbeke.nl/parse-js/). - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above - copyright notice, this list of conditions and the following - disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. - - ***********************************************************************/ - -/* -----[ Tokenizer (constants) ]----- */ - -var KEYWORDS = array_to_hash([ - "break", - "case", - "catch", - "const", - "continue", - "default", - "delete", - "do", - "else", - "finally", - "for", - "function", - "if", - "in", - "instanceof", - "new", - "return", - "switch", - "throw", - "try", - "typeof", - "var", - "void", - "while", - "with" -]); - -var RESERVED_WORDS = array_to_hash([ - "abstract", - "boolean", - "byte", - "char", - "class", - "debugger", - "double", - "enum", - "export", - "extends", - "final", - "float", - "goto", - "implements", - "import", - "int", - "interface", - "long", - "native", - "package", - "private", - "protected", - "public", - "short", - "static", - "super", - "synchronized", - "throws", - "transient", - "volatile" -]); - -var KEYWORDS_BEFORE_EXPRESSION = array_to_hash([ - "return", - "new", - "delete", - "throw", - "else", - "case" -]); - -var KEYWORDS_ATOM = array_to_hash([ - "false", - "null", - "true", - "undefined" -]); - -var OPERATOR_CHARS = array_to_hash(characters("+-*&%=<>!?|~^")); - -var RE_HEX_NUMBER = /^0x[0-9a-f]+$/i; -var RE_OCT_NUMBER = /^0[0-7]+$/; -var RE_DEC_NUMBER = /^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i; - -var OPERATORS = array_to_hash([ - "in", - "instanceof", - "typeof", - "new", - "void", - "delete", - "++", - "--", - "+", - "-", - "!", - "~", - "&", - "|", - "^", - "*", - "/", - "%", - ">>", - "<<", - ">>>", - "<", - ">", - "<=", - ">=", - "==", - "===", - "!=", - "!==", - "?", - "=", - "+=", - "-=", - "/=", - "*=", - "%=", - ">>=", - "<<=", - ">>>=", - "|=", - "^=", - "&=", - "&&", - "||" -]); - -var WHITESPACE_CHARS = array_to_hash(characters(" \n\r\t\u200b")); - -var PUNC_BEFORE_EXPRESSION = array_to_hash(characters("[{}(,.;:")); - -var PUNC_CHARS = array_to_hash(characters("[]{}(),;:")); - -var REGEXP_MODIFIERS = array_to_hash(characters("gmsiy")); - -/* -----[ Tokenizer ]----- */ - -// regexps adapted from http://xregexp.com/plugins/#unicode -var UNICODE = { - letter: new RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u0523\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971\\u0972\\u097B-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D28\\u0D2A-\\u0D39\\u0D3D\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC\\u0EDD\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8B\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10D0-\\u10FA\\u10FC\\u1100-\\u1159\\u115F-\\u11A2\\u11A8-\\u11F9\\u1200-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u1676\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19A9\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u2094\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2C6F\\u2C71-\\u2C7D\\u2C80-\\u2CE4\\u2D00-\\u2D25\\u2D30-\\u2D65\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31B7\\u31F0-\\u31FF\\u3400\\u4DB5\\u4E00\\u9FC3\\uA000-\\uA48C\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA65F\\uA662-\\uA66E\\uA67F-\\uA697\\uA717-\\uA71F\\uA722-\\uA788\\uA78B\\uA78C\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA90A-\\uA925\\uA930-\\uA946\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAC00\\uD7A3\\uF900-\\uFA2D\\uFA30-\\uFA6A\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), - non_spacing_mark: new RegExp("[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065E\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0900-\\u0902\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F90-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1DC0-\\u1DE6\\u1DFD-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA67C\\uA67D\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26]"), - space_combining_mark: new RegExp("[\\u0903\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A19-\\u1A1B\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF2\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BD-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]"), - connector_punctuation: new RegExp("[\\u005F\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]") -}; - -function is_letter(ch) { - return UNICODE.letter.test(ch); -}; - -function is_digit(ch) { - ch = ch.charCodeAt(0); - return ch >= 48 && ch <= 57; //XXX: find out if "UnicodeDigit" means something else than 0..9 -}; - -function is_alphanumeric_char(ch) { - return is_digit(ch) || is_letter(ch); -}; - -function is_unicode_combining_mark(ch) { - return UNICODE.non_spacing_mark.test(ch) || UNICODE.space_combining_mark.test(ch); -}; - -function is_unicode_connector_punctuation(ch) { - return UNICODE.connector_punctuation.test(ch); -}; - -function is_identifier_start(ch) { - return ch == "$" || ch == "_" || is_letter(ch); -}; - -function is_identifier_char(ch) { - return is_identifier_start(ch) - || is_unicode_combining_mark(ch) - || is_digit(ch) - || is_unicode_connector_punctuation(ch) - || ch == "\u200c" // zero-width non-joiner - || ch == "\u200d" // zero-width joiner (in my ECMA-262 PDF, this is also 200c) - ; -}; - -function parse_js_number(num) { - if (RE_HEX_NUMBER.test(num)) { - return parseInt(num.substr(2), 16); - } else if (RE_OCT_NUMBER.test(num)) { - return parseInt(num.substr(1), 8); - } else if (RE_DEC_NUMBER.test(num)) { - return parseFloat(num); - } -}; - -function JS_Parse_Error(message, line, col, pos) { - this.message = message; - this.line = line; - this.col = col; - this.pos = pos; - try { - ({})(); - } catch(ex) { - this.stack = ex.stack; - }; -}; - -JS_Parse_Error.prototype.toString = function() { - return this.message + " (line: " + this.line + ", col: " + this.col + ", pos: " + this.pos + ")" + "\n\n" + this.stack; -}; - -function js_error(message, line, col, pos) { - throw new JS_Parse_Error(message, line, col, pos); -}; - -function is_token(token, type, val) { - return token.type == type && (val == null || token.value == val); -}; - -var EX_EOF = {}; - -function tokenizer($TEXT) { - - var S = { - text : $TEXT.replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, ''), - pos : 0, - tokpos : 0, - line : 0, - tokline : 0, - col : 0, - tokcol : 0, - newline_before : false, - regex_allowed : false, - comments_before : [] - }; - - function peek() { return S.text.charAt(S.pos); }; - - function next(signal_eof) { - var ch = S.text.charAt(S.pos++); - if (signal_eof && !ch) - throw EX_EOF; - if (ch == "\n") { - S.newline_before = true; - ++S.line; - S.col = 0; - } else { - ++S.col; - } - return ch; - }; - - function eof() { - return !S.peek(); - }; - - function find(what, signal_eof) { - var pos = S.text.indexOf(what, S.pos); - if (signal_eof && pos == -1) throw EX_EOF; - return pos; - }; - - function start_token() { - S.tokline = S.line; - S.tokcol = S.col; - S.tokpos = S.pos; - }; - - function token(type, value, is_comment) { - S.regex_allowed = ((type == "operator" && !HOP(UNARY_POSTFIX, value)) || - (type == "keyword" && HOP(KEYWORDS_BEFORE_EXPRESSION, value)) || - (type == "punc" && HOP(PUNC_BEFORE_EXPRESSION, value))); - var ret = { - type : type, - value : value, - line : S.tokline, - col : S.tokcol, - pos : S.tokpos, - nlb : S.newline_before - }; - if (!is_comment) { - ret.comments_before = S.comments_before; - S.comments_before = []; - } - S.newline_before = false; - return ret; - }; - - function skip_whitespace() { - while (HOP(WHITESPACE_CHARS, peek())) - next(); - }; - - function read_while(pred) { - var ret = "", ch = peek(), i = 0; - while (ch && pred(ch, i++)) { - ret += next(); - ch = peek(); - } - return ret; - }; - - function parse_error(err) { - js_error(err, S.tokline, S.tokcol, S.tokpos); - }; - - function read_num(prefix) { - var has_e = false, after_e = false, has_x = false, has_dot = prefix == "."; - var num = read_while(function(ch, i){ - if (ch == "x" || ch == "X") { - if (has_x) return false; - return has_x = true; - } - if (!has_x && (ch == "E" || ch == "e")) { - if (has_e) return false; - return has_e = after_e = true; - } - if (ch == "-") { - if (after_e || (i == 0 && !prefix)) return true; - return false; - } - if (ch == "+") return after_e; - after_e = false; - if (ch == ".") { - if (!has_dot && !has_x) - return has_dot = true; - return false; - } - return is_alphanumeric_char(ch); - }); - if (prefix) - num = prefix + num; - var valid = parse_js_number(num); - if (!isNaN(valid)) { - return token("num", valid); - } else { - parse_error("Invalid syntax: " + num); - } - }; - - function read_escaped_char() { - var ch = next(true); - switch (ch) { - case "n" : return "\n"; - case "r" : return "\r"; - case "t" : return "\t"; - case "b" : return "\b"; - case "v" : return "\v"; - case "f" : return "\f"; - case "0" : return "\0"; - case "x" : return String.fromCharCode(hex_bytes(2)); - case "u" : return String.fromCharCode(hex_bytes(4)); - default : return ch; - } - }; - - function hex_bytes(n) { - var num = 0; - for (; n > 0; --n) { - var digit = parseInt(next(true), 16); - if (isNaN(digit)) - parse_error("Invalid hex-character pattern in string"); - num = (num << 4) | digit; - } - return num; - }; - - function read_string() { - return with_eof_error("Unterminated string constant", function(){ - var quote = next(), ret = ""; - for (;;) { - var ch = next(true); - if (ch == "\\") ch = read_escaped_char(); - else if (ch == quote) break; - ret += ch; - } - return token("string", ret); - }); - }; - - function read_line_comment() { - next(); - var i = find("\n"), ret; - if (i == -1) { - ret = S.text.substr(S.pos); - S.pos = S.text.length; - } else { - ret = S.text.substring(S.pos, i); - S.pos = i; - } - return token("comment1", ret, true); - }; - - function read_multiline_comment() { - next(); - return with_eof_error("Unterminated multiline comment", function(){ - var i = find("*/", true), - text = S.text.substring(S.pos, i), - tok = token("comment2", text, true); - S.pos = i + 2; - S.line += text.split("\n").length - 1; - S.newline_before = text.indexOf("\n") >= 0; - - // https://github.com/mishoo/UglifyJS/issues/#issue/100 - if (/^@cc_on/i.test(text)) { - warn("WARNING: at line " + S.line); - warn("*** Found \"conditional comment\": " + text); - warn("*** UglifyJS DISCARDS ALL COMMENTS. This means your code might no longer work properly in Internet Explorer."); - } - - return tok; - }); - }; - - function read_name() { - var backslash = false, name = "", ch; - while ((ch = peek()) != null) { - if (!backslash) { - if (ch == "\\") backslash = true, next(); - else if (is_identifier_char(ch)) name += next(); - else break; - } - else { - if (ch != "u") parse_error("Expecting UnicodeEscapeSequence -- uXXXX"); - ch = read_escaped_char(); - if (!is_identifier_char(ch)) parse_error("Unicode char: " + ch.charCodeAt(0) + " is not valid in identifier"); - name += ch; - backslash = false; - } - } - return name; - }; - - function read_regexp() { - return with_eof_error("Unterminated regular expression", function(){ - var prev_backslash = false, regexp = "", ch, in_class = false; - while ((ch = next(true))) if (prev_backslash) { - regexp += "\\" + ch; - prev_backslash = false; - } else if (ch == "[") { - in_class = true; - regexp += ch; - } else if (ch == "]" && in_class) { - in_class = false; - regexp += ch; - } else if (ch == "/" && !in_class) { - break; - } else if (ch == "\\") { - prev_backslash = true; - } else { - regexp += ch; - } - var mods = read_name(); - return token("regexp", [ regexp, mods ]); - }); - }; - - function read_operator(prefix) { - function grow(op) { - if (!peek()) return op; - var bigger = op + peek(); - if (HOP(OPERATORS, bigger)) { - next(); - return grow(bigger); - } else { - return op; - } - }; - return token("operator", grow(prefix || next())); - }; - - function handle_slash() { - next(); - var regex_allowed = S.regex_allowed; - switch (peek()) { - case "/": - S.comments_before.push(read_line_comment()); - S.regex_allowed = regex_allowed; - return next_token(); - case "*": - S.comments_before.push(read_multiline_comment()); - S.regex_allowed = regex_allowed; - return next_token(); - } - return S.regex_allowed ? read_regexp() : read_operator("/"); - }; - - function handle_dot() { - next(); - return is_digit(peek()) - ? read_num(".") - : token("punc", "."); - }; - - function read_word() { - var word = read_name(); - return !HOP(KEYWORDS, word) - ? token("name", word) - : HOP(OPERATORS, word) - ? token("operator", word) - : HOP(KEYWORDS_ATOM, word) - ? token("atom", word) - : token("keyword", word); - }; - - function with_eof_error(eof_error, cont) { - try { - return cont(); - } catch(ex) { - if (ex === EX_EOF) parse_error(eof_error); - else throw ex; - } - }; - - function next_token(force_regexp) { - if (force_regexp) - return read_regexp(); - skip_whitespace(); - start_token(); - var ch = peek(); - if (!ch) return token("eof"); - if (is_digit(ch)) return read_num(); - if (ch == '"' || ch == "'") return read_string(); - if (HOP(PUNC_CHARS, ch)) return token("punc", next()); - if (ch == ".") return handle_dot(); - if (ch == "/") return handle_slash(); - if (HOP(OPERATOR_CHARS, ch)) return read_operator(); - if (ch == "\\" || is_identifier_start(ch)) return read_word(); - parse_error("Unexpected character '" + ch + "'"); - }; - - next_token.context = function(nc) { - if (nc) S = nc; - return S; - }; - - return next_token; - -}; - -/* -----[ Parser (constants) ]----- */ - -var UNARY_PREFIX = array_to_hash([ - "typeof", - "void", - "delete", - "--", - "++", - "!", - "~", - "-", - "+" -]); - -var UNARY_POSTFIX = array_to_hash([ "--", "++" ]); - -var ASSIGNMENT = (function(a, ret, i){ - while (i < a.length) { - ret[a[i]] = a[i].substr(0, a[i].length - 1); - i++; - } - return ret; -})( - ["+=", "-=", "/=", "*=", "%=", ">>=", "<<=", ">>>=", "|=", "^=", "&="], - { "=": true }, - 0 -); - -var PRECEDENCE = (function(a, ret){ - for (var i = 0, n = 1; i < a.length; ++i, ++n) { - var b = a[i]; - for (var j = 0; j < b.length; ++j) { - ret[b[j]] = n; - } - } - return ret; -})( - [ - ["||"], - ["&&"], - ["|"], - ["^"], - ["&"], - ["==", "===", "!=", "!=="], - ["<", ">", "<=", ">=", "in", "instanceof"], - [">>", "<<", ">>>"], - ["+", "-"], - ["*", "/", "%"] - ], - {} -); - -var STATEMENTS_WITH_LABELS = array_to_hash([ "for", "do", "while", "switch" ]); - -var ATOMIC_START_TOKEN = array_to_hash([ "atom", "num", "string", "regexp", "name" ]); - -/* -----[ Parser ]----- */ - -function NodeWithToken(str, start, end) { - this.name = str; - this.start = start; - this.end = end; -}; - -NodeWithToken.prototype.toString = function() { return this.name; }; - -function parse($TEXT, exigent_mode, embed_tokens) { - - var S = { - input : typeof $TEXT == "string" ? tokenizer($TEXT, true) : $TEXT, - token : null, - prev : null, - peeked : null, - in_function : 0, - in_loop : 0, - labels : [] - }; - - S.token = next(); - - function is(type, value) { - return is_token(S.token, type, value); - }; - - function peek() { return S.peeked || (S.peeked = S.input()); }; - - function next() { - S.prev = S.token; - if (S.peeked) { - S.token = S.peeked; - S.peeked = null; - } else { - S.token = S.input(); - } - return S.token; - }; - - function prev() { - return S.prev; - }; - - function croak(msg, line, col, pos) { - var ctx = S.input.context(); - js_error(msg, - line != null ? line : ctx.tokline, - col != null ? col : ctx.tokcol, - pos != null ? pos : ctx.tokpos); - }; - - function token_error(token, msg) { - croak(msg, token.line, token.col); - }; - - function unexpected(token) { - if (token == null) - token = S.token; - token_error(token, "Unexpected token: " + token.type + " (" + token.value + ")"); - }; - - function expect_token(type, val) { - if (is(type, val)) { - return next(); - } - token_error(S.token, "Unexpected token " + S.token.type + ", expected " + type); - }; - - function expect(punc) { return expect_token("punc", punc); }; - - function can_insert_semicolon() { - return !exigent_mode && ( - S.token.nlb || is("eof") || is("punc", "}") - ); - }; - - function semicolon() { - if (is("punc", ";")) next(); - else if (!can_insert_semicolon()) unexpected(); - }; - - function as() { - return slice(arguments); - }; - - function parenthesised() { - expect("("); - var ex = expression(); - expect(")"); - return ex; - }; - - function add_tokens(str, start, end) { - return str instanceof NodeWithToken ? str : new NodeWithToken(str, start, end); - }; - - function maybe_embed_tokens(parser) { - if (embed_tokens) return function() { - var start = S.token; - var ast = parser.apply(this, arguments); - ast[0] = add_tokens(ast[0], start, prev()); - return ast; - }; - else return parser; - }; - - var statement = maybe_embed_tokens(function() { - if (is("operator", "/")) { - S.peeked = null; - S.token = S.input(true); // force regexp - } - switch (S.token.type) { - case "num": - case "string": - case "regexp": - case "operator": - case "atom": - return simple_statement(); - - case "name": - return is_token(peek(), "punc", ":") - ? labeled_statement(prog1(S.token.value, next, next)) - : simple_statement(); - - case "punc": - switch (S.token.value) { - case "{": - return as("block", block_()); - case "[": - case "(": - return simple_statement(); - case ";": - next(); - return as("block"); - default: - unexpected(); - } - - case "keyword": - switch (prog1(S.token.value, next)) { - case "break": - return break_cont("break"); - - case "continue": - return break_cont("continue"); - - case "debugger": - semicolon(); - return as("debugger"); - - case "do": - return (function(body){ - expect_token("keyword", "while"); - return as("do", prog1(parenthesised, semicolon), body); - })(in_loop(statement)); - - case "for": - return for_(); - - case "function": - return function_(true); - - case "if": - return if_(); - - case "return": - if (S.in_function == 0) - croak("'return' outside of function"); - return as("return", - is("punc", ";") - ? (next(), null) - : can_insert_semicolon() - ? null - : prog1(expression, semicolon)); - - case "switch": - return as("switch", parenthesised(), switch_block_()); - - case "throw": - return as("throw", prog1(expression, semicolon)); - - case "try": - return try_(); - - case "var": - return prog1(var_, semicolon); - - case "const": - return prog1(const_, semicolon); - - case "while": - return as("while", parenthesised(), in_loop(statement)); - - case "with": - return as("with", parenthesised(), statement()); - - default: - unexpected(); - } - } - }); - - function labeled_statement(label) { - S.labels.push(label); - var start = S.token, stat = statement(); - if (exigent_mode && !HOP(STATEMENTS_WITH_LABELS, stat[0])) - unexpected(start); - S.labels.pop(); - return as("label", label, stat); - }; - - function simple_statement() { - return as("stat", prog1(expression, semicolon)); - }; - - function break_cont(type) { - var name = is("name") ? S.token.value : null; - if (name != null) { - next(); - if (!member(name, S.labels)) - croak("Label " + name + " without matching loop or statement"); - } - else if (S.in_loop == 0) - croak(type + " not inside a loop or switch"); - semicolon(); - return as(type, name); - }; - - function for_() { - expect("("); - var init = null; - if (!is("punc", ";")) { - init = is("keyword", "var") - ? (next(), var_(true)) - : expression(true, true); - if (is("operator", "in")) - return for_in(init); - } - return regular_for(init); - }; - - function regular_for(init) { - expect(";"); - var test = is("punc", ";") ? null : expression(); - expect(";"); - var step = is("punc", ")") ? null : expression(); - expect(")"); - return as("for", init, test, step, in_loop(statement)); - }; - - function for_in(init) { - var lhs = init[0] == "var" ? as("name", init[1][0]) : init; - next(); - var obj = expression(); - expect(")"); - return as("for-in", init, lhs, obj, in_loop(statement)); - }; - - var function_ = maybe_embed_tokens(function(in_statement) { - var name = is("name") ? prog1(S.token.value, next) : null; - if (in_statement && !name) - unexpected(); - expect("("); - return as(in_statement ? "defun" : "function", - name, - // arguments - (function(first, a){ - while (!is("punc", ")")) { - if (first) first = false; else expect(","); - if (!is("name")) unexpected(); - a.push(S.token.value); - next(); - } - next(); - return a; - })(true, []), - // body - (function(){ - ++S.in_function; - var loop = S.in_loop; - S.in_loop = 0; - var a = block_(); - --S.in_function; - S.in_loop = loop; - return a; - })()); - }); - - function if_() { - var cond = parenthesised(), body = statement(), belse; - if (is("keyword", "else")) { - next(); - belse = statement(); - } - return as("if", cond, body, belse); - }; - - function block_() { - expect("{"); - var a = []; - while (!is("punc", "}")) { - if (is("eof")) unexpected(); - a.push(statement()); - } - next(); - return a; - }; - - var switch_block_ = curry(in_loop, function(){ - expect("{"); - var a = [], cur = null; - while (!is("punc", "}")) { - if (is("eof")) unexpected(); - if (is("keyword", "case")) { - next(); - cur = []; - a.push([ expression(), cur ]); - expect(":"); - } - else if (is("keyword", "default")) { - next(); - expect(":"); - cur = []; - a.push([ null, cur ]); - } - else { - if (!cur) unexpected(); - cur.push(statement()); - } - } - next(); - return a; - }); - - function try_() { - var body = block_(), bcatch, bfinally; - if (is("keyword", "catch")) { - next(); - expect("("); - if (!is("name")) - croak("Name expected"); - var name = S.token.value; - next(); - expect(")"); - bcatch = [ name, block_() ]; - } - if (is("keyword", "finally")) { - next(); - bfinally = block_(); - } - if (!bcatch && !bfinally) - croak("Missing catch/finally blocks"); - return as("try", body, bcatch, bfinally); - }; - - function vardefs(no_in) { - var a = []; - for (;;) { - if (!is("name")) - unexpected(); - var name = S.token.value; - next(); - if (is("operator", "=")) { - next(); - a.push([ name, expression(false, no_in) ]); - } else { - a.push([ name ]); - } - if (!is("punc", ",")) - break; - next(); - } - return a; - }; - - function var_(no_in) { - return as("var", vardefs(no_in)); - }; - - function const_() { - return as("const", vardefs()); - }; - - function new_() { - var newexp = expr_atom(false), args; - if (is("punc", "(")) { - next(); - args = expr_list(")"); - } else { - args = []; - } - return subscripts(as("new", newexp, args), true); - }; - - var expr_atom = maybe_embed_tokens(function(allow_calls) { - if (is("operator", "new")) { - next(); - return new_(); - } - if (is("operator") && HOP(UNARY_PREFIX, S.token.value)) { - return make_unary("unary-prefix", - prog1(S.token.value, next), - expr_atom(allow_calls)); - } - if (is("punc")) { - switch (S.token.value) { - case "(": - next(); - return subscripts(prog1(expression, curry(expect, ")")), allow_calls); - case "[": - next(); - return subscripts(array_(), allow_calls); - case "{": - next(); - return subscripts(object_(), allow_calls); - } - unexpected(); - } - if (is("keyword", "function")) { - next(); - return subscripts(function_(false), allow_calls); - } - if (HOP(ATOMIC_START_TOKEN, S.token.type)) { - var atom = S.token.type == "regexp" - ? as("regexp", S.token.value[0], S.token.value[1]) - : as(S.token.type, S.token.value); - return subscripts(prog1(atom, next), allow_calls); - } - unexpected(); - }); - - function expr_list(closing, allow_trailing_comma, allow_empty) { - var first = true, a = []; - while (!is("punc", closing)) { - if (first) first = false; else expect(","); - if (allow_trailing_comma && is("punc", closing)) break; - if (is("punc", ",") && allow_empty) { - a.push([ "atom", "undefined" ]); - } else { - a.push(expression(false)); - } - } - next(); - return a; - }; - - function array_() { - return as("array", expr_list("]", !exigent_mode, true)); - }; - - function object_() { - var first = true, a = []; - while (!is("punc", "}")) { - if (first) first = false; else expect(","); - if (!exigent_mode && is("punc", "}")) - // allow trailing comma - break; - var type = S.token.type; - var name = as_property_name(); - if (type == "name" && (name == "get" || name == "set") && !is("punc", ":")) { - a.push([ as_name(), function_(false), name ]); - } else { - expect(":"); - a.push([ name, expression(false) ]); - } - } - next(); - return as("object", a); - }; - - function as_property_name() { - switch (S.token.type) { - case "num": - case "string": - return prog1(S.token.value, next); - } - return as_name(); - }; - - function as_name() { - switch (S.token.type) { - case "name": - case "operator": - case "keyword": - case "atom": - return prog1(S.token.value, next); - default: - unexpected(); - } - }; - - function subscripts(expr, allow_calls) { - if (is("punc", ".")) { - next(); - return subscripts(as("dot", expr, as_name()), allow_calls); - } - if (is("punc", "[")) { - next(); - return subscripts(as("sub", expr, prog1(expression, curry(expect, "]"))), allow_calls); - } - if (allow_calls && is("punc", "(")) { - next(); - return subscripts(as("call", expr, expr_list(")")), true); - } - if (allow_calls && is("operator") && HOP(UNARY_POSTFIX, S.token.value)) { - return prog1(curry(make_unary, "unary-postfix", S.token.value, expr), - next); - } - return expr; - }; - - function make_unary(tag, op, expr) { - if ((op == "++" || op == "--") && !is_assignable(expr)) - croak("Invalid use of " + op + " operator"); - return as(tag, op, expr); - }; - - function expr_op(left, min_prec, no_in) { - var op = is("operator") ? S.token.value : null; - if (op && op == "in" && no_in) op = null; - var prec = op != null ? PRECEDENCE[op] : null; - if (prec != null && prec > min_prec) { - next(); - var right = expr_op(expr_atom(true), prec, no_in); - return expr_op(as("binary", op, left, right), min_prec, no_in); - } - return left; - }; - - function expr_ops(no_in) { - return expr_op(expr_atom(true), 0, no_in); - }; - - function maybe_conditional(no_in) { - var expr = expr_ops(no_in); - if (is("operator", "?")) { - next(); - var yes = expression(false); - expect(":"); - return as("conditional", expr, yes, expression(false, no_in)); - } - return expr; - }; - - function is_assignable(expr) { - if (!exigent_mode) return true; - switch (expr[0]) { - case "dot": - case "sub": - case "new": - case "call": - return true; - case "name": - return expr[1] != "this"; - } - }; - - function maybe_assign(no_in) { - var left = maybe_conditional(no_in), val = S.token.value; - if (is("operator") && HOP(ASSIGNMENT, val)) { - if (is_assignable(left)) { - next(); - return as("assign", ASSIGNMENT[val], left, maybe_assign(no_in)); - } - croak("Invalid assignment"); - } - return left; - }; - - var expression = maybe_embed_tokens(function(commas, no_in) { - if (arguments.length == 0) - commas = true; - var expr = maybe_assign(no_in); - if (commas && is("punc", ",")) { - next(); - return as("seq", expr, expression(true, no_in)); - } - return expr; - }); - - function in_loop(cont) { - try { - ++S.in_loop; - return cont(); - } finally { - --S.in_loop; - } - }; - - return as("toplevel", (function(a){ - while (!is("eof")) - a.push(statement()); - return a; - })([])); - -}; - -/* -----[ Utilities ]----- */ - -function curry(f) { - var args = slice(arguments, 1); - return function() { return f.apply(this, args.concat(slice(arguments))); }; -}; - -function prog1(ret) { - if (ret instanceof Function) - ret = ret(); - for (var i = 1, n = arguments.length; --n > 0; ++i) - arguments[i](); - return ret; -}; - -function array_to_hash(a) { - var ret = {}; - for (var i = 0; i < a.length; ++i) - ret[a[i]] = true; - return ret; -}; - -function slice(a, start) { - return Array.prototype.slice.call(a, start == null ? 0 : start); -}; - -function characters(str) { - return str.split(""); -}; - -function member(name, array) { - for (var i = array.length; --i >= 0;) - if (array[i] === name) - return true; - return false; -}; - -function HOP(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -}; - -var warn = function() {}; - -/* -----[ Exports ]----- */ - -exports.tokenizer = tokenizer; -exports.parse = parse; -exports.slice = slice; -exports.curry = curry; -exports.member = member; -exports.array_to_hash = array_to_hash; -exports.PRECEDENCE = PRECEDENCE; -exports.KEYWORDS_ATOM = KEYWORDS_ATOM; -exports.RESERVED_WORDS = RESERVED_WORDS; -exports.KEYWORDS = KEYWORDS; -exports.ATOMIC_START_TOKEN = ATOMIC_START_TOKEN; -exports.OPERATORS = OPERATORS; -exports.is_alphanumeric_char = is_alphanumeric_char; -exports.set_logger = function(logger) { - warn = logger; -}; diff --git a/bower_components/jquery/build/lib/process.js b/bower_components/jquery/build/lib/process.js deleted file mode 100644 index 3878c8d6..00000000 --- a/bower_components/jquery/build/lib/process.js +++ /dev/null @@ -1,1666 +0,0 @@ -/*********************************************************************** - - A JavaScript tokenizer / parser / beautifier / compressor. - - This version is suitable for Node.js. With minimal changes (the - exports stuff) it should work on any JS platform. - - This file implements some AST processors. They work on data built - by parse-js. - - Exported functions: - - - ast_mangle(ast, options) -- mangles the variable/function names - in the AST. Returns an AST. - - - ast_squeeze(ast) -- employs various optimizations to make the - final generated code even smaller. Returns an AST. - - - gen_code(ast, options) -- generates JS code from the AST. Pass - true (or an object, see the code for some options) as second - argument to get "pretty" (indented) code. - - -------------------------------- (C) --------------------------------- - - Author: Mihai Bazon - - http://mihai.bazon.net/blog - - Distributed under the BSD license: - - Copyright 2010 (c) Mihai Bazon - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above - copyright notice, this list of conditions and the following - disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. - - ***********************************************************************/ - -var jsp = require("./parse-js"), - slice = jsp.slice, - member = jsp.member, - PRECEDENCE = jsp.PRECEDENCE, - OPERATORS = jsp.OPERATORS; - -/* -----[ helper for AST traversal ]----- */ - -function ast_walker(ast) { - function _vardefs(defs) { - return [ this[0], MAP(defs, function(def){ - var a = [ def[0] ]; - if (def.length > 1) - a[1] = walk(def[1]); - return a; - }) ]; - }; - function _block(statements) { - var out = [ this[0] ]; - if (statements != null) - out.push(MAP(statements, walk)); - return out; - }; - var walkers = { - "string": function(str) { - return [ this[0], str ]; - }, - "num": function(num) { - return [ this[0], num ]; - }, - "name": function(name) { - return [ this[0], name ]; - }, - "toplevel": function(statements) { - return [ this[0], MAP(statements, walk) ]; - }, - "block": _block, - "splice": _block, - "var": _vardefs, - "const": _vardefs, - "try": function(t, c, f) { - return [ - this[0], - MAP(t, walk), - c != null ? [ c[0], MAP(c[1], walk) ] : null, - f != null ? MAP(f, walk) : null - ]; - }, - "throw": function(expr) { - return [ this[0], walk(expr) ]; - }, - "new": function(ctor, args) { - return [ this[0], walk(ctor), MAP(args, walk) ]; - }, - "switch": function(expr, body) { - return [ this[0], walk(expr), MAP(body, function(branch){ - return [ branch[0] ? walk(branch[0]) : null, - MAP(branch[1], walk) ]; - }) ]; - }, - "break": function(label) { - return [ this[0], label ]; - }, - "continue": function(label) { - return [ this[0], label ]; - }, - "conditional": function(cond, t, e) { - return [ this[0], walk(cond), walk(t), walk(e) ]; - }, - "assign": function(op, lvalue, rvalue) { - return [ this[0], op, walk(lvalue), walk(rvalue) ]; - }, - "dot": function(expr) { - return [ this[0], walk(expr) ].concat(slice(arguments, 1)); - }, - "call": function(expr, args) { - return [ this[0], walk(expr), MAP(args, walk) ]; - }, - "function": function(name, args, body) { - return [ this[0], name, args.slice(), MAP(body, walk) ]; - }, - "defun": function(name, args, body) { - return [ this[0], name, args.slice(), MAP(body, walk) ]; - }, - "if": function(conditional, t, e) { - return [ this[0], walk(conditional), walk(t), walk(e) ]; - }, - "for": function(init, cond, step, block) { - return [ this[0], walk(init), walk(cond), walk(step), walk(block) ]; - }, - "for-in": function(vvar, key, hash, block) { - return [ this[0], walk(vvar), walk(key), walk(hash), walk(block) ]; - }, - "while": function(cond, block) { - return [ this[0], walk(cond), walk(block) ]; - }, - "do": function(cond, block) { - return [ this[0], walk(cond), walk(block) ]; - }, - "return": function(expr) { - return [ this[0], walk(expr) ]; - }, - "binary": function(op, left, right) { - return [ this[0], op, walk(left), walk(right) ]; - }, - "unary-prefix": function(op, expr) { - return [ this[0], op, walk(expr) ]; - }, - "unary-postfix": function(op, expr) { - return [ this[0], op, walk(expr) ]; - }, - "sub": function(expr, subscript) { - return [ this[0], walk(expr), walk(subscript) ]; - }, - "object": function(props) { - return [ this[0], MAP(props, function(p){ - return p.length == 2 - ? [ p[0], walk(p[1]) ] - : [ p[0], walk(p[1]), p[2] ]; // get/set-ter - }) ]; - }, - "regexp": function(rx, mods) { - return [ this[0], rx, mods ]; - }, - "array": function(elements) { - return [ this[0], MAP(elements, walk) ]; - }, - "stat": function(stat) { - return [ this[0], walk(stat) ]; - }, - "seq": function() { - return [ this[0] ].concat(MAP(slice(arguments), walk)); - }, - "label": function(name, block) { - return [ this[0], name, walk(block) ]; - }, - "with": function(expr, block) { - return [ this[0], walk(expr), walk(block) ]; - }, - "atom": function(name) { - return [ this[0], name ]; - } - }; - - var user = {}; - var stack = []; - function walk(ast) { - if (ast == null) - return null; - try { - stack.push(ast); - var type = ast[0]; - var gen = user[type]; - if (gen) { - var ret = gen.apply(ast, ast.slice(1)); - if (ret != null) - return ret; - } - gen = walkers[type]; - return gen.apply(ast, ast.slice(1)); - } finally { - stack.pop(); - } - }; - - function with_walkers(walkers, cont){ - var save = {}, i; - for (i in walkers) if (HOP(walkers, i)) { - save[i] = user[i]; - user[i] = walkers[i]; - } - var ret = cont(); - for (i in save) if (HOP(save, i)) { - if (!save[i]) delete user[i]; - else user[i] = save[i]; - } - return ret; - }; - - return { - walk: walk, - with_walkers: with_walkers, - parent: function() { - return stack[stack.length - 2]; // last one is current node - }, - stack: function() { - return stack; - } - }; -}; - -/* -----[ Scope and mangling ]----- */ - -function Scope(parent) { - this.names = {}; // names defined in this scope - this.mangled = {}; // mangled names (orig.name => mangled) - this.rev_mangled = {}; // reverse lookup (mangled => orig.name) - this.cname = -1; // current mangled name - this.refs = {}; // names referenced from this scope - this.uses_with = false; // will become TRUE if with() is detected in this or any subscopes - this.uses_eval = false; // will become TRUE if eval() is detected in this or any subscopes - this.parent = parent; // parent scope - this.children = []; // sub-scopes - if (parent) { - this.level = parent.level + 1; - parent.children.push(this); - } else { - this.level = 0; - } -}; - -var base54 = (function(){ - var DIGITS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"; - return function(num) { - var ret = ""; - do { - ret = DIGITS.charAt(num % 54) + ret; - num = Math.floor(num / 54); - } while (num > 0); - return ret; - }; -})(); - -Scope.prototype = { - has: function(name) { - for (var s = this; s; s = s.parent) - if (HOP(s.names, name)) - return s; - }, - has_mangled: function(mname) { - for (var s = this; s; s = s.parent) - if (HOP(s.rev_mangled, mname)) - return s; - }, - toJSON: function() { - return { - names: this.names, - uses_eval: this.uses_eval, - uses_with: this.uses_with - }; - }, - - next_mangled: function() { - // we must be careful that the new mangled name: - // - // 1. doesn't shadow a mangled name from a parent - // scope, unless we don't reference the original - // name from this scope OR from any sub-scopes! - // This will get slow. - // - // 2. doesn't shadow an original name from a parent - // scope, in the event that the name is not mangled - // in the parent scope and we reference that name - // here OR IN ANY SUBSCOPES! - // - // 3. doesn't shadow a name that is referenced but not - // defined (possibly global defined elsewhere). - for (;;) { - var m = base54(++this.cname), prior; - - // case 1. - prior = this.has_mangled(m); - if (prior && this.refs[prior.rev_mangled[m]] === prior) - continue; - - // case 2. - prior = this.has(m); - if (prior && prior !== this && this.refs[m] === prior && !prior.has_mangled(m)) - continue; - - // case 3. - if (HOP(this.refs, m) && this.refs[m] == null) - continue; - - // I got "do" once. :-/ - if (!is_identifier(m)) - continue; - - return m; - } - }, - get_mangled: function(name, newMangle) { - if (this.uses_eval || this.uses_with) return name; // no mangle if eval or with is in use - var s = this.has(name); - if (!s) return name; // not in visible scope, no mangle - if (HOP(s.mangled, name)) return s.mangled[name]; // already mangled in this scope - if (!newMangle) return name; // not found and no mangling requested - - var m = s.next_mangled(); - s.rev_mangled[m] = name; - return s.mangled[name] = m; - }, - define: function(name) { - if (name != null) - return this.names[name] = name; - } -}; - -function ast_add_scope(ast) { - - var current_scope = null; - var w = ast_walker(), walk = w.walk; - var having_eval = []; - - function with_new_scope(cont) { - current_scope = new Scope(current_scope); - var ret = current_scope.body = cont(); - ret.scope = current_scope; - current_scope = current_scope.parent; - return ret; - }; - - function define(name) { - return current_scope.define(name); - }; - - function reference(name) { - current_scope.refs[name] = true; - }; - - function _lambda(name, args, body) { - var is_defun = this[0] == "defun"; - return [ this[0], is_defun ? define(name) : name, args, with_new_scope(function(){ - if (!is_defun) define(name); - MAP(args, define); - return MAP(body, walk); - })]; - }; - - return with_new_scope(function(){ - // process AST - var ret = w.with_walkers({ - "function": _lambda, - "defun": _lambda, - "with": function(expr, block) { - for (var s = current_scope; s; s = s.parent) - s.uses_with = true; - }, - "var": function(defs) { - MAP(defs, function(d){ define(d[0]) }); - }, - "const": function(defs) { - MAP(defs, function(d){ define(d[0]) }); - }, - "try": function(t, c, f) { - if (c != null) return [ - this[0], - MAP(t, walk), - [ define(c[0]), MAP(c[1], walk) ], - f != null ? MAP(f, walk) : null - ]; - }, - "name": function(name) { - if (name == "eval") - having_eval.push(current_scope); - reference(name); - } - }, function(){ - return walk(ast); - }); - - // the reason why we need an additional pass here is - // that names can be used prior to their definition. - - // scopes where eval was detected and their parents - // are marked with uses_eval, unless they define the - // "eval" name. - MAP(having_eval, function(scope){ - if (!scope.has("eval")) while (scope) { - scope.uses_eval = true; - scope = scope.parent; - } - }); - - // for referenced names it might be useful to know - // their origin scope. current_scope here is the - // toplevel one. - function fixrefs(scope, i) { - // do children first; order shouldn't matter - for (i = scope.children.length; --i >= 0;) - fixrefs(scope.children[i]); - for (i in scope.refs) if (HOP(scope.refs, i)) { - // find origin scope and propagate the reference to origin - for (var origin = scope.has(i), s = scope; s; s = s.parent) { - s.refs[i] = origin; - if (s === origin) break; - } - } - }; - fixrefs(current_scope); - - return ret; - }); - -}; - -/* -----[ mangle names ]----- */ - -function ast_mangle(ast, options) { - var w = ast_walker(), walk = w.walk, scope; - options = options || {}; - - function get_mangled(name, newMangle) { - if (!options.toplevel && !scope.parent) return name; // don't mangle toplevel - if (options.except && member(name, options.except)) - return name; - return scope.get_mangled(name, newMangle); - }; - - function get_define(name) { - // we always lookup a defined symbol for the current scope FIRST, so declared - // vars trump a DEFINE symbol, but if no such var is found, then match a DEFINE value - if (!scope.has(name)) { - if (HOP(options.defines, name)) { - return options.defines[name]; - } - } - return null; - }; - - function _lambda(name, args, body) { - var is_defun = this[0] == "defun"; - if (is_defun && name) name = get_mangled(name); - body = with_scope(body.scope, function(){ - if (!is_defun && name) name = get_mangled(name); - args = MAP(args, function(name){ return get_mangled(name) }); - return MAP(body, walk); - }); - return [ this[0], name, args, body ]; - }; - - function with_scope(s, cont) { - var _scope = scope; - scope = s; - for (var i in s.names) if (HOP(s.names, i)) { - get_mangled(i, true); - } - var ret = cont(); - ret.scope = s; - scope = _scope; - return ret; - }; - - function _vardefs(defs) { - return [ this[0], MAP(defs, function(d){ - return [ get_mangled(d[0]), walk(d[1]) ]; - }) ]; - }; - - return w.with_walkers({ - "function": _lambda, - "defun": function() { - // move function declarations to the top when - // they are not in some block. - var ast = _lambda.apply(this, arguments); - switch (w.parent()[0]) { - case "toplevel": - case "function": - case "defun": - return MAP.at_top(ast); - } - return ast; - }, - "var": _vardefs, - "const": _vardefs, - "name": function(name) { - return get_define(name) || [ this[0], get_mangled(name) ]; - }, - "try": function(t, c, f) { - return [ this[0], - MAP(t, walk), - c != null ? [ get_mangled(c[0]), MAP(c[1], walk) ] : null, - f != null ? MAP(f, walk) : null ]; - }, - "toplevel": function(body) { - var self = this; - return with_scope(self.scope, function(){ - return [ self[0], MAP(body, walk) ]; - }); - } - }, function() { - return walk(ast_add_scope(ast)); - }); -}; - -/* -----[ - - compress foo["bar"] into foo.bar, - - remove block brackets {} where possible - - join consecutive var declarations - - various optimizations for IFs: - - if (cond) foo(); else bar(); ==> cond?foo():bar(); - - if (cond) foo(); ==> cond&&foo(); - - if (foo) return bar(); else return baz(); ==> return foo?bar():baz(); // also for throw - - if (foo) return bar(); else something(); ==> {if(foo)return bar();something()} - ]----- */ - -var warn = function(){}; - -function best_of(ast1, ast2) { - return gen_code(ast1).length > gen_code(ast2[0] == "stat" ? ast2[1] : ast2).length ? ast2 : ast1; -}; - -function last_stat(b) { - if (b[0] == "block" && b[1] && b[1].length > 0) - return b[1][b[1].length - 1]; - return b; -} - -function aborts(t) { - if (t) { - t = last_stat(t); - if (t[0] == "return" || t[0] == "break" || t[0] == "continue" || t[0] == "throw") - return true; - } -}; - -function boolean_expr(expr) { - return ( (expr[0] == "unary-prefix" - && member(expr[1], [ "!", "delete" ])) || - - (expr[0] == "binary" - && member(expr[1], [ "in", "instanceof", "==", "!=", "===", "!==", "<", "<=", ">=", ">" ])) || - - (expr[0] == "binary" - && member(expr[1], [ "&&", "||" ]) - && boolean_expr(expr[2]) - && boolean_expr(expr[3])) || - - (expr[0] == "conditional" - && boolean_expr(expr[2]) - && boolean_expr(expr[3])) || - - (expr[0] == "assign" - && expr[1] === true - && boolean_expr(expr[3])) || - - (expr[0] == "seq" - && boolean_expr(expr[expr.length - 1])) - ); -}; - -function make_conditional(c, t, e) { - var make_real_conditional = function() { - if (c[0] == "unary-prefix" && c[1] == "!") { - return e ? [ "conditional", c[2], e, t ] : [ "binary", "||", c[2], t ]; - } else { - return e ? [ "conditional", c, t, e ] : [ "binary", "&&", c, t ]; - } - }; - // shortcut the conditional if the expression has a constant value - return when_constant(c, function(ast, val){ - warn_unreachable(val ? e : t); - return (val ? t : e); - }, make_real_conditional); -}; - -function empty(b) { - return !b || (b[0] == "block" && (!b[1] || b[1].length == 0)); -}; - -function is_string(node) { - return (node[0] == "string" || - node[0] == "unary-prefix" && node[1] == "typeof" || - node[0] == "binary" && node[1] == "+" && - (is_string(node[2]) || is_string(node[3]))); -}; - -var when_constant = (function(){ - - var $NOT_CONSTANT = {}; - - // this can only evaluate constant expressions. If it finds anything - // not constant, it throws $NOT_CONSTANT. - function evaluate(expr) { - switch (expr[0]) { - case "string": - case "num": - return expr[1]; - case "name": - case "atom": - switch (expr[1]) { - case "true": return true; - case "false": return false; - } - break; - case "unary-prefix": - switch (expr[1]) { - case "!": return !evaluate(expr[2]); - case "typeof": return typeof evaluate(expr[2]); - case "~": return ~evaluate(expr[2]); - case "-": return -evaluate(expr[2]); - case "+": return +evaluate(expr[2]); - } - break; - case "binary": - var left = expr[2], right = expr[3]; - switch (expr[1]) { - case "&&" : return evaluate(left) && evaluate(right); - case "||" : return evaluate(left) || evaluate(right); - case "|" : return evaluate(left) | evaluate(right); - case "&" : return evaluate(left) & evaluate(right); - case "^" : return evaluate(left) ^ evaluate(right); - case "+" : return evaluate(left) + evaluate(right); - case "*" : return evaluate(left) * evaluate(right); - case "/" : return evaluate(left) / evaluate(right); - case "-" : return evaluate(left) - evaluate(right); - case "<<" : return evaluate(left) << evaluate(right); - case ">>" : return evaluate(left) >> evaluate(right); - case ">>>" : return evaluate(left) >>> evaluate(right); - case "==" : return evaluate(left) == evaluate(right); - case "===" : return evaluate(left) === evaluate(right); - case "!=" : return evaluate(left) != evaluate(right); - case "!==" : return evaluate(left) !== evaluate(right); - case "<" : return evaluate(left) < evaluate(right); - case "<=" : return evaluate(left) <= evaluate(right); - case ">" : return evaluate(left) > evaluate(right); - case ">=" : return evaluate(left) >= evaluate(right); - case "in" : return evaluate(left) in evaluate(right); - case "instanceof" : return evaluate(left) instanceof evaluate(right); - } - } - throw $NOT_CONSTANT; - }; - - return function(expr, yes, no) { - try { - var val = evaluate(expr), ast; - switch (typeof val) { - case "string": ast = [ "string", val ]; break; - case "number": ast = [ "num", val ]; break; - case "boolean": ast = [ "name", String(val) ]; break; - default: throw new Error("Can't handle constant of type: " + (typeof val)); - } - return yes.call(expr, ast, val); - } catch(ex) { - if (ex === $NOT_CONSTANT) { - if (expr[0] == "binary" - && (expr[1] == "===" || expr[1] == "!==") - && ((is_string(expr[2]) && is_string(expr[3])) - || (boolean_expr(expr[2]) && boolean_expr(expr[3])))) { - expr[1] = expr[1].substr(0, 2); - } - else if (no && expr[0] == "binary" - && (expr[1] == "||" || expr[1] == "&&")) { - // the whole expression is not constant but the lval may be... - try { - var lval = evaluate(expr[2]); - expr = ((expr[1] == "&&" && (lval ? expr[3] : lval)) || - (expr[1] == "||" && (lval ? lval : expr[3])) || - expr); - } catch(ex2) { - // IGNORE... lval is not constant - } - } - return no ? no.call(expr, expr) : null; - } - else throw ex; - } - }; - -})(); - -function warn_unreachable(ast) { - if (!empty(ast)) - warn("Dropping unreachable code: " + gen_code(ast, true)); -}; - -function ast_squeeze(ast, options) { - options = defaults(options, { - make_seqs : true, - dead_code : true, - keep_comps : true, - no_warnings : false - }); - - var w = ast_walker(), walk = w.walk, scope; - - function negate(c) { - var not_c = [ "unary-prefix", "!", c ]; - switch (c[0]) { - case "unary-prefix": - return c[1] == "!" && boolean_expr(c[2]) ? c[2] : not_c; - case "seq": - c = slice(c); - c[c.length - 1] = negate(c[c.length - 1]); - return c; - case "conditional": - return best_of(not_c, [ "conditional", c[1], negate(c[2]), negate(c[3]) ]); - case "binary": - var op = c[1], left = c[2], right = c[3]; - if (!options.keep_comps) switch (op) { - case "<=" : return [ "binary", ">", left, right ]; - case "<" : return [ "binary", ">=", left, right ]; - case ">=" : return [ "binary", "<", left, right ]; - case ">" : return [ "binary", "<=", left, right ]; - } - switch (op) { - case "==" : return [ "binary", "!=", left, right ]; - case "!=" : return [ "binary", "==", left, right ]; - case "===" : return [ "binary", "!==", left, right ]; - case "!==" : return [ "binary", "===", left, right ]; - case "&&" : return best_of(not_c, [ "binary", "||", negate(left), negate(right) ]); - case "||" : return best_of(not_c, [ "binary", "&&", negate(left), negate(right) ]); - } - break; - } - return not_c; - }; - - function with_scope(s, cont) { - var _scope = scope; - scope = s; - var ret = cont(); - ret.scope = s; - scope = _scope; - return ret; - }; - - function rmblock(block) { - if (block != null && block[0] == "block" && block[1]) { - if (block[1].length == 1) - block = block[1][0]; - else if (block[1].length == 0) - block = [ "block" ]; - } - return block; - }; - - function _lambda(name, args, body) { - var is_defun = this[0] == "defun"; - body = with_scope(body.scope, function(){ - var ret = tighten(MAP(body, walk), "lambda"); - if (!is_defun && name && !HOP(scope.refs, name)) - name = null; - return ret; - }); - return [ this[0], name, args, body ]; - }; - - // we get here for blocks that have been already transformed. - // this function does a few things: - // 1. discard useless blocks - // 2. join consecutive var declarations - // 3. remove obviously dead code - // 4. transform consecutive statements using the comma operator - // 5. if block_type == "lambda" and it detects constructs like if(foo) return ... - rewrite like if (!foo) { ... } - function tighten(statements, block_type) { - statements = statements.reduce(function(a, stat){ - if (stat[0] == "block") { - if (stat[1]) { - a.push.apply(a, stat[1]); - } - } else { - a.push(stat); - } - return a; - }, []); - - statements = (function(a, prev){ - statements.forEach(function(cur){ - if (prev && ((cur[0] == "var" && prev[0] == "var") || - (cur[0] == "const" && prev[0] == "const"))) { - prev[1] = prev[1].concat(cur[1]); - } else { - a.push(cur); - prev = cur; - } - }); - return a; - })([]); - - if (options.dead_code) statements = (function(a, has_quit){ - statements.forEach(function(st){ - if (has_quit) { - if (member(st[0], [ "function", "defun" , "var", "const" ])) { - a.push(st); - } - else if (!options.no_warnings) - warn_unreachable(st); - } - else { - a.push(st); - if (member(st[0], [ "return", "throw", "break", "continue" ])) - has_quit = true; - } - }); - return a; - })([]); - - if (options.make_seqs) statements = (function(a, prev) { - statements.forEach(function(cur){ - if (prev && prev[0] == "stat" && cur[0] == "stat") { - prev[1] = [ "seq", prev[1], cur[1] ]; - } else { - a.push(cur); - prev = cur; - } - }); - return a; - })([]); - - if (block_type == "lambda") statements = (function(i, a, stat){ - while (i < statements.length) { - stat = statements[i++]; - if (stat[0] == "if" && !stat[3]) { - if (stat[2][0] == "return" && stat[2][1] == null) { - a.push(make_if(negate(stat[1]), [ "block", statements.slice(i) ])); - break; - } - var last = last_stat(stat[2]); - if (last[0] == "return" && last[1] == null) { - a.push(make_if(stat[1], [ "block", stat[2][1].slice(0, -1) ], [ "block", statements.slice(i) ])); - break; - } - } - a.push(stat); - } - return a; - })(0, []); - - return statements; - }; - - function make_if(c, t, e) { - return when_constant(c, function(ast, val){ - if (val) { - warn_unreachable(e); - return t; - } else { - warn_unreachable(t); - return e; - } - }, function() { - return make_real_if(c, t, e); - }); - }; - - function make_real_if(c, t, e) { - c = walk(c); - t = walk(t); - e = walk(e); - - if (empty(t)) { - c = negate(c); - t = e; - e = null; - } else if (empty(e)) { - e = null; - } else { - // if we have both else and then, maybe it makes sense to switch them? - (function(){ - var a = gen_code(c); - var n = negate(c); - var b = gen_code(n); - if (b.length < a.length) { - var tmp = t; - t = e; - e = tmp; - c = n; - } - })(); - } - if (empty(e) && empty(t)) - return [ "stat", c ]; - var ret = [ "if", c, t, e ]; - if (t[0] == "if" && empty(t[3]) && empty(e)) { - ret = best_of(ret, walk([ "if", [ "binary", "&&", c, t[1] ], t[2] ])); - } - else if (t[0] == "stat") { - if (e) { - if (e[0] == "stat") { - ret = best_of(ret, [ "stat", make_conditional(c, t[1], e[1]) ]); - } - } - else { - ret = best_of(ret, [ "stat", make_conditional(c, t[1]) ]); - } - } - else if (e && t[0] == e[0] && (t[0] == "return" || t[0] == "throw") && t[1] && e[1]) { - ret = best_of(ret, [ t[0], make_conditional(c, t[1], e[1] ) ]); - } - else if (e && aborts(t)) { - ret = [ [ "if", c, t ] ]; - if (e[0] == "block") { - if (e[1]) ret = ret.concat(e[1]); - } - else { - ret.push(e); - } - ret = walk([ "block", ret ]); - } - else if (t && aborts(e)) { - ret = [ [ "if", negate(c), e ] ]; - if (t[0] == "block") { - if (t[1]) ret = ret.concat(t[1]); - } else { - ret.push(t); - } - ret = walk([ "block", ret ]); - } - return ret; - }; - - function _do_while(cond, body) { - return when_constant(cond, function(cond, val){ - if (!val) { - warn_unreachable(body); - return [ "block" ]; - } else { - return [ "for", null, null, null, walk(body) ]; - } - }); - }; - - return w.with_walkers({ - "sub": function(expr, subscript) { - if (subscript[0] == "string") { - var name = subscript[1]; - if (is_identifier(name)) - return [ "dot", walk(expr), name ]; - else if (/^[1-9][0-9]*$/.test(name) || name === "0") - return [ "sub", walk(expr), [ "num", parseInt(name, 10) ] ]; - } - }, - "if": make_if, - "toplevel": function(body) { - return [ "toplevel", with_scope(this.scope, function(){ - return tighten(MAP(body, walk)); - }) ]; - }, - "switch": function(expr, body) { - var last = body.length - 1; - return [ "switch", walk(expr), MAP(body, function(branch, i){ - var block = tighten(MAP(branch[1], walk)); - if (i == last && block.length > 0) { - var node = block[block.length - 1]; - if (node[0] == "break" && !node[1]) - block.pop(); - } - return [ branch[0] ? walk(branch[0]) : null, block ]; - }) ]; - }, - "function": _lambda, - "defun": _lambda, - "block": function(body) { - if (body) return rmblock([ "block", tighten(MAP(body, walk)) ]); - }, - "binary": function(op, left, right) { - return when_constant([ "binary", op, walk(left), walk(right) ], function yes(c){ - return best_of(walk(c), this); - }, function no() { - return this; - }); - }, - "conditional": function(c, t, e) { - return make_conditional(walk(c), walk(t), walk(e)); - }, - "try": function(t, c, f) { - return [ - "try", - tighten(MAP(t, walk)), - c != null ? [ c[0], tighten(MAP(c[1], walk)) ] : null, - f != null ? tighten(MAP(f, walk)) : null - ]; - }, - "unary-prefix": function(op, expr) { - expr = walk(expr); - var ret = [ "unary-prefix", op, expr ]; - if (op == "!") - ret = best_of(ret, negate(expr)); - return when_constant(ret, function(ast, val){ - return walk(ast); // it's either true or false, so minifies to !0 or !1 - }, function() { return ret }); - }, - "name": function(name) { - switch (name) { - case "true": return [ "unary-prefix", "!", [ "num", 0 ]]; - case "false": return [ "unary-prefix", "!", [ "num", 1 ]]; - } - }, - "new": function(ctor, args) { - if (ctor[0] == "name" && ctor[1] == "Array" && !scope.has("Array")) { - if (args.length != 1) { - return [ "array", args ]; - } else { - return [ "call", [ "name", "Array" ], args ]; - } - } - }, - "call": function(expr, args) { - if (expr[0] == "name" && expr[1] == "Array" && args.length != 1 && !scope.has("Array")) { - return [ "array", args ]; - } - }, - "while": _do_while, - "do": _do_while - }, function() { - return walk(ast_add_scope(ast)); - }); -}; - -/* -----[ re-generate code from the AST ]----- */ - -var DOT_CALL_NO_PARENS = jsp.array_to_hash([ - "name", - "array", - "object", - "string", - "dot", - "sub", - "call", - "regexp" -]); - -function make_string(str, ascii_only) { - var dq = 0, sq = 0; - str = str.replace(/[\\\b\f\n\r\t\x22\x27\u2028\u2029]/g, function(s){ - switch (s) { - case "\\": return "\\\\"; - case "\b": return "\\b"; - case "\f": return "\\f"; - case "\n": return "\\n"; - case "\r": return "\\r"; - case "\t": return "\\t"; - case "\u2028": return "\\u2028"; - case "\u2029": return "\\u2029"; - case '"': ++dq; return '"'; - case "'": ++sq; return "'"; - } - return s; - }); - if (ascii_only) str = to_ascii(str); - if (dq > sq) return "'" + str.replace(/\x27/g, "\\'") + "'"; - else return '"' + str.replace(/\x22/g, '\\"') + '"'; -}; - -function to_ascii(str) { - return str.replace(/[\u0080-\uffff]/g, function(ch) { - var code = ch.charCodeAt(0).toString(16); - while (code.length < 4) code = "0" + code; - return "\\u" + code; - }); -}; - -var SPLICE_NEEDS_BRACKETS = jsp.array_to_hash([ "if", "while", "do", "for", "for-in", "with" ]); - -function gen_code(ast, options) { - options = defaults(options, { - indent_start : 0, - indent_level : 4, - quote_keys : false, - space_colon : false, - beautify : false, - ascii_only : false - }); - var beautify = !!options.beautify; - var indentation = 0, - newline = beautify ? "\n" : "", - space = beautify ? " " : ""; - - function encode_string(str) { - return make_string(str, options.ascii_only); - }; - - function make_name(name) { - name = name.toString(); - if (options.ascii_only) - name = to_ascii(name); - return name; - }; - - function indent(line) { - if (line == null) - line = ""; - if (beautify) - line = repeat_string(" ", options.indent_start + indentation * options.indent_level) + line; - return line; - }; - - function with_indent(cont, incr) { - if (incr == null) incr = 1; - indentation += incr; - try { return cont.apply(null, slice(arguments, 1)); } - finally { indentation -= incr; } - }; - - function add_spaces(a) { - if (beautify) - return a.join(" "); - var b = []; - for (var i = 0; i < a.length; ++i) { - var next = a[i + 1]; - b.push(a[i]); - if (next && - ((/[a-z0-9_\x24]$/i.test(a[i].toString()) && /^[a-z0-9_\x24]/i.test(next.toString())) || - (/[\+\-]$/.test(a[i].toString()) && /^[\+\-]/.test(next.toString())))) { - b.push(" "); - } - } - return b.join(""); - }; - - function add_commas(a) { - return a.join("," + space); - }; - - function parenthesize(expr) { - var gen = make(expr); - for (var i = 1; i < arguments.length; ++i) { - var el = arguments[i]; - if ((el instanceof Function && el(expr)) || expr[0] == el) - return "(" + gen + ")"; - } - return gen; - }; - - function best_of(a) { - if (a.length == 1) { - return a[0]; - } - if (a.length == 2) { - var b = a[1]; - a = a[0]; - return a.length <= b.length ? a : b; - } - return best_of([ a[0], best_of(a.slice(1)) ]); - }; - - function needs_parens(expr) { - if (expr[0] == "function" || expr[0] == "object") { - // dot/call on a literal function requires the - // function literal itself to be parenthesized - // only if it's the first "thing" in a - // statement. This means that the parent is - // "stat", but it could also be a "seq" and - // we're the first in this "seq" and the - // parent is "stat", and so on. Messy stuff, - // but it worths the trouble. - var a = slice($stack), self = a.pop(), p = a.pop(); - while (p) { - if (p[0] == "stat") return true; - if (((p[0] == "seq" || p[0] == "call" || p[0] == "dot" || p[0] == "sub" || p[0] == "conditional") && p[1] === self) || - ((p[0] == "binary" || p[0] == "assign" || p[0] == "unary-postfix") && p[2] === self)) { - self = p; - p = a.pop(); - } else { - return false; - } - } - } - return !HOP(DOT_CALL_NO_PARENS, expr[0]); - }; - - function make_num(num) { - var str = num.toString(10), a = [ str.replace(/^0\./, ".") ], m; - if (Math.floor(num) === num) { - a.push("0x" + num.toString(16).toLowerCase(), // probably pointless - "0" + num.toString(8)); // same. - if ((m = /^(.*?)(0+)$/.exec(num))) { - a.push(m[1] + "e" + m[2].length); - } - } else if ((m = /^0?\.(0+)(.*)$/.exec(num))) { - a.push(m[2] + "e-" + (m[1].length + m[2].length), - str.substr(str.indexOf("."))); - } - return best_of(a); - }; - - var generators = { - "string": encode_string, - "num": make_num, - "name": make_name, - "toplevel": function(statements) { - return make_block_statements(statements) - .join(newline + newline); - }, - "splice": function(statements) { - var parent = $stack[$stack.length - 2][0]; - if (HOP(SPLICE_NEEDS_BRACKETS, parent)) { - // we need block brackets in this case - return make_block.apply(this, arguments); - } else { - return MAP(make_block_statements(statements, true), - function(line, i) { - // the first line is already indented - return i > 0 ? indent(line) : line; - }).join(newline); - } - }, - "block": make_block, - "var": function(defs) { - return "var " + add_commas(MAP(defs, make_1vardef)) + ";"; - }, - "const": function(defs) { - return "const " + add_commas(MAP(defs, make_1vardef)) + ";"; - }, - "try": function(tr, ca, fi) { - var out = [ "try", make_block(tr) ]; - if (ca) out.push("catch", "(" + ca[0] + ")", make_block(ca[1])); - if (fi) out.push("finally", make_block(fi)); - return add_spaces(out); - }, - "throw": function(expr) { - return add_spaces([ "throw", make(expr) ]) + ";"; - }, - "new": function(ctor, args) { - args = args.length > 0 ? "(" + add_commas(MAP(args, make)) + ")" : ""; - return add_spaces([ "new", parenthesize(ctor, "seq", "binary", "conditional", "assign", function(expr){ - var w = ast_walker(), has_call = {}; - try { - w.with_walkers({ - "call": function() { throw has_call }, - "function": function() { return this } - }, function(){ - w.walk(expr); - }); - } catch(ex) { - if (ex === has_call) - return true; - throw ex; - } - }) + args ]); - }, - "switch": function(expr, body) { - return add_spaces([ "switch", "(" + make(expr) + ")", make_switch_block(body) ]); - }, - "break": function(label) { - var out = "break"; - if (label != null) - out += " " + make_name(label); - return out + ";"; - }, - "continue": function(label) { - var out = "continue"; - if (label != null) - out += " " + make_name(label); - return out + ";"; - }, - "conditional": function(co, th, el) { - return add_spaces([ parenthesize(co, "assign", "seq", "conditional"), "?", - parenthesize(th, "seq"), ":", - parenthesize(el, "seq") ]); - }, - "assign": function(op, lvalue, rvalue) { - if (op && op !== true) op += "="; - else op = "="; - return add_spaces([ make(lvalue), op, parenthesize(rvalue, "seq") ]); - }, - "dot": function(expr) { - var out = make(expr), i = 1; - if (expr[0] == "num") { - if (!/\./.test(expr[1])) - out += "."; - } else if (needs_parens(expr)) - out = "(" + out + ")"; - while (i < arguments.length) - out += "." + make_name(arguments[i++]); - return out; - }, - "call": function(func, args) { - var f = make(func); - if (needs_parens(func)) - f = "(" + f + ")"; - return f + "(" + add_commas(MAP(args, function(expr){ - return parenthesize(expr, "seq"); - })) + ")"; - }, - "function": make_function, - "defun": make_function, - "if": function(co, th, el) { - var out = [ "if", "(" + make(co) + ")", el ? make_then(th) : make(th) ]; - if (el) { - out.push("else", make(el)); - } - return add_spaces(out); - }, - "for": function(init, cond, step, block) { - var out = [ "for" ]; - init = (init != null ? make(init) : "").replace(/;*\s*$/, ";" + space); - cond = (cond != null ? make(cond) : "").replace(/;*\s*$/, ";" + space); - step = (step != null ? make(step) : "").replace(/;*\s*$/, ""); - var args = init + cond + step; - if (args == "; ; ") args = ";;"; - out.push("(" + args + ")", make(block)); - return add_spaces(out); - }, - "for-in": function(vvar, key, hash, block) { - return add_spaces([ "for", "(" + - (vvar ? make(vvar).replace(/;+$/, "") : make(key)), - "in", - make(hash) + ")", make(block) ]); - }, - "while": function(condition, block) { - return add_spaces([ "while", "(" + make(condition) + ")", make(block) ]); - }, - "do": function(condition, block) { - return add_spaces([ "do", make(block), "while", "(" + make(condition) + ")" ]) + ";"; - }, - "return": function(expr) { - var out = [ "return" ]; - if (expr != null) out.push(make(expr)); - return add_spaces(out) + ";"; - }, - "binary": function(operator, lvalue, rvalue) { - var left = make(lvalue), right = make(rvalue); - // XXX: I'm pretty sure other cases will bite here. - // we need to be smarter. - // adding parens all the time is the safest bet. - if (member(lvalue[0], [ "assign", "conditional", "seq" ]) || - lvalue[0] == "binary" && PRECEDENCE[operator] > PRECEDENCE[lvalue[1]]) { - left = "(" + left + ")"; - } - if (member(rvalue[0], [ "assign", "conditional", "seq" ]) || - rvalue[0] == "binary" && PRECEDENCE[operator] >= PRECEDENCE[rvalue[1]] && - !(rvalue[1] == operator && member(operator, [ "&&", "||", "*" ]))) { - right = "(" + right + ")"; - } - return add_spaces([ left, operator, right ]); - }, - "unary-prefix": function(operator, expr) { - var val = make(expr); - if (!(expr[0] == "num" || (expr[0] == "unary-prefix" && !HOP(OPERATORS, operator + expr[1])) || !needs_parens(expr))) - val = "(" + val + ")"; - return operator + (jsp.is_alphanumeric_char(operator.charAt(0)) ? " " : "") + val; - }, - "unary-postfix": function(operator, expr) { - var val = make(expr); - if (!(expr[0] == "num" || (expr[0] == "unary-postfix" && !HOP(OPERATORS, operator + expr[1])) || !needs_parens(expr))) - val = "(" + val + ")"; - return val + operator; - }, - "sub": function(expr, subscript) { - var hash = make(expr); - if (needs_parens(expr)) - hash = "(" + hash + ")"; - return hash + "[" + make(subscript) + "]"; - }, - "object": function(props) { - if (props.length == 0) - return "{}"; - return "{" + newline + with_indent(function(){ - return MAP(props, function(p){ - if (p.length == 3) { - // getter/setter. The name is in p[0], the arg.list in p[1][2], the - // body in p[1][3] and type ("get" / "set") in p[2]. - return indent(make_function(p[0], p[1][2], p[1][3], p[2])); - } - var key = p[0], val = make(p[1]); - if (options.quote_keys) { - key = encode_string(key); - } else if ((typeof key == "number" || !beautify && +key + "" == key) - && parseFloat(key) >= 0) { - key = make_num(+key); - } else if (!is_identifier(key)) { - key = encode_string(key); - } - return indent(add_spaces(beautify && options.space_colon - ? [ key, ":", val ] - : [ key + ":", val ])); - }).join("," + newline); - }) + newline + indent("}"); - }, - "regexp": function(rx, mods) { - return "/" + rx + "/" + mods; - }, - "array": function(elements) { - if (elements.length == 0) return "[]"; - return add_spaces([ "[", add_commas(MAP(elements, function(el){ - if (!beautify && el[0] == "atom" && el[1] == "undefined") return ""; - return parenthesize(el, "seq"); - })), "]" ]); - }, - "stat": function(stmt) { - return make(stmt).replace(/;*\s*$/, ";"); - }, - "seq": function() { - return add_commas(MAP(slice(arguments), make)); - }, - "label": function(name, block) { - return add_spaces([ make_name(name), ":", make(block) ]); - }, - "with": function(expr, block) { - return add_spaces([ "with", "(" + make(expr) + ")", make(block) ]); - }, - "atom": function(name) { - return make_name(name); - } - }; - - // The squeezer replaces "block"-s that contain only a single - // statement with the statement itself; technically, the AST - // is correct, but this can create problems when we output an - // IF having an ELSE clause where the THEN clause ends in an - // IF *without* an ELSE block (then the outer ELSE would refer - // to the inner IF). This function checks for this case and - // adds the block brackets if needed. - function make_then(th) { - if (th[0] == "do") { - // https://github.com/mishoo/UglifyJS/issues/#issue/57 - // IE croaks with "syntax error" on code like this: - // if (foo) do ... while(cond); else ... - // we need block brackets around do/while - return make([ "block", [ th ]]); - } - var b = th; - while (true) { - var type = b[0]; - if (type == "if") { - if (!b[3]) - // no else, we must add the block - return make([ "block", [ th ]]); - b = b[3]; - } - else if (type == "while" || type == "do") b = b[2]; - else if (type == "for" || type == "for-in") b = b[4]; - else break; - } - return make(th); - }; - - function make_function(name, args, body, keyword) { - var out = keyword || "function"; - if (name) { - out += " " + make_name(name); - } - out += "(" + add_commas(MAP(args, make_name)) + ")"; - return add_spaces([ out, make_block(body) ]); - }; - - function make_block_statements(statements, noindent) { - for (var a = [], last = statements.length - 1, i = 0; i <= last; ++i) { - var stat = statements[i]; - var code = make(stat); - if (code != ";") { - if (!beautify && i == last) { - if ((stat[0] == "while" && empty(stat[2])) || - (member(stat[0], [ "for", "for-in"] ) && empty(stat[4])) || - (stat[0] == "if" && empty(stat[2]) && !stat[3]) || - (stat[0] == "if" && stat[3] && empty(stat[3]))) { - code = code.replace(/;*\s*$/, ";"); - } else { - code = code.replace(/;+\s*$/, ""); - } - } - a.push(code); - } - } - return noindent ? a : MAP(a, indent); - }; - - function make_switch_block(body) { - var n = body.length; - if (n == 0) return "{}"; - return "{" + newline + MAP(body, function(branch, i){ - var has_body = branch[1].length > 0, code = with_indent(function(){ - return indent(branch[0] - ? add_spaces([ "case", make(branch[0]) + ":" ]) - : "default:"); - }, 0.5) + (has_body ? newline + with_indent(function(){ - return make_block_statements(branch[1]).join(newline); - }) : ""); - if (!beautify && has_body && i < n - 1) - code += ";"; - return code; - }).join(newline) + newline + indent("}"); - }; - - function make_block(statements) { - if (!statements) return ";"; - if (statements.length == 0) return "{}"; - return "{" + newline + with_indent(function(){ - return make_block_statements(statements).join(newline); - }) + newline + indent("}"); - }; - - function make_1vardef(def) { - var name = def[0], val = def[1]; - if (val != null) - name = add_spaces([ make_name(name), "=", parenthesize(val, "seq") ]); - return name; - }; - - var $stack = []; - - function make(node) { - var type = node[0]; - var gen = generators[type]; - if (!gen) - throw new Error("Can't find generator for \"" + type + "\""); - $stack.push(node); - var ret = gen.apply(type, node.slice(1)); - $stack.pop(); - return ret; - }; - - return make(ast); -}; - -function split_lines(code, max_line_length) { - var splits = [ 0 ]; - jsp.parse(function(){ - var next_token = jsp.tokenizer(code); - var last_split = 0; - var prev_token; - function current_length(tok) { - return tok.pos - last_split; - }; - function split_here(tok) { - last_split = tok.pos; - splits.push(last_split); - }; - function custom(){ - var tok = next_token.apply(this, arguments); - out: { - if (prev_token) { - if (prev_token.type == "keyword") break out; - } - if (current_length(tok) > max_line_length) { - switch (tok.type) { - case "keyword": - case "atom": - case "name": - case "punc": - split_here(tok); - break out; - } - } - } - prev_token = tok; - return tok; - }; - custom.context = function() { - return next_token.context.apply(this, arguments); - }; - return custom; - }()); - return splits.map(function(pos, i){ - return code.substring(pos, splits[i + 1] || code.length); - }).join("\n"); -}; - -/* -----[ Utilities ]----- */ - -function repeat_string(str, i) { - if (i <= 0) return ""; - if (i == 1) return str; - var d = repeat_string(str, i >> 1); - d += d; - if (i & 1) d += str; - return d; -}; - -function defaults(args, defs) { - var ret = {}; - if (args === true) - args = {}; - for (var i in defs) if (HOP(defs, i)) { - ret[i] = (args && HOP(args, i)) ? args[i] : defs[i]; - } - return ret; -}; - -function is_identifier(name) { - return /^[a-z_$][a-z0-9_$]*$/i.test(name) - && name != "this" - && !HOP(jsp.KEYWORDS_ATOM, name) - && !HOP(jsp.RESERVED_WORDS, name) - && !HOP(jsp.KEYWORDS, name); -}; - -function HOP(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -}; - -// some utilities - -var MAP; - -(function(){ - MAP = function(a, f, o) { - var ret = []; - for (var i = 0; i < a.length; ++i) { - var val = f.call(o, a[i], i); - if (val instanceof AtTop) ret.unshift(val.v); - else ret.push(val); - } - return ret; - }; - MAP.at_top = function(val) { return new AtTop(val) }; - function AtTop(val) { this.v = val }; -})(); - -/* -----[ Exports ]----- */ - -exports.ast_walker = ast_walker; -exports.ast_mangle = ast_mangle; -exports.ast_squeeze = ast_squeeze; -exports.gen_code = gen_code; -exports.ast_add_scope = ast_add_scope; -exports.set_logger = function(logger) { warn = logger }; -exports.make_string = make_string; -exports.split_lines = split_lines; -exports.MAP = MAP; - -// keep this last! -exports.ast_squeeze_more = require("./squeeze-more").ast_squeeze_more; diff --git a/bower_components/jquery/build/lib/squeeze-more.js b/bower_components/jquery/build/lib/squeeze-more.js deleted file mode 100644 index 12380af8..00000000 --- a/bower_components/jquery/build/lib/squeeze-more.js +++ /dev/null @@ -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; diff --git a/bower_components/jquery/build/post-compile.js b/bower_components/jquery/build/post-compile.js deleted file mode 100644 index afcebf27..00000000 --- a/bower_components/jquery/build/post-compile.js +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env node - -var print = require( "sys" ).print, - fs = require( "fs" ), - src = fs.readFileSync( process.argv[2], "utf8" ), - version = fs.readFileSync( "version.txt", "utf8" ), - // License Template - license = "/*! jQuery v@VERSION jquery.com | jquery.org/license */"; - - -// Previously done in sed but reimplemented here due to portability issues -src = src.replace( /^(\s*\*\/)(.+)/m, "$1\n$2" ) + ";"; - -// Set minimal license block var -license = license.replace( "@VERSION", version ); - -// Replace license block with minimal license -src = src.replace( /\/\/.*?\/?\*.+?(?=\n|\r|$)|\/\*[\s\S]*?\/\/[\s\S]*?\*\//, license ); - -print( src ); diff --git a/bower_components/jquery/build/release-notes.js b/bower_components/jquery/build/release-notes.js deleted file mode 100644 index cd5f473e..00000000 --- a/bower_components/jquery/build/release-notes.js +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env node -/* - * jQuery Release Note Generator - */ - -var fs = require("fs"), - http = require("http"), - tmpl = require("mustache"), - extract = /(.*?)<[^"]+"component">\s*(\S+)/g; - -var opts = { - version: "1.7", - short_version: "1.7", - final_version: "1.7", - 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 ) ); -} diff --git a/bower_components/jquery/build/release-notes.txt b/bower_components/jquery/build/release-notes.txt deleted file mode 100644 index 1d0ae746..00000000 --- a/bower_components/jquery/build/release-notes.txt +++ /dev/null @@ -1,27 +0,0 @@ -

jQuery {{version}} Released

- -

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.

- -

You can get the code from the jQuery CDN:

- -
- -

You can help us by dropping that code into your existing application and letting us know that if anything no longer works. Please file a bug and be sure to mention that you're testing against jQuery {{version}}.

- -

We want to encourage everyone from the community to try and get involved in contributing back to jQuery core. We've set up a full page of information dedicated towards becoming more involved with the team. The team is here and ready to help you help us!

- -

jQuery {{version}} Change Log

- -

The current change log of the {{version}} release.

- -{{#categories}} -

{{niceName}}

- - -{{/categories}} diff --git a/bower_components/jquery/build/release.js b/bower_components/jquery/build/release.js deleted file mode 100644 index 7a42f998..00000000 --- a/bower_components/jquery/build/release.js +++ /dev/null @@ -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 ); -} diff --git a/bower_components/jquery/build/sizer.js b/bower_components/jquery/build/sizer.js deleted file mode 100644 index 2372b5fd..00000000 --- a/bower_components/jquery/build/sizer.js +++ /dev/null @@ -1,36 +0,0 @@ -var fs = require( "fs" ), - stdin = process.openStdin(), - rsize = /(\d+).*?(jquery\S+)/g, - oldsizes = {}, - sizes = {}; - -try { - oldsizes = JSON.parse( fs.readFileSync( __dirname + "/.sizecache.json", "utf8" ) ); -} catch(e) { - oldsizes = {}; -}; - -stdin.on( "data" , function( chunk ) { - var match; - - while ( match = rsize.exec( chunk ) ) { - sizes[ match[2] ] = parseInt( match[1], 10 ); - } -}); - -function lpad( str, len, chr ) { - return ( Array(len+1).join( chr || " ") + str ).substr( -len ); -} - -stdin.on( "end", function() { - console.log( "jQuery Size - compared to last make" ); - fs.writeFileSync( __dirname + "/.sizecache.json", JSON.stringify( sizes, true ), "utf8" ); - for ( var key in sizes ) { - var diff = oldsizes[ key ] && ( sizes[ key ] - oldsizes[ key ] ); - if ( diff > 0 ) { - diff = "+" + diff; - } - console.log( "%s %s %s", lpad( sizes[ key ], 8 ), lpad( diff ? "(" + diff + ")" : "(-)", 8 ), key ); - } - process.exit(); -}); \ No newline at end of file diff --git a/bower_components/jquery/build/uglify.js b/bower_components/jquery/build/uglify.js deleted file mode 100644 index aad18e8c..00000000 --- a/bower_components/jquery/build/uglify.js +++ /dev/null @@ -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."); } -}; diff --git a/bower_components/jquery/component.json b/bower_components/jquery/component.json deleted file mode 100755 index 7e31b285..00000000 --- a/bower_components/jquery/component.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name" : "jquery", - "version" : "1.7.0", - "main" : "./jquery.js", - "dependencies": { - } -} - diff --git a/bower_components/jquery/dist/jquery.js b/bower_components/jquery/dist/jquery.js new file mode 100644 index 00000000..6feb1108 --- /dev/null +++ b/bower_components/jquery/dist/jquery.js @@ -0,0 +1,10351 @@ +/*! + * jQuery JavaScript Library v1.11.3 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2015-04-28T16:19Z + */ + +(function( global, factory ) { + + if ( typeof module === "object" && typeof module.exports === "object" ) { + // For CommonJS and CommonJS-like environments where a proper window is present, + // execute the factory and get jQuery + // For environments that do not inherently posses a window with a document + // (such as Node.js), expose a jQuery-making factory as module.exports + // This accentuates the need for the creation of a real window + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Can't do this because several apps including ASP.NET trace +// the stack via arguments.caller.callee and Firefox dies if +// you try to trace through "use strict" call chains. (#13335) +// Support: Firefox 18+ +// + +var deletedIds = []; + +var slice = deletedIds.slice; + +var concat = deletedIds.concat; + +var push = deletedIds.push; + +var indexOf = deletedIds.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var support = {}; + + + +var + version = "1.11.3", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android<4.1, IE<9 + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // Start with an empty selector + selector: "", + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num != null ? + + // Return just the one element from the set + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + + // Return all the elements in a clean array + slice.call( this ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: deletedIds.sort, + splice: deletedIds.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var src, copyIsArray, copy, name, options, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + /* jshint eqeqeq: false */ + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + // parseFloat NaNs numeric-cast false positives (null|true|false|"") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + // adding 1 corrects loss of precision from parseFloat (#15100) + return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + isPlainObject: function( obj ) { + var key; + + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Support: IE<9 + // Handle iteration over inherited properties before own properties. + if ( support.ownLast ) { + for ( key in obj ) { + return hasOwn.call( obj, key ); + } + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + for ( key in obj ) {} + + return key === undefined || hasOwn.call( obj, key ); + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call(obj) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && jQuery.trim( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value, + i = 0, + length = obj.length, + isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Support: Android<4.1, IE<9 + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( indexOf ) { + return indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + while ( j < len ) { + first[ i++ ] = second[ j++ ]; + } + + // Support: IE<9 + // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) + if ( len !== len ) { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, + i = 0, + length = elems.length, + isArray = isArraylike( elems ), + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var args, proxy, tmp; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: function() { + return +( new Date() ); + }, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +}); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + + // Support: iOS 8.2 (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = "length" in obj && obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.2.0-pre + * http://sizzlejs.com/ + * + * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2014-12-16 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // General-purpose constants + MAX_NEGATIVE = 1 << 31, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf as it's faster than native + // http://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + characterEncoding + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + rescape = /'|\\/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }; + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + nodeType = context.nodeType; + + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + if ( !seed && documentIsHTML ) { + + // Try to shortcut find operations when possible (e.g., not under DocumentFragment) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document (jQuery #6963) + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getElementsByClassName ) { + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // QSA path + if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + nid = old = expando; + newContext = context; + newSelector = nodeType !== 1 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return !!fn( div ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( div.parentNode ) { + div.parentNode.removeChild( div ); + } + // release memory in IE + div = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = attrs.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + ( ~b.sourceIndex || MAX_NEGATIVE ) - + ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== "undefined" && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, parent, + doc = node ? node.ownerDocument || node : preferredDoc; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + parent = doc.defaultView; + + // Support: IE>8 + // If iframe document is assigned to "document" variable and if iframe has been reloaded, + // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 + // IE6-8 do not support the defaultView property so parent will be undefined + if ( parent && parent !== parent.top ) { + // IE11 does not have attachEvent, so all must suffer + if ( parent.addEventListener ) { + parent.addEventListener( "unload", unloadHandler, false ); + } else if ( parent.attachEvent ) { + parent.attachEvent( "onunload", unloadHandler ); + } + } + + /* Support tests + ---------------------------------------------------------------------- */ + documentIsHTML = !isXML( doc ); + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties + // (excepting IE8 booleans) + support.attributes = assert(function( div ) { + div.className = "i"; + return !div.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Support: IE<9 + support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( div ) { + docElem.appendChild( div ).id = expando; + return !doc.getElementsByName || !doc.getElementsByName( expando ).length; + }); + + // ID find and filter + if ( support.getById ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [ m ] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find["ID"]; + + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( tag ); + + // DocumentFragment nodes don't have gEBTN + } else if ( support.qsa ) { + return context.querySelectorAll( tag ); + } + } : + + function( tag, context ) { + var elem, + tmp = [], + i = 0, + // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See http://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + docElem.appendChild( div ).innerHTML = "" + + ""; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( div.querySelectorAll("[msallowcapture^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ + if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push("~="); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + + // Support: Safari 8+, iOS 8+ + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibing-combinator selector` fails + if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push(".#.+[+~]"); + } + }); + + assert(function( div ) { + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = doc.createElement("input"); + input.setAttribute( "type", "hidden" ); + div.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( div.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return doc; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch (e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[6] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + // Don't keep the element (issue #299) + input[0] = null; + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (oldCache = outerCache[ dir ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + outerCache[ dir ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + // Avoid hanging onto element (issue #299) + checkContext = null; + return ret; + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context !== document && context; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; + + // Try to minimize operations if there is no seed and only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome 14-35+ +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( div1 ) { + // Should return 1, but returns 4 (following) + return div1.compareDocumentPosition( document.createElement("div") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( div ) { + div.innerHTML = ""; + return div.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( div ) { + div.innerHTML = ""; + div.firstChild.setAttribute( "value", "" ); + return div.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( div ) { + return div.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +return Sizzle; + +})( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + + +var rneedsContext = jQuery.expr.match.needsContext; + +var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); + + + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + /* jshint -W018 */ + return !!qualifier.call( elem, i, elem ) !== not; + }); + + } + + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + }); + + } + + if ( typeof qualifier === "string" ) { + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + qualifier = jQuery.filter( qualifier, elements ); + } + + return jQuery.grep( elements, function( elem ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; + }); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + })); +}; + +jQuery.fn.extend({ + find: function( selector ) { + var i, + ret = [], + self = this, + len = self.length; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + " " + selector : selector; + return ret; + }, + filter: function( selector ) { + return this.pushStack( winnow(this, selector || [], false) ); + }, + not: function( selector ) { + return this.pushStack( winnow(this, selector || [], true) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +}); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + init = jQuery.fn.init = function( selector, context ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return typeof rootjQuery.ready !== "undefined" ? + rootjQuery.ready( selector ) : + // Execute immediately if ready is not present + selector( jQuery ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.extend({ + 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; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +jQuery.fn.extend({ + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { + // Always skip document fragments + if ( cur.nodeType < 11 && (pos ? + pos.index(cur) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector(cur, selectors)) ) { + + matched.push( cur ); + break; + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // 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 ) { + return this.pushStack( + jQuery.unique( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +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 sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "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.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + if ( this.length > 1 ) { + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + ret = jQuery.unique( ret ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + } + + return this.pushStack( ret ); + }; +}); +var rnotwhite = (/\S+/g); + + + +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // First callback to fire (used internally by add and fireWith) + firingStart, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); + }, + // Remove all callbacks from the list + empty: function() { + list = []; + firingLength = 0; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( list && ( !fired || stack ) ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( values === progressValues ) { + deferred.notifyWith( contexts, values ); + + } else if ( !(--remaining) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); + + +// The deferred used on DOM ready +var readyList; + +jQuery.fn.ready = function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; +}; + +jQuery.extend({ + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.triggerHandler ) { + jQuery( document ).triggerHandler( "ready" ); + jQuery( document ).off( "ready" ); + } + } +}); + +/** + * Clean-up method for dom ready events + */ +function detach() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", completed, false ); + window.removeEventListener( "load", completed, false ); + + } else { + document.detachEvent( "onreadystatechange", completed ); + window.detachEvent( "onload", completed ); + } +} + +/** + * The ready event handler and self cleanup method + */ +function completed() { + // readyState === "complete" is good enough for us to call the dom ready in oldIE + if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { + detach(); + jQuery.ready(); + } +} + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", completed ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", completed ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // detach all dom ready events + detach(); + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + + +var strundefined = typeof undefined; + + + +// Support: IE<9 +// Iteration over object's inherited properties before its own +var i; +for ( i in jQuery( support ) ) { + break; +} +support.ownLast = i !== "0"; + +// Note: most support tests are defined in their respective modules. +// false until the test is run +support.inlineBlockNeedsLayout = false; + +// Execute ASAP in case we need to set body.style.zoom +jQuery(function() { + // Minified: var a,b,c,d + var val, div, body, container; + + body = document.getElementsByTagName( "body" )[ 0 ]; + if ( !body || !body.style ) { + // Return for frameset docs that don't have a body + return; + } + + // Setup + div = document.createElement( "div" ); + container = document.createElement( "div" ); + container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; + body.appendChild( container ).appendChild( div ); + + if ( typeof div.style.zoom !== strundefined ) { + // Support: IE<8 + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; + + support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; + if ( val ) { + // Prevent IE 6 from affecting layout for positioned elements #11048 + // Prevent IE from shrinking the body in IE 7 mode #12869 + // Support: IE<8 + body.style.zoom = 1; + } + } + + body.removeChild( container ); +}); + + + + +(function() { + var div = document.createElement( "div" ); + + // Execute the test only if not already executed in another module. + if (support.deleteExpando == null) { + // Support: IE<9 + support.deleteExpando = true; + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + } + + // Null elements to avoid leaks in IE. + div = null; +})(); + + +/** + * Determines whether an object can have data + */ +jQuery.acceptData = function( elem ) { + var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], + nodeType = +elem.nodeType || 1; + + // Do not set data on non-element DOM nodes because it will not be cleared (#8335). + return nodeType !== 1 && nodeType !== 9 ? + false : + + // Nodes accept data unless otherwise specified; rejection can be conditional + !noData || noData !== true && elem.getAttribute("classid") === noData; +}; + + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /([A-Z])/g; + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} + +function internalData( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var ret, thisCache, + internalKey = jQuery.expando, + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { + 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 ) { + id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + // Avoid exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( typeof name === "string" ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; +} + +function internalRemoveData( elem, name, pvt ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + 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 ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } else { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = name.concat( jQuery.map( name, jQuery.camelCase ) ); + } + + i = name.length; + while ( i-- ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + /* jshint eqeqeq: false */ + } else if ( support.deleteExpando || cache != cache.window ) { + /* jshint eqeqeq: true */ + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } +} + +jQuery.extend({ + cache: {}, + + // The following elements (space-suffixed to avoid Object.prototype collisions) + // throw uncatchable exceptions if you attempt to set expando properties + noData: { + "applet ": true, + "embed ": true, + // ...but Flash objects (which have this classid) *can* handle expandos + "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data ) { + return internalData( elem, name, data ); + }, + + removeData: function( elem, name ) { + return internalRemoveData( elem, name ); + }, + + // For internal use only. + _data: function( elem, name, data ) { + return internalData( elem, name, data, true ); + }, + + _removeData: function( elem, name ) { + return internalRemoveData( elem, name, true ); + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var i, name, data, + elem = this[0], + attrs = elem && elem.attributes; + + // Special expections of .data basically thwart jQuery.access, + // so implement the relevant behavior ourselves + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE11+ + // The attrs elements can be null (#14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.slice(5) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + return arguments.length > 1 ? + + // Sets one value + this.each(function() { + jQuery.data( this, key, value ); + }) : + + // Gets one value + // Try to fetch any internally stored data first + elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + + +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery._removeData( elem, type + "queue" ); + jQuery._removeData( elem, key ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + 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, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var isHidden = function( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); + }; + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + length = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < length; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; +}; +var rcheckableType = (/^(?:checkbox|radio)$/i); + + + +(function() { + // Minified: var a,b,c + var input = document.createElement( "input" ), + div = document.createElement( "div" ), + fragment = document.createDocumentFragment(); + + // Setup + div.innerHTML = "
a"; + + // IE strips leading whitespace when .innerHTML is used + support.leadingWhitespace = div.firstChild.nodeType === 3; + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + support.tbody = !div.getElementsByTagName( "tbody" ).length; + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + support.html5Clone = + document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav>"; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + input.type = "checkbox"; + input.checked = true; + fragment.appendChild( input ); + support.appendChecked = input.checked; + + // Make sure textarea (and checkbox) defaultValue is properly cloned + // Support: IE6-IE11+ + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; + + // #11217 - WebKit loses check when the name is after the checked attribute + fragment.appendChild( div ); + div.innerHTML = ""; + + // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 + // old WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + support.noCloneEvent = true; + if ( div.attachEvent ) { + div.attachEvent( "onclick", function() { + support.noCloneEvent = false; + }); + + div.cloneNode( true ).click(); + } + + // Execute the test only if not already executed in another module. + if (support.deleteExpando == null) { + // Support: IE<9 + support.deleteExpando = true; + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + } +})(); + + +(function() { + var i, eventName, + div = document.createElement( "div" ); + + // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) + for ( i in { submit: true, change: true, focusin: true }) { + eventName = "on" + i; + + if ( !(support[ i + "Bubbles" ] = eventName in window) ) { + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) + div.setAttribute( eventName, "t" ); + support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; + } + } + + // Null elements to avoid leaks in IE. + div = null; +})(); + + +var rformElems = /^(?:input|select|textarea)$/i, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + var tmp, events, t, handleObjIn, + special, eventHandle, handleObj, + handlers, type, namespaces, origType, + elemData = jQuery._data( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + var j, handleObj, tmp, + origCount, t, events, + special, handlers, type, + namespaces, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + var handle, ontype, cur, + bubbleType, special, tmp, i, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && jQuery.acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && + jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, ret, handleObj, matched, j, + handlerQueue = [], + args = slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var sel, handleObj, matches, i, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + /* jshint eqeqeq: false */ + for ( ; cur != this; cur = cur.parentNode || this ) { + /* jshint eqeqeq: true */ + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var body, eventDoc, doc, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === strundefined ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + // Support: IE < 9, Android < 4.0 + src.returnValue === false ? + returnTrue : + returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + if ( !e ) { + return; + } + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && e.stopImmediatePropagation ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "submitBubbles" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "submitBubbles", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "changeBubbles", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = jQuery._data( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = jQuery._data( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + jQuery._removeData( doc, fix ); + } else { + jQuery._data( doc, fix, attaches ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var type, origFn; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +}); + + +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
", "
" ], + area: [ 1, "", "" ], + param: [ 1, "", "" ], + thead: [ 1, "", "
" ], + tr: [ 2, "", "
" ], + col: [ 2, "", "
" ], + td: [ 3, "", "
" ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +// Support: IE<8 +// Manipulating tables requires a tbody +function manipulationTarget( elem, content ) { + return jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? + + elem.getElementsByTagName("tbody")[0] || + elem.appendChild( elem.ownerDocument.createElement("tbody") ) : + elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + // 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 + + 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.defaultSelected = 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; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, node, clone, i, srcElements, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!support.noCloneEvent || !support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var j, elem, contains, + tmp, tag, tbody, wrap, + l = elems.length, + + // Ensure a safe fragment + safe = createSafeFragment( context ), + + nodes = [], + i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted from table fragments + if ( !support.tbody ) { + + // String was a , *may* have spurious + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare or + wrap[1] === "
" && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var elem, type, id, data, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( 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 ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // 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 ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== strundefined ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + deletedIds.push( id ); + } + } + } + } + } +}); + +jQuery.fn.extend({ + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + append: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + remove: function( selector, keepData /* Internal Use Only */ ) { + var elem, + elems = selector ? jQuery.filter( selector, this ) : this, + i = 0; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + 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 ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var arg = arguments[ 0 ]; + + // Make the changes, replacing each context element with the new content + this.domManip( arguments, function( elem ) { + arg = this.parentNode; + + jQuery.cleanData( getAll( this ) ); + + if ( arg ) { + arg.replaceChild( elem, this ); + } + }); + + // Force removal if there was no new content (e.g., from empty arguments) + return arg && (arg.length || arg.nodeType) ? this : this.remove(); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, callback ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var first, node, hasScripts, + scripts, doc, fragment, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, self.html() ); + } + self.domManip( args, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( this[i], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } +}); + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + + +var iframe, + elemdisplay = {}; + +/** + * Retrieve the actual display of a element + * @param {String} name nodeName of the element + * @param {Object} doc Document object + */ +// Called only from within defaultDisplay +function actualDisplay( name, doc ) { + var style, + elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + + // getDefaultComputedStyle might be reliably used only on attached element + display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? + + // Use of this method is a temporary fix (more like optmization) until something better comes along, + // since it was removed from specification and supported only in FF + style.display : jQuery.css( elem[ 0 ], "display" ); + + // We don't have any data stored on the element, + // so use "detach" method as fast way to get rid of the element + elem.detach(); + + return display; +} + +/** + * Try to determine the default display value of an element + * @param {String} nodeName + */ +function defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + + // Use the already-created iframe if possible + iframe = (iframe || jQuery( " - - - -
    - -
    - -
    - - - - - - - - - - - - - - - -
    -
    Term
    This is the first definition in compact format.
    -
    Term
    This is the second definition in compact format.
    -
    - - - - Scrolling text (non-standard) - - diff --git a/bower_components/jquery/test/data/selector/sizzle_cache.html b/bower_components/jquery/test/data/selector/sizzle_cache.html deleted file mode 100644 index de1a583b..00000000 --- a/bower_components/jquery/test/data/selector/sizzle_cache.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - jQuery selector - sizzle cache - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bower_components/jquery/test/data/statusText.php b/bower_components/jquery/test/data/statusText.php deleted file mode 100644 index daf58ce3..00000000 --- a/bower_components/jquery/test/data/statusText.php +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/bower_components/jquery/test/data/support/bodyBackground.html b/bower_components/jquery/test/data/support/bodyBackground.html deleted file mode 100644 index 3d135ab5..00000000 --- a/bower_components/jquery/test/data/support/bodyBackground.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - -
    - - - diff --git a/bower_components/jquery/test/data/support/boxModelIE.html b/bower_components/jquery/test/data/support/boxModelIE.html deleted file mode 100644 index 59bd37b4..00000000 --- a/bower_components/jquery/test/data/support/boxModelIE.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bower_components/jquery/test/data/support/hiddenIFrameFF.html b/bower_components/jquery/test/data/support/hiddenIFrameFF.html deleted file mode 100644 index a21708d5..00000000 --- a/bower_components/jquery/test/data/support/hiddenIFrameFF.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bower_components/jquery/test/data/support/testElementCrash.html b/bower_components/jquery/test/data/support/testElementCrash.html deleted file mode 100644 index db2c4550..00000000 --- a/bower_components/jquery/test/data/support/testElementCrash.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/bower_components/jquery/test/data/test.html b/bower_components/jquery/test/data/test.html deleted file mode 100644 index eec028e9..00000000 --- a/bower_components/jquery/test/data/test.html +++ /dev/null @@ -1,7 +0,0 @@ -html text
    - - -blabla diff --git a/bower_components/jquery/test/data/test.js b/bower_components/jquery/test/data/test.js deleted file mode 100644 index 69f492dc..00000000 --- a/bower_components/jquery/test/data/test.js +++ /dev/null @@ -1,3 +0,0 @@ -var foobar = "bar"; -jQuery('#ap').html('bar'); -ok( true, "test.js executed"); diff --git a/bower_components/jquery/test/data/test.php b/bower_components/jquery/test/data/test.php deleted file mode 100644 index 3d08f325..00000000 --- a/bower_components/jquery/test/data/test.php +++ /dev/null @@ -1,7 +0,0 @@ -html text
    - - -blabla \ No newline at end of file diff --git a/bower_components/jquery/test/data/test2.html b/bower_components/jquery/test/data/test2.html deleted file mode 100644 index 1df6151a..00000000 --- a/bower_components/jquery/test/data/test2.html +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/bower_components/jquery/test/data/test3.html b/bower_components/jquery/test/data/test3.html deleted file mode 100644 index 909d4174..00000000 --- a/bower_components/jquery/test/data/test3.html +++ /dev/null @@ -1,3 +0,0 @@ -
    This is a user
    -
    This is a user
    -
    This is a teacher
    diff --git a/bower_components/jquery/test/data/testinit.js b/bower_components/jquery/test/data/testinit.js deleted file mode 100644 index ac97e181..00000000 --- a/bower_components/jquery/test/data/testinit.js +++ /dev/null @@ -1,121 +0,0 @@ -var jQuery = this.jQuery || "jQuery", // For testing .noConflict() - $ = this.$ || "$", - originaljQuery = jQuery, - original$ = $, - amdDefined; - -/** - * Set up a mock AMD define function for testing AMD registration. - */ -function define(name, dependencies, callback) { - amdDefined = callback(); -} - -define.amd = { - jQuery: true -}; - -/** - * Returns an array of elements with the given IDs, eg. - * @example q("main", "foo", "bar") - * @result [
    , , ] - */ -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).get(), s = ""; - - for ( var i = 0; i < f.length; i++ ) { - s += (s && ",") + '"' + f[i].id + '"'; - } - - same(f, q.apply(q,c), a + " (" + b + ")"); -} - -var fireNative; -if ( document.createEvent ) { - fireNative = function( node, type ) { - var event = document.createEvent('HTMLEvents'); - event.initEvent( type, true, true ); - node.dispatchEvent( event ); - }; -} else { - fireNative = function( node, type ) { - var event = document.createEventObject(); - node.fireEvent( 'on' + type, event ); - }; -} - -/** - * 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); -} - -(function () { - // Store the old counts so that we only assert on tests that have actually leaked, - // instead of asserting every time a test has leaked sometime in the past - var oldCacheLength = 0, - oldFragmentsLength = 0, - oldTimersLength = 0, - oldActive = 0; - - /** - * Ensures that tests have cleaned up properly after themselves. Should be passed as the - * teardown function on all modules' lifecycle object. - */ - this.moduleTeardown = function () { - var i, fragmentsLength = 0, cacheLength = 0; - - // Allow QUnit.reset to clean up any attached elements before checking for leaks - QUnit.reset(); - - for ( i in jQuery.cache ) { - ++cacheLength; - } - - jQuery.fragments = {}; - - for ( i in jQuery.fragments ) { - ++fragmentsLength; - } - - // Because QUnit doesn't have a mechanism for retrieving the number of expected assertions for a test, - // if we unconditionally assert any of these, the test will fail with too many assertions :| - if ( cacheLength !== oldCacheLength ) { - equals( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" ); - oldCacheLength = cacheLength; - } - if ( fragmentsLength !== oldFragmentsLength ) { - equals( fragmentsLength, oldFragmentsLength, "No unit tests leak memory in jQuery.fragments" ); - oldFragmentsLength = fragmentsLength; - } - if ( jQuery.timers.length !== oldTimersLength ) { - equals( jQuery.timers.length, oldTimersLength, "No timers are still running" ); - oldTimersLength = jQuery.timers.length; - } - if ( jQuery.active !== oldActive ) { - equals( jQuery.active, 0, "No AJAX requests are still active" ); - oldActive = jQuery.active; - } - } -}()); \ No newline at end of file diff --git a/bower_components/jquery/test/data/testrunner.js b/bower_components/jquery/test/data/testrunner.js deleted file mode 100644 index abe85f08..00000000 --- a/bower_components/jquery/test/data/testrunner.js +++ /dev/null @@ -1,33 +0,0 @@ -jQuery.noConflict(); // Allow the test to run with other libs or jQuery's. - -// jQuery-specific QUnit.reset -(function() { - var reset = QUnit.reset, - ajaxSettings = jQuery.ajaxSettings; - - QUnit.reset = function() { - reset.apply(this, arguments); - jQuery.event.global = {}; - jQuery.ajaxSettings = jQuery.extend({}, ajaxSettings); - }; -})(); - -// load testswarm agent -(function() { - var url = window.location.search; - url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); - if ( !url || url.indexOf("http") !== 0 ) { - return; - } - - // (Temporarily) Disable Ajax tests to reduce network strain - // isLocal = QUnit.isLocal = true; - - document.write(""); -})(); - -// QUnit Aliases -(function() { - window.equals = window.equal; - window.same = window.deepEqual; -})(); diff --git a/bower_components/jquery/test/data/testsuite.css b/bower_components/jquery/test/data/testsuite.css deleted file mode 100644 index d3e4b4e4..00000000 --- a/bower_components/jquery/test/data/testsuite.css +++ /dev/null @@ -1,128 +0,0 @@ -/* for testing opacity set in styles in IE */ -ol#empty { opacity: 0; filter:Alpha(opacity=0) progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffff0000', EndColorStr='#ffffffff'); } - -div#fx-tests h4 { - background: red; -} - -div#fx-tests h4.pass { - background: green; -} - -div#fx-tests div.box { - background: red; - overflow: hidden; - border: 2px solid #000; -} - -div#fx-tests div.overflow { - overflow: visible; -} - -div.inline { - display: inline; -} - -div.autoheight { - height: auto; -} - -div.autowidth { - width: auto; -} - -div.autoopacity { - opacity: auto; -} - -div.largewidth { - width: 100px; -} - -div.largeheight { - height: 100px; -} - -div.largeopacity { - filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100); -} - -div.medwidth { - width: 50px; -} - -div.medheight { - height: 50px; -} - -div.medopacity { - opacity: 0.5; - filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50); -} - -div.nowidth { - width: 0px; -} - -div.noheight { - height: 0px; -} - -div.noopacity { - opacity: 0; - filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); -} - -div.hidden { - display: none; -} - -div#fx-tests div.widewidth { - background-repeat: repeat-x; -} - -div#fx-tests div.wideheight { - background-repeat: repeat-y; -} - -div#fx-tests div.widewidth.wideheight { - background-repeat: repeat; -} - -div#fx-tests div.noback { - background-image: none; -} - -div.chain, div.chain div { width: 100px; height: 20px; position: relative; float: left; } -div.chain div { position: absolute; top: 0px; left: 0px; } - -div.chain.test { background: red; } -div.chain.test div { background: green; } - -div.chain.out { background: green; } -div.chain.out div { background: red; display: none; } - -/* tests to ensure jQuery can determine the native display mode of elements - that have been set as display: none in stylesheets */ -div#show-tests * { display: none; } - -#nothiddendiv { font-size: 16px; } -#nothiddendivchild.em { font-size: 2em; } -#nothiddendivchild.prct { font-size: 150%; } - -/* For testing type on vml in IE #7071 */ -v\:oval { behavior:url(#default#VML); display:inline-block; } - -/* 8099 changes to default styles are read correctly */ -tt { display: none; } -sup { display: none; } -dfn { display: none; } - -/* #9239 Attach a background to the body( avoid crashes in removing the test element in support ) */ -body, div { background: url(http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif) no-repeat -1000px 0; } - -/* #6652 REMOVE FILTER:ALPHA(OPACITY=100) AFTER ANIMATION */ -#t6652 div { filter: alpha(opacity=50); } - -/* #10501 */ -section { background:#f0f; display:block; } \ No newline at end of file diff --git a/bower_components/jquery/test/data/text.php b/bower_components/jquery/test/data/text.php deleted file mode 100644 index b9df4cf3..00000000 --- a/bower_components/jquery/test/data/text.php +++ /dev/null @@ -1,12 +0,0 @@ -Lorem ipsum dolor sit amet -consectetuer adipiscing elit -Sed lorem leo -lorem leo consectetuer adipiscing elit -Sed lorem leo -rhoncus sit amet -elementum at -bibendum at, eros -Cras at mi et tortor egestas vestibulum -sed Cras at mi vestibulum -Phasellus sed felis sit amet -orci dapibus semper. diff --git a/bower_components/jquery/test/data/ua.txt b/bower_components/jquery/test/data/ua.txt deleted file mode 100644 index b6a9dff6..00000000 --- a/bower_components/jquery/test/data/ua.txt +++ /dev/null @@ -1,272 +0,0 @@ -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Win 9x 4.90; http://www.Abolimba.de) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; JyxoToolbar1.0; http://www.Abolimba.de; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322) - 0 Mozilla/5.0 (compatible; ABrowse 0.4; Syllable) -webkit 420 Mozilla/5.0 (compatible; U; ABrowse 0.6; Syllable) AppleWebKit/420+ (KHTML, like Gecko) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Acoo Browser; InfoPath.2; .NET CLR 2.0.50727; Alexa Toolbar) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Acoo Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506) - 0 amaya/9.52 libwww/5.4.0 - 0 amaya/11.1 libwww/5.4.0 - 0 Amiga-AWeb/3.5.07 beta - 0 AmigaVoyager/3.4.4 (MorphOS/PPC native) - 0 AmigaVoyager/2.95 (compatible; MC680x0; AmigaOS) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; AOL 7.0; Windows NT 5.1; FunWebProducts) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; AOL 8.0; Windows NT 5.1; SV1) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.0; Windows NT 5.1; .NET CLR 1.1.4322; Zango 10.1.181.0) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; AOL 6.0; Windows NT 5.1) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.5; AOLBuild 4337.35; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) -webkit 523.15 Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN) AppleWebKit/523.15 (KHTML, like Gecko, Safari/419.3) Arora/0.3 (Change: 287 c9dfb30) -webkit 527 Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.6 -webkit 523.15 Mozilla/5.0 (X11; U; Linux; C -) AppleWebKit/523.15 (KHTML, like Gecko, Safari/419.3) Arora/0.5 -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Avant Browser; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1) - 0 Avant Browser (http://www.avantbrowser.com) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; JyxoToolbar1.0; Embedded Web Browser from: http://bsalsa.com/; Avant Browser; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; Avant Browser) -mozilla 0 Mozilla/5.0 (Windows; U; Win9x; en; Stable) Gecko/20020911 Beonex/0.8.1-stable -mozilla 0 Mozilla/5.0 (Windows; U; WinNT; en; Preview) Gecko/20020603 Beonex/0.8-stable -mozilla 1.0.2 Mozilla/5.0 (Windows; U; WinNT; en; rv:1.0.2) Gecko/20030311 Beonex/0.8.2-stable -mozilla 1.9 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008120120 Blackbird/0.9991 -webkit 527 Mozilla/5.0 (X11; 78; CentOS; US-en) AppleWebKit/527+ (KHTML, like Gecko) Bolt/0.862 Version/3.0 Safari/523.15 -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Browzar) - 0 Bunjalloo/0.7.4(Nintendo DS;U;en) - 0 Bunjalloo/0.7.6(Nintendo DS;U;en) -mozilla 1.8.1.4pre Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.4pre) Gecko/20070511 Camino/1.6pre -mozilla 1.7.2 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.2) Gecko/20040825 Camino/0.8.1 -mozilla 1.8.1.12 Mozilla/5.0 (Macintosh; U; Intel Mac OS X Mach-O; en; rv:1.8.1.12) Gecko/20080206 Camino/1.5.5 -mozilla 1.0.1 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.0.1) Gecko/20030111 Chimera/0.6 -mozilla 1.8.0.10 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.10) Gecko/20070228 Camino/1.0.4 -webkit 418.9 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko, Safari) Safari/419.3 Cheshire/1.0.ALPHA -webkit 419 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko, Safari/419.3) Cheshire/1.0.ALPHA -webkit 525.19 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.36 Safari/525.19 -webkit 525.19 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.53 Safari/525.19 -mozilla 1.9.0.10 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042815 Firefox/3.0.10 CometBird/3.0.10 -mozilla 1.9.0.5 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2009011615 Firefox/3.0.5 CometBird/3.0.5 -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; Crazy Browser 3.0.0 Beta2) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; Crazy Browser 2.0.1) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Crazy Browser 1.0.5; .NET CLR 1.1.4322; InfoPath.1) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Deepnet Explorer 1.5.0; .NET CLR 1.0.3705) -webkit 525.27.1 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Demeter/1.0.9 Safari/125 -webkit 312.8 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; pl-pl) AppleWebKit/312.8 (KHTML, like Gecko, Safari) DeskBrowse/1.0 - 0 Dillo/0.8.5 - 0 Dillo/2.0 - 0 DocZilla/1.0 (Windows; U; WinNT4.0; en-US; rv:1.0.0) Gecko/20020804 - 0 DocZilla/2.7 (Windows; U; Windows NT 5.1; en-US; rv:2.7.0) Gecko/20050706 CiTEC Information -webkit 527 Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Dooble - 0 Doris/1.15 [en] (Symbian) - 0 edbrowse/1.5.17-2 - 0 edbrowse/2.2.10 - 0 edbrowse/3.1.2-1 - 0 ELinks/0.13.GIT (textmode; Linux 2.6.22-2-686 i686; 148x68-3) - 0 ELinks/0.9.3 (textmode; Linux 2.6.11 i686; 79x24) - 0 Enigma Browser -mozilla 1.8.1.12 Mozilla/5.0 (X11; U; Linux i686; en; rv:1.8.1.12) Gecko/20080208 (Debian-1.8.1.12-2) Epiphany/2.20 -mozilla 1.9.0.12 Mozilla/5.0 (X11; U; Linux x86_64; en; rv:1.9.0.12) Gecko/20080528 Fedora/2.24.3-8.fc10 Epiphany/2.22 Firefox/3.0 -mozilla 1.7.3 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Epiphany/1.4.7 -mozilla 1.5 Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031007 Firebird/0.7 -mozilla 1.5 Mozilla/5.0 (Windows; U; Win95; en-US; rv:1.5) Gecko/20031007 Firebird/0.7 -mozilla 1.8.0.3 Mozilla/5.0 (Windows; U; Windows NT 5.0; es-ES; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 -mozilla 1.9.1b2 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; ko; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2 -mozilla 1.9.0.8 Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 -mozilla 1.7.9 Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7.9) Gecko/20050711 Firefox/1.0.5 -mozilla 1.9b5 Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5 -mozilla 1.8.0.5 Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.8.0.5) Gecko/20060819 Firefox/1.5.0.5 -mozilla 1.9.1b3 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3) Gecko/20090305 Firefox/3.1b3 GTB5 -mozilla 1.8.1.12 Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080214 Firefox/2.0.0.12 -mozilla 1.8.1.9 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.9) Gecko/20071113 BonEcho/2.0.0.9 -mozilla 1.8.1 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061026 BonEcho/2.0 -mozilla 1.8.1.21pre Mozilla/5.0 (BeOS; U; Haiku BePC; en-US; rv:1.8.1.21pre) Gecko/20090227 BonEcho/2.0.0.21pre -mozilla 1.9.0.8 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/2009033017 GranParadiso/3.0.8 -mozilla 1.9.2a2pre Mozilla/5.0 (Windows; U; Windows NT 6.1; cs; rv:1.9.2a2pre) Gecko/20090912 Namoroka/3.6a2pre (.NET CLR 3.5.30729) -mozilla 1.9.2a2pre Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2a2pre) Gecko/20090901 Ubuntu/9.10 (karmic) Namoroka/3.6a2pre -mozilla 1.9.2a1 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2a1) Gecko/20090806 Namoroka/3.6a1 -mozilla 1.9.1b3pre Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090109 Shiretoko/3.1b3pre -mozilla 1.9.1b4pre Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b4pre) Gecko/20090311 Shiretoko/3.1b4pre -mozilla 1.8.0.1 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060314 Flock/0.5.13.2 -mozilla 1.9.0.2 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.2) Gecko/2008092122 Firefox/3.0.2 Flock/2.0b3 -webkit 525.13 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Fluid/0.9.4 Safari/525.13 -mozilla 1.7.12 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050929 Galeon/1.3.21 -mozilla 1.9.0.8 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/20090327 Galeon/2.0.7 -mozilla 1.9.1.5 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091105 Firefox/3.5.5 compat GlobalMojo/1.5.5 GlobalMojoExt/1.5 -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; GreenBrowser) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; GreenBrowser) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; GreenBrowser) - 0 HotJava/1.1.2 FCS -mozilla 0 Mozilla/3.0 (x86 [cs] Windows NT 5.1; Sun) -mozilla 1.8.0.3 Mozilla/5.1 (X11; U; Linux i686; en-US; rv:1.8.0.3) Gecko/20060425 SUSE/1.5.0.3-7 Hv3/alpha -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SIMBAR={CFBFDAEA-F21E-4D6E-A9B0-E100A69B860F}; Hydra Browser; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Hydra Browser; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) - 0 IBrowse/2.3 (AmigaOS 3.9) - 0 Mozilla/5.0 (compatible; IBrowse 3.0; AmigaOS4.0) - 0 iCab/4.0 (Macintosh; U; Intel Mac OS X) - 0 Mozilla/4.5 (compatible; iCab 2.9.1; Macintosh; U; PPC) - 0 iCab/3.0.2 (Macintosh; U; PPC Mac OS X) - 0 ICE Browser/v5_4_3 (Java 1.4.2; Windows XP 5.1 x86) -mozilla 0 Mozilla/5.0 (Java 1.6.0_01; Windows XP 5.1 x86; en) ICEbrowser/v6_1_2 - 0 ICE Browser/5.05 (Java 1.4.0; Windows 2000 5.0 x86) -mozilla 1.8.1.9 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.9) Gecko/20071030 Iceape/1.1.6 (Debian-1.1.6-3) -mozilla 1.8.1.8 Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.8) Gecko/20071008 Iceape/1.1.5 (Ubuntu-1.1.5-1ubuntu0.7.10) -mozilla 1.9.0.3 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092921 IceCat/3.0.3-g1 -mozilla 1.8.1.11 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20071203 IceCat/2.0.0.11-g1 -mozilla 1.9.0.5 Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.0.5) Gecko/2008122011 Iceweasel/3.0.5 (Debian-3.0.5-1) -mozilla 1.8.1.1 Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.1) Gecko/20061205 Iceweasel/2.0.0.1 (Debian-2.0.0.1+dfsg-4) -mozilla 1.9.0.5 Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.0.5) Gecko/2008122011 Iceweasel/3.0.5 (Debian-3.0.5-1) -msie 4.0 Mozilla/2.0 (compatible; MSIE 4.0; Windows 98) -msie 6.0 Mozilla/4.0 (Windows; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727) -msie 7.0 Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1; .NET CLR 3.0.04506.30) -msie 5.01 Mozilla/4.0 (compatible; MSIE 5.01; Windows NT) -msie 8.0 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; MS-RTC LM 8; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; .NET CLR 3.0.30729) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727) -msie 5.0b1 Mozilla/4.0 (compatible; MSIE 5.0b1; Mac_PowerPC) -msie 5.0 Mozilla/4.0 (compatible; MSIE 5.0; Windows NT;) -msie 5.23 Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB6; Ant.com Toolbar 1.6; MSIECrawler) -msie 8.0 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB5; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; MS-RTC LM 8; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; .NET CLR 3.0.30729) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; iRider 2.21.1108; FDM) -webkit 528.5 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/528.5 (KHTML, like Gecko) Iron/0.4.155.0 Safari/528.5 -webkit 528.7 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/528.7 (KHTML, like Gecko) Iron/1.0.155.0 Safari/528.7 -webkit 525.19 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Iron/0.2.152.0 Safari/12081672.525 -webkit 531.0 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/531.0 (KHTML, like Gecko) Iron/3.0.189.0 Safari/531.0 -mozilla 1.8.1.19 Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.8.1.19) Gecko/20081217 K-Meleon/1.5.2 -mozilla 1.8.1.21 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090331 K-Meleon/1.5.3 -mozilla 1.8.0.5 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060706 K-Meleon/1.0 -mozilla 1.8.1.21 Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.21) Gecko/20090331 K-Meleon/1.5.3 -mozilla 1.8.0.6 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060731 K-Ninja/2.0.2 -mozilla 1.8.1.4pre Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4pre) Gecko/20070404 K-Ninja/2.1.3 -mozilla 1.8.1.2pre Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre) Gecko/20070215 K-Ninja/2.1.1 -mozilla 1.9 Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/20080705 Firefox/3.0 Kapiko/3.0 -mozilla 0 Mozilla/5.0 (X11; Linux i686; U;) Gecko/20070322 Kazehakase/0.4.5 -mozilla 1.9.0.8 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko Fedora/1.9.0.8-1.fc10 Kazehakase/0.5.6 -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; KKman2.0) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; KKMAN3.2) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; KKman3.0) - 0 Mozilla/5.0 (compatible; Konqueror/3.1-rc5; i686 Linux; 20020712) - 0 Mozilla/5.0 (compatible; Konqueror/4.3; Windows) KHTML/4.3.0 (like Gecko) - 0 Mozilla/5.0 (compatible; Konqueror/2.2.1; Linux) - 0 Mozilla/5.0 (compatible; Konqueror/3.5; SunOS) - 0 Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko) - 0 Links (0.96; Linux 2.4.20-18.7 i586) - 0 Links (0.98; Win32; 80x25) - 0 Links (2.1pre18; Linux 2.4.31 i686; 100x37) - 0 Links (2.1; Linux 2.6.18-gentoo-r6 x86_64; 80x24) - 0 Links (2.2; Linux 2.6.25-gentoo-r9 sparc64; 166x52) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Linux 2.6.26-1-amd64) Lobo/0.98.3 -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows XP 5.1) Lobo/0.98.4 - 0 Mozilla/4.0 (compatible; Lotus-Notes/5.0; Windows-NT) - 0 Mozilla/4.0 (compatible; Lotus-Notes/6.0; Windows-NT) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; Lunascape 2.1.3) -mozilla 1.9.1b3pre Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/2008 Lunascape/4.9.9.98 -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; JyxoToolbar1.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; Lunascape 5.1.4.5) -webkit 528 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/528+ (KHTML, like Gecko, Safari/528.0) Lunascape/5.0.2.0 -mozilla 1.9.1.2 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090804 Firefox/3.5.2 Lunascape/5.1.4.5 - 0 Lynx/2.8.6rel.4 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.6.3 - 0 Lynx/2.8.3dev.6 libwww-FM/2.14 - 0 Lynx/2.8.5dev.16 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7a -mozilla 1.7.12 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20051001 Firefox/1.0.7 Madfox/0.3.2u3 -webkit 530.6 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.6 (KHTML, like Gecko) Maxthon/3.0 Safari/530.6 -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MyIE2) -msie 8.0 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; MAXTHON 2.0) - 0 Midori/0.1.7 -webkit 532 Midori/0.1.5 (X11; Linux; U; en-gb) WebKit/532+ -mozilla 1.0.1 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020919 -mozilla 1.7.12 Mozilla/5.0 (Windows; U; Windows NT 5.0; it-IT; rv:1.7.12) Gecko/20050915 -mozilla 1.4 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4; MultiZilla v1.5.0.0f) Gecko/20030624 -mozilla 1.2.1 Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1; MultiZilla v1.1.32 final) Gecko/20021130 - 0 NCSA_Mosaic/2.0 (Windows 3.1) - 0 NCSA_Mosaic/3.0 (Windows 95) - 0 NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m) - 0 NCSA_Mosaic/2.6 (X11; SunOS 4.1.3 sun4m) - 0 Mozilla/3.01 (compatible; Netbox/3.5 R92; Linux 2.2) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; NetCaptor 7.5.4; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) -msie 5.01 Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; NetCaptor 6.5.0RC1) -mozilla 1.7.5 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20060127 Netscape/8.1 -mozilla 0 Mozilla/4.04 [en] (X11; I; IRIX 5.3 IP22) -mozilla 0.9.2 Mozilla/5.0 (Windows; U; Win 9x 4.90; de-DE; rv:0.9.2) Gecko/20010726 Netscape6/6.1 -mozilla 1.8.1.12 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080219 Firefox/2.0.0.12 Navigator/9.0.0.6 -mozilla 0 Mozilla/4.08 [en] (WinNT; U ;Nav) -mozilla 1.0.2 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 -mozilla 0 Mozilla/3.0 (Win95; I) -mozilla 0 Mozilla/4.51 [en] (Win98; U) - 0 NetSurf/2.0 (RISC OS; armv3l) - 0 NetSurf/1.2 (Linux; i686) - 0 Mozilla/4.7 (compatible; OffByOne; Windows 2000) - 0 Mozilla/4.7 (compatible; OffByOne; Windows 98) - 0 Mozilla/4.5 (compatible; OmniWeb/4.1.1-v424.6; Mac_PowerPC) - 0 OmniWeb/2.7-beta-3 OWF/1.0 -webkit 420 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/420+ (KHTML, like Gecko, Safari) OmniWeb/v595 -opera 6.0 Opera/6.0 (Windows 2000; U) [fr] -opera 7.10 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.10 [en] -opera 10.00 Opera/9.80 (Windows NT 5.1; U; cs) Presto/2.2.15 Version/10.00 -opera 5.11 Opera/5.11 (Windows 98; U) [en] -opera 9.51 Opera/9.51 (Macintosh; Intel Mac OS X; U; en) -opera 6.01 Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 4.0) Opera 6.01 [en] -opera 9.02 Opera/9.02 (Windows XP; U; ru) -opera 5.12 Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 5.12 [en] -opera 9.70 Opera/9.70 (Linux i686 ; U; en) Presto/2.2.1 -opera 7.03 Opera/7.03 (Windows NT 5.0; U) [en] -opera 9.24 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.24 -mozilla 1.9.0.7 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009030821 Firefox/3.0.7 Orca/1.1 build 2 -mozilla 1.9.0.6 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009022300 Firefox/3.0.6 Orca/1.1 build 1 - 0 Mozilla/1.10 [en] (Compatible; RISC OS 3.70; Oregano 1.10) -webkit 530.0 Mozilla/5.0 (compatible; Origyn Web Browser; AmigaOS 4.1; ppc; U; en) AppleWebKit/530.0+ (KHTML, like Gecko, Safari/530.0+) -webkit 531.0 Mozilla/5.0 (compatible; Origyn Web Browser; AmigaOS 4.0; U; en) AppleWebKit/531.0+ (KHTML, like Gecko, Safari/531.0+) -webkit 528.5 Mozilla/5.0 (compatible; Origyn Web Browser; MorphOS; PPC; U) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; PhaseOut-www.phaseout.net) -mozilla 1.4a Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4a) Gecko/20030411 Phoenix/0.5 -mozilla 1.2b Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021029 Phoenix/0.4 -webkit 527 Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/527+ (KHTML, like Gecko) QtWeb Internet Browser/2.5 http://www.QtWeb.net -webkit 527 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/527+ (KHTML, like Gecko) QtWeb Internet Browser/1.2 http://www.QtWeb.net -webkit 527 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/527+ (KHTML, like Gecko) QtWeb Internet Browser/1.7 http://www.QtWeb.net -webkit 527 Mozilla/5.0 (X11; U; Linux; cs-CZ) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) rekonq - 0 retawq/0.2.6c [en] (text) -webkit 312.8 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.6 -webkit 528.16 Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_6; it-it) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16 -webkit 523.15 Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/523.15 (KHTML, like Gecko) Version/3.0 Safari/523.15 -webkit 125.2 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.7 -webkit 528.16 Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16 -webkit 420 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; fi-fi) AppleWebKit/420+ (KHTML, like Gecko) Safari/419.3 -mozilla 1.8.1.13 Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 -mozilla 1.9.1a2pre Mozilla/5.0 (X11; U; Linux i686; rv:1.9.1a2pre) Gecko/20080824052448 SeaMonkey/2.0a1pre -mozilla 1.8.1.6 Mozilla/5.0 (Windows; U; Win 9x 4.90; en-GB; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 -mozilla 1.9.1b3pre Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1b3pre) Gecko/20081208 SeaMonkey/2.0a3pre -mozilla 1.9a1 Mozilla/5.0 (BeOS; U; BeOS BePC; en-US; rv:1.9a1) Gecko/20060702 SeaMonkey/1.5a -mozilla 1.9.1b3pre Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3pre) Gecko/20081202 SeaMonkey/2.0a2 -webkit 419 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; ja-jp) AppleWebKit/419 (KHTML, like Gecko) Shiira/1.2.3 Safari/125 -webkit 417.9 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/417.9 (KHTML, like Gecko, Safari) Shiira/1.1 -webkit 418.9.1 Mozilla/5.0 (Macintosh; U; Intel Mac OS X; fr) AppleWebKit/418.9.1 (KHTML, like Gecko) Shiira Safari/125 -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Sleipnir/2.8.1 -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727) Sleipnir/2.8.4 -webkit 525.27.1 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Stainless/0.4 Safari/525.20.1 -webkit 528.16 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/528.16 (KHTML, like Gecko) Stainless/0.5.3 Safari/525.20.1 -webkit 525.18 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Sunrise/1.7.4 like Safari/4525.22 -webkit 125.5.7 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/125.5.7 (KHTML, like Gecko) SunriseBrowser/0.853 -mozilla 1.9.0.10pre Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10pre) Gecko/2009041814 Firefox/3.0.10pre (Swiftfox) -msie 6.0 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; TheWorld) -webkit 1.1.8 Webkit/1.1.8 (Linux; en-us) Uzbl -webkit 1.1.10 Uzbl (X11; U; Linux x86_64; en-GB) AppleWebkit/1.1.10 -webkit 1.1.9 Uzbl (Webkit 1.1.9) (Linux) -webkit 1.1.10 Uzbl (U; Linux x86_64; en-GB) Webkit 1.1.10 - 0 w3m/0.5.1 - 0 w3m/0.5.2 -webkit 103u Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/103u (KHTML, like Gecko) wKiosk/100 -mozilla 1.9.0.9 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.9) Gecko/2009042410 Firefox/3.0.9 Wyzo/3.0.3 - 0 X-Smiles/1.2-20081113 -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; MEGAUPLOAD 2.0) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30) -mozilla 1.9.0.4 Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.4) Gecko/2008111217 Fedora/3.0.4-1.fc9 Firefox/3.0.4 -mozilla 1.9.0.4 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; .NET CLR 1.1.4322; FDM) -msie 6.0 mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; mra 4.6 (build 01425); .net clr 2.0.50727) -msie 7.0 mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; mra 4.9 (build 01863)) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath?.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; MS-RTC LM 8; .NET CLR 1.1.4322) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; InfoPath?.2; .NET CLR 3.5.21022) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Sky Broadband; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; MS-RTC LM 8; .NET CLR 1.1.4322) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; InfoPath.2; .NET CLR 3.5.21022) -msie 7.0 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; http://bsalsa.com); .NET CLR 1.1.4322; .NET CLR 2.0.50727 -opera 10.00 Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.00 -msie 8.0 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; InfoPath?.2; .NET CLR 2.0.50727; CIBA; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) -opera 10.00 Opera/9.80 (X11; Linux x86_64; U; de) Presto/2.2.15 Version/10.00 -opera 10.50 Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.5.18 Version/10.50 diff --git a/bower_components/jquery/test/data/versioncheck.js b/bower_components/jquery/test/data/versioncheck.js deleted file mode 100644 index f4b7790d..00000000 --- a/bower_components/jquery/test/data/versioncheck.js +++ /dev/null @@ -1,8 +0,0 @@ -// Run minified source from dist (do make first) -// Should be loaded before QUnit but after src -(function() { - if ( /jquery\=min/.test( window.location.search ) ) { - jQuery.noConflict( true ); - document.write(unescape("%3Cscript%20src%3D%27../dist/jquery.min.js%27%3E%3C/script%3E")); - } -})(); \ No newline at end of file diff --git a/bower_components/jquery/test/data/with_fries.xml b/bower_components/jquery/test/data/with_fries.xml deleted file mode 100644 index 42f42570..00000000 --- a/bower_components/jquery/test/data/with_fries.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - 1 - - - - - foo - - - - - - - diff --git a/bower_components/jquery/test/data/with_fries_over_jsonp.php b/bower_components/jquery/test/data/with_fries_over_jsonp.php deleted file mode 100644 index 456aeb3b..00000000 --- a/bower_components/jquery/test/data/with_fries_over_jsonp.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/bower_components/jquery/test/delegatetest.html b/bower_components/jquery/test/delegatetest.html deleted file mode 100644 index f6f6a35b..00000000 --- a/bower_components/jquery/test/delegatetest.html +++ /dev/null @@ -1,206 +0,0 @@ - - - -Event Delegation Tests - - - - -

    Delegate Tests (BAD FILE IN URL, x)

    - -
    - - - - - - - - - - - - - - - -
    - Controls: - - - - - - - -
    - -
    - - -
    - -
    - -
    - - -
    - - - - - - - -
    -
    -
    -
    -
    -

    NOTE: Only IE supports propertychange, beforeactivate, beforedeactivate; buttons do not support change events.

    - -

    Submit Tests

    - - - - - - - - - - - - - - - -
    - Submit each: - -
    - -
    -
    -
    - -
    -
    -
    - -
    -
    $(document).bind('submit')
    Results:TEXTPASSWORDBUTTONDOCUMENT
    - - - - diff --git a/bower_components/jquery/test/hovertest.html b/bower_components/jquery/test/hovertest.html deleted file mode 100644 index d6242091..00000000 --- a/bower_components/jquery/test/hovertest.html +++ /dev/null @@ -1,158 +0,0 @@ - - -Hover tests - - - - -

    Hover (mouse{over,out,enter,leave}) Tests

    -

    Be sure to try moving the mouse out of the browser via the left side on each test.

    -
    - -
    -
    - - .hover() in/out: 0 / 0 -
    -
    - Mouse over here should NOT trigger the counter. -
    -
    -
    -
    - - Live enter/leave: 0 / 0 -
    -
    - Mouse over here should NOT trigger the counter. -
    -
    -
    -
    - - Delegated enter/leave: 0 / 0 -
    -
    - Mouse over here should NOT trigger the counter. -
    -
    - -
    -
    - - Bind over/out: 0 / 0 -
    -
    - Mouse over here SHOULD trigger the counter. -
    -
    -
    -
    - - Live over/out: 0 / 0 -
    -
    - Mouse over here SHOULD trigger the counter. -
    -
    -
    -
    - - Delegated over/out: 0 / 0 -
    -
    - Mouse over here SHOULD trigger the counter. -
    -
    - -
    - - - - diff --git a/bower_components/jquery/test/localfile.html b/bower_components/jquery/test/localfile.html deleted file mode 100644 index c552f214..00000000 --- a/bower_components/jquery/test/localfile.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - jQuery Local File Test - - - - - - - - - - - - - - - - - - - - - - - -

    jQuery Local File Test

    -

    - Introduction -

    -
      -
    • - Access this file using the "file:" protocol, -
    • -
    • - two green "OK" strings must appear below, -
    • -
    • - Empty local files will issue errors, it's a known limitation. -
    • -
    -

    - Results -

    -
      -
    • - Success: - - -
    • -
    • - Error: - - -
    • -
    -

    - Logs: -

    -
      -
    - - \ No newline at end of file diff --git a/bower_components/jquery/test/networkerror.html b/bower_components/jquery/test/networkerror.html deleted file mode 100644 index f98bf469..00000000 --- a/bower_components/jquery/test/networkerror.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - jQuery Network Error Test for Firefox - - - - - - - - - - - - - - - - - - - - - - - - -

    - jQuery Network Error Test for Firefox -

    -
    - This is a test page for - - #8135 - - which was reported in Firefox when accessing properties - of an XMLHttpRequest object after a network error occured. -
    -
    Take the following steps:
    -
      -
    1. - make sure you accessed this page through a web server, -
    2. -
    3. - stop the web server, -
    4. -
    5. - open the console, -
    6. -
    7. - click this - - , -
    8. -
    9. - wait for both requests to fail. -
    10. -
    -
    - Test passes if you get two log lines: -
      -
    • - the first starting with "abort", -
    • -
    • - the second starting with "complete", -
    • -
    -
    -
    - Test fails if the browser notifies an exception. -
    - - \ No newline at end of file diff --git a/bower_components/jquery/test/polluted.php b/bower_components/jquery/test/polluted.php deleted file mode 100644 index 50fc7cd6..00000000 --- a/bower_components/jquery/test/polluted.php +++ /dev/null @@ -1,99 +0,0 @@ - array( - "versions" => array( "1.1.1", "1.2.0", "1.2.3", "1.3.0", "1.3.1", "1.3.2", "1.4.0", "1.4.1", "1.4.3", "1.5.0" ), - "url" => "dojo/XYZ/dojo/dojo.xd.js" - ), - "ExtCore" => array( - "versions" => array( "3.0.0", "3.1.0" ), - "url" => "ext-core/XYZ/ext-core.js" - ), - "jQuery" => array( - "versions" => array( "1.2.3", "1.2.6", "1.3.0", "1.3.1", "1.3.2", "1.4.0", "1.4.1", "1.4.2", "1.4.3", "1.4.4", "1.5.0" ), - "url" => "jquery/XYZ/jquery.min.js" - ), - "jQueryUI" => array( - "versions" => array( "1.5.2", "1.5.3", "1.6.0", "1.7.0", "1.7.1", "1.7.2", "1.7.3", "1.8.0", "1.8.1", "1.8.2", "1.8.4", "1.8.5", "1.8.6", "1.8.7", "1.8.8", "1.8.9" ), - "url" => "jqueryui/XYZ/jquery-ui.min.js" - ), - "MooTools" => array( - "versions" => array( "1.1.1", "1.1.2", "1.2.1", "1.2.2", "1.2.3", "1.2.4", "1.2.5", "1.3.0" ), - "url" => "mootools/XYZ/mootools-yui-compressed.js" - ), - "Prototype" => array( - "versions" => array( "1.6.0.2", "1.6.0.3", "1.6.1.0", "1.7.0.0" ), - "url" => "prototype/XYZ/prototype.js" - ), - "scriptaculous" => array( - "versions" => array( "1.8.1", "1.8.2", "1.8.3" ), - "url" => "scriptaculous/XYZ/scriptaculous.js" - ), - "SWFObject" => array( - "versions" => array( "2.1", "2.2" ), - "url" => "swfobject/XYZ/swfobject.js" - ), - "YUI" => array( - "versions" => array( "2.6.0", "2.7.0", "2.8.0r4", "2.8.1", "2.8.2", "3.3.0" ), - "url" => "yui/XYZ/build/yui/yui-min.js" - ) - ); - - if( count($_POST) ) { - $includes = array(); - foreach( $_POST as $name => $ver ){ - $url = $libraries[ $name ][ "url" ]; - if( $name == "YUI" && $ver[0] == "2" ) { - $url = str_replace( "/yui", "/yuiloader", $url, $count = 2 ); - } - $include = "\n"; - if( $lib == "prototype" ) { // prototype must be included first - array_unshift( $includes, $include ); - } else { - array_push( $includes, $include ); - } - } - - $includes = implode( "\n", $includes ); - $suite = file_get_contents( "index.html" ); - echo str_replace( "", $includes, $suite ); - exit; - } -?> - - - - - Run jQuery Test Suite Polluted - - - - -

    jQuery Test Suite

    - -

    Choose other libraries to include

    - -
    - $data ) { - echo "
    $name"; - $i = 0; - foreach( $data[ "versions" ] as $ver ) { - $i++; - echo ""; - if( !($i % 4) ) echo "
    "; - } - echo "
    "; - } - ?> - -
    - - diff --git a/bower_components/jquery/test/readywait.html b/bower_components/jquery/test/readywait.html deleted file mode 100644 index b4d8111e..00000000 --- a/bower_components/jquery/test/readywait.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - jQuery.holdReady Test - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    - jQuery.holdReady Test -

    -

    - This is a test page for jQuery.readyWait and jQuery.holdReady, - see - #6781 - and - #8803. -

    -

    - Test for jQuery.holdReady, which can be used - by plugins and other scripts to indicate something - important to the page is still loading and needs - to block the DOM ready callbacks that are registered - with jQuery. -

    -

    - Script loaders are the most likely kind of script - to use jQuery.holdReady, but it could be used by - other things like a script that loads a CSS file - and wants to pause the DOM ready callbacks. -

    -

    - Expected Result: The text - It Worked! - appears below after about 2 seconds. -

    -

    - If there is an error in the console, - or the text does not show up, then the test failed. -

    -
    - - diff --git a/bower_components/jquery/test/unit/ajax.js b/bower_components/jquery/test/unit/ajax.js deleted file mode 100644 index 9e11087b..00000000 --- a/bower_components/jquery/test/unit/ajax.js +++ /dev/null @@ -1,2315 +0,0 @@ -module("ajax", { teardown: moduleTeardown }); - -// Safari 3 randomly crashes when running these tests, -// but only in the full suite - you can run just the Ajax -// tests and they'll pass -//if ( !jQuery.browser.safari ) { - -if ( !isLocal ) { - -test("jQuery.ajax() - success callbacks", function() { - expect( 8 ); - - jQuery.ajaxSetup({ timeout: 0 }); - - stop(); - - jQuery("#foo").ajaxStart(function(){ - ok( true, "ajaxStart" ); - }).ajaxStop(function(){ - ok( true, "ajaxStop" ); - start(); - }).ajaxSend(function(){ - ok( true, "ajaxSend" ); - }).ajaxComplete(function(){ - ok( true, "ajaxComplete" ); - }).ajaxError(function(){ - ok( false, "ajaxError" ); - }).ajaxSuccess(function(){ - ok( true, "ajaxSuccess" ); - }); - - jQuery.ajax({ - url: url("data/name.html"), - beforeSend: function(){ ok(true, "beforeSend"); }, - success: function(){ ok(true, "success"); }, - error: function(){ ok(false, "error"); }, - complete: function(){ ok(true, "complete"); } - }); -}); - -test("jQuery.ajax() - success callbacks - (url, options) syntax", function() { - expect( 8 ); - - jQuery.ajaxSetup({ timeout: 0 }); - - stop(); - - setTimeout(function(){ - jQuery("#foo").ajaxStart(function(){ - ok( true, "ajaxStart" ); - }).ajaxStop(function(){ - ok( true, "ajaxStop" ); - start(); - }).ajaxSend(function(){ - ok( true, "ajaxSend" ); - }).ajaxComplete(function(){ - ok( true, "ajaxComplete" ); - }).ajaxError(function(){ - ok( false, "ajaxError" ); - }).ajaxSuccess(function(){ - ok( true, "ajaxSuccess" ); - }); - - jQuery.ajax( url("data/name.html") , { - beforeSend: function(){ ok(true, "beforeSend"); }, - success: function(){ ok(true, "success"); }, - error: function(){ ok(false, "error"); }, - complete: function(){ ok(true, "complete"); } - }); - }, 13); -}); - -test("jQuery.ajax() - success callbacks (late binding)", function() { - expect( 8 ); - - jQuery.ajaxSetup({ timeout: 0 }); - - stop(); - - setTimeout(function(){ - jQuery("#foo").ajaxStart(function(){ - ok( true, "ajaxStart" ); - }).ajaxStop(function(){ - ok( true, "ajaxStop" ); - start(); - }).ajaxSend(function(){ - ok( true, "ajaxSend" ); - }).ajaxComplete(function(){ - ok( true, "ajaxComplete" ); - }).ajaxError(function(){ - ok( false, "ajaxError" ); - }).ajaxSuccess(function(){ - ok( true, "ajaxSuccess" ); - }); - - jQuery.ajax({ - url: url("data/name.html"), - beforeSend: function(){ ok(true, "beforeSend"); } - }) - .complete(function(){ ok(true, "complete"); }) - .success(function(){ ok(true, "success"); }) - .error(function(){ ok(false, "error"); }); - }, 13); -}); - -test("jQuery.ajax() - success callbacks (oncomplete binding)", function() { - expect( 8 ); - - jQuery.ajaxSetup({ timeout: 0 }); - - stop(); - - setTimeout(function(){ - jQuery("#foo").ajaxStart(function(){ - ok( true, "ajaxStart" ); - }).ajaxStop(function(){ - ok( true, "ajaxStop" ); - }).ajaxSend(function(){ - ok( true, "ajaxSend" ); - }).ajaxComplete(function(){ - ok( true, "ajaxComplete" ); - }).ajaxError(function(){ - ok( false, "ajaxError" ); - }).ajaxSuccess(function(){ - ok( true, "ajaxSuccess" ); - }); - - jQuery.ajax({ - url: url("data/name.html"), - beforeSend: function(){ ok(true, "beforeSend"); }, - complete: function(xhr) { - xhr - .complete(function(){ ok(true, "complete"); }) - .success(function(){ ok(true, "success"); }) - .error(function(){ ok(false, "error"); }) - .complete(function(){ start(); }); - } - }); - }, 13); -}); - -test("jQuery.ajax() - success callbacks (very late binding)", function() { - expect( 8 ); - - jQuery.ajaxSetup({ timeout: 0 }); - - stop(); - - setTimeout(function(){ - jQuery("#foo").ajaxStart(function(){ - ok( true, "ajaxStart" ); - }).ajaxStop(function(){ - ok( true, "ajaxStop" ); - }).ajaxSend(function(){ - ok( true, "ajaxSend" ); - }).ajaxComplete(function(){ - ok( true, "ajaxComplete" ); - }).ajaxError(function(){ - ok( false, "ajaxError" ); - }).ajaxSuccess(function(){ - ok( true, "ajaxSuccess" ); - }); - - jQuery.ajax({ - url: url("data/name.html"), - beforeSend: function(){ ok(true, "beforeSend"); }, - complete: function(xhr) { - setTimeout (function() { - xhr - .complete(function(){ ok(true, "complete"); }) - .success(function(){ ok(true, "success"); }) - .error(function(){ ok(false, "error"); }) - .complete(function(){ start(); }); - },100); - } - }); - }, 13); -}); - -test("jQuery.ajax() - success callbacks (order)", function() { - expect( 1 ); - - jQuery.ajaxSetup({ timeout: 0 }); - - stop(); - - var testString = ""; - - setTimeout(function(){ - jQuery.ajax({ - url: url("data/name.html"), - success: function( _1 , _2 , xhr ) { - xhr.success(function() { - xhr.success(function() { - testString += "E"; - }); - testString += "D"; - }); - testString += "A"; - }, - complete: function() { - strictEqual(testString, "ABCDE", "Proper order"); - start(); - } - }).success(function() { - testString += "B"; - }).success(function() { - testString += "C"; - }); - }, 13); -}); - -test("jQuery.ajax() - error callbacks", function() { - expect( 8 ); - stop(); - - jQuery("#foo").ajaxStart(function(){ - ok( true, "ajaxStart" ); - }).ajaxStop(function(){ - ok( true, "ajaxStop" ); - start(); - }).ajaxSend(function(){ - ok( true, "ajaxSend" ); - }).ajaxComplete(function(){ - ok( true, "ajaxComplete" ); - }).ajaxError(function(){ - ok( true, "ajaxError" ); - }).ajaxSuccess(function(){ - ok( false, "ajaxSuccess" ); - }); - - jQuery.ajaxSetup({ timeout: 500 }); - - jQuery.ajax({ - url: url("data/name.php?wait=5"), - beforeSend: function(){ ok(true, "beforeSend"); }, - success: function(){ ok(false, "success"); }, - error: function(){ ok(true, "error"); }, - complete: function(){ ok(true, "complete"); } - }); -}); - -test( "jQuery.ajax - multiple method signatures introduced in 1.5 ( #8107)", function() { - - expect( 4 ); - - stop(); - - jQuery.when( - jQuery.ajax().success(function() { ok( true, "With no arguments" ); }), - jQuery.ajax("data/name.html").success(function() { ok( true, "With only string URL argument" ); }), - jQuery.ajax("data/name.html", {} ).success(function() { ok( true, "With string URL param and map" ); }), - jQuery.ajax({ url: "data/name.html"} ).success(function() { ok( true, "With only map" ); }) - ).always(function() { - start(); - }); - -}); - -test("jQuery.ajax() - textStatus and errorThrown values", function() { - - var nb = 2; - - expect( 2 * nb ); - stop(); - - function startN() { - if ( !( --nb ) ) { - start(); - } - } - - /* - Safari 3.x returns "OK" instead of "Not Found" - Safari 4.x doesn't have this issue so the test should be re-instated once - we drop support for 3.x - - jQuery.ajax({ - url: url("data/nonExistingURL"), - error: function( _ , textStatus , errorThrown ){ - strictEqual( textStatus, "error", "textStatus is 'error' for 404" ); - strictEqual( errorThrown, "Not Found", "errorThrown is 'Not Found' for 404"); - startN(); - } - }); - */ - - jQuery.ajax({ - url: url("data/name.php?wait=5"), - error: function( _ , textStatus , errorThrown ){ - strictEqual( textStatus, "abort", "textStatus is 'abort' for abort" ); - strictEqual( errorThrown, "abort", "errorThrown is 'abort' for abort"); - startN(); - } - }).abort(); - - jQuery.ajax({ - url: url("data/name.php?wait=5"), - error: function( _ , textStatus , errorThrown ){ - strictEqual( textStatus, "mystatus", "textStatus is 'mystatus' for abort('mystatus')" ); - strictEqual( errorThrown, "mystatus", "errorThrown is 'mystatus' for abort('mystatus')"); - startN(); - } - }).abort( "mystatus" ); -}); - -test("jQuery.ajax() - responseText on error", function() { - - expect( 1 ); - - stop(); - - jQuery.ajax({ - url: url("data/errorWithText.php"), - error: function(xhr) { - strictEqual( xhr.responseText , "plain text message" , "Test jqXHR.responseText is filled for HTTP errors" ); - }, - complete: function() { - start(); - } - }); -}); - -test(".ajax() - retry with jQuery.ajax( this )", function() { - - expect( 2 ); - - stop(); - - var firstTime = true, - previousUrl; - - jQuery.ajax({ - url: url("data/errorWithText.php"), - error: function() { - if ( firstTime ) { - firstTime = false; - jQuery.ajax( this ); - } else { - ok( true , "Test retrying with jQuery.ajax(this) works" ); - jQuery.ajax({ - url: url("data/errorWithText.php"), - data: { x: 1 }, - beforeSend: function() { - if ( !previousUrl ) { - previousUrl = this.url; - } else { - strictEqual( this.url , previousUrl, "url parameters are not re-appended" ); - start(); - return false; - } - }, - error: function() { - jQuery.ajax( this ); - } - }); - } - } - }); -}); - -test(".ajax() - headers" , function() { - - expect( 4 ); - - stop(); - - jQuery("#foo").ajaxSend(function( evt, xhr ) { - xhr.setRequestHeader( "ajax-send", "test" ); - }); - - var requestHeaders = { - siMPle: "value", - "SometHing-elsE": "other value", - OthEr: "something else" - }, - list = [], - i; - - for( i in requestHeaders ) { - list.push( i ); - } - list.push( "ajax-send" ); - - jQuery.ajax(url("data/headers.php?keys="+list.join( "_" ) ), { - - headers: requestHeaders, - success: function( data , _ , xhr ) { - var tmp = []; - for ( i in requestHeaders ) { - tmp.push( i , ": " , requestHeaders[ i ] , "\n" ); - } - tmp.push( "ajax-send: test\n" ); - tmp = tmp.join( "" ); - - strictEqual( data , tmp , "Headers were sent" ); - strictEqual( xhr.getResponseHeader( "Sample-Header" ) , "Hello World" , "Sample header received" ); - if ( jQuery.browser.mozilla ) { - ok( true, "Firefox doesn't support empty headers" ); - } else { - strictEqual( xhr.getResponseHeader( "Empty-Header" ) , "" , "Empty header received" ); - } - strictEqual( xhr.getResponseHeader( "Sample-Header2" ) , "Hello World 2" , "Second sample header received" ); - }, - error: function(){ ok(false, "error"); } - - }).always(function() { - start(); - }); - -}); - -test(".ajax() - Accept header" , function() { - - expect( 1 ); - - stop(); - - jQuery.ajax(url("data/headers.php?keys=accept"), { - headers: { - Accept: "very wrong accept value" - }, - beforeSend: function( xhr ) { - xhr.setRequestHeader( "Accept", "*/*" ); - }, - success: function( data ) { - strictEqual( data , "accept: */*\n" , "Test Accept header is set to last value provided" ); - start(); - }, - error: function(){ ok(false, "error"); } - }); - -}); - -test(".ajax() - contentType" , function() { - - expect( 2 ); - - stop(); - - var count = 2; - - function restart() { - if ( ! --count ) { - start(); - } - } - - jQuery.ajax(url("data/headers.php?keys=content-type" ), { - contentType: "test", - success: function( data ) { - strictEqual( data , "content-type: test\n" , "Test content-type is sent when options.contentType is set" ); - }, - complete: function() { - restart(); - } - }); - - jQuery.ajax(url("data/headers.php?keys=content-type" ), { - contentType: false, - success: function( data ) { - strictEqual( data , "content-type: \n" , "Test content-type is not sent when options.contentType===false" ); - }, - complete: function() { - restart(); - } - }); - -}); - -test(".ajax() - protocol-less urls", function() { - expect(1); - - jQuery.ajax({ - url: "//somedomain.com", - beforeSend: function( xhr, settings ) { - equals(settings.url, location.protocol + "//somedomain.com", "Make sure that the protocol is added."); - return false; - } - }); -}); - -test(".ajax() - hash", function() { - expect(3); - - jQuery.ajax({ - url: "data/name.html#foo", - beforeSend: function( xhr, settings ) { - equals(settings.url, "data/name.html", "Make sure that the URL is trimmed."); - return false; - } - }); - - jQuery.ajax({ - url: "data/name.html?abc#foo", - beforeSend: function( xhr, settings ) { - equals(settings.url, "data/name.html?abc", "Make sure that the URL is trimmed."); - return false; - } - }); - - jQuery.ajax({ - url: "data/name.html?abc#foo", - data: { "test": 123 }, - beforeSend: function( xhr, settings ) { - equals(settings.url, "data/name.html?abc&test=123", "Make sure that the URL is trimmed."); - return false; - } - }); -}); - -test("jQuery ajax - cross-domain detection", function() { - - expect( 6 ); - - var loc = document.location, - otherPort = loc.port === 666 ? 667 : 666, - otherProtocol = loc.protocol === "http:" ? "https:" : "http:"; - - jQuery.ajax({ - dataType: "jsonp", - url: otherProtocol + "//" + loc.host, - beforeSend: function( _ , s ) { - ok( s.crossDomain , "Test different protocols are detected as cross-domain" ); - return false; - } - }); - - jQuery.ajax({ - dataType: "jsonp", - url: "app:/path", - beforeSend: function( _ , s ) { - ok( s.crossDomain , "Adobe AIR app:/ URL detected as cross-domain" ); - return false; - } - }); - - jQuery.ajax({ - dataType: "jsonp", - url: loc.protocol + "//somewebsitethatdoesnotexist-656329477541.com:" + ( loc.port || 80 ), - beforeSend: function( _ , s ) { - ok( s.crossDomain , "Test different hostnames are detected as cross-domain" ); - return false; - } - }); - - jQuery.ajax({ - dataType: "jsonp", - url: loc.protocol + "//" + loc.hostname + ":" + otherPort, - beforeSend: function( _ , s ) { - ok( s.crossDomain , "Test different ports are detected as cross-domain" ); - return false; - } - }); - - jQuery.ajax({ - dataType: "jsonp", - url: "about:blank", - beforeSend: function( _ , s ) { - ok( s.crossDomain , "Test about:blank is detected as cross-domain" ); - return false; - } - }); - - jQuery.ajax({ - dataType: "jsonp", - url: loc.protocol + "//" + loc.host, - crossDomain: true, - beforeSend: function( _ , s ) { - ok( s.crossDomain , "Test forced crossDomain is detected as cross-domain" ); - return false; - } - }); - -}); - -test(".load() - 404 error callbacks", function() { - expect( 6 ); - stop(); - - jQuery("#foo").ajaxStart(function(){ - ok( true, "ajaxStart" ); - }).ajaxStop(function(){ - ok( true, "ajaxStop" ); - start(); - }).ajaxSend(function(){ - ok( true, "ajaxSend" ); - }).ajaxComplete(function(){ - ok( true, "ajaxComplete" ); - }).ajaxError(function(){ - ok( true, "ajaxError" ); - }).ajaxSuccess(function(){ - ok( false, "ajaxSuccess" ); - }); - - jQuery("
    ").load("data/404.html", function(){ - ok(true, "complete"); - }); -}); - -test("jQuery.ajax() - abort", function() { - expect( 8 ); - stop(); - - jQuery("#foo").ajaxStart(function(){ - ok( true, "ajaxStart" ); - }).ajaxStop(function(){ - ok( true, "ajaxStop" ); - start(); - }).ajaxSend(function(){ - ok( true, "ajaxSend" ); - }).ajaxComplete(function(){ - ok( true, "ajaxComplete" ); - }); - - var xhr = jQuery.ajax({ - url: url("data/name.php?wait=5"), - beforeSend: function(){ ok(true, "beforeSend"); }, - complete: function(){ ok(true, "complete"); } - }); - - equals( xhr.readyState, 1, "XHR readyState indicates successful dispatch" ); - - xhr.abort(); - equals( xhr.readyState, 0, "XHR readyState indicates successful abortion" ); -}); - -test("Ajax events with context", function() { - expect(14); - - stop(); - var context = document.createElement("div"); - - function event(e){ - equals( this, context, e.type ); - } - - function callback(msg){ - return function(){ - equals( this, context, "context is preserved on callback " + msg ); - }; - } - - function nocallback(msg){ - return function(){ - equals( typeof this.url, "string", "context is settings on callback " + msg ); - }; - } - - jQuery("#foo").add(context) - .ajaxSend(event) - .ajaxComplete(event) - .ajaxError(event) - .ajaxSuccess(event); - - jQuery.ajax({ - url: url("data/name.html"), - beforeSend: callback("beforeSend"), - success: callback("success"), - error: callback("error"), - complete:function(){ - callback("complete").call(this); - - jQuery.ajax({ - url: url("data/404.html"), - context: context, - beforeSend: callback("beforeSend"), - error: callback("error"), - complete: function(){ - callback("complete").call(this); - - jQuery("#foo").add(context).unbind(); - - jQuery.ajax({ - url: url("data/404.html"), - beforeSend: nocallback("beforeSend"), - error: nocallback("error"), - complete: function(){ - nocallback("complete").call(this); - start(); - } - }); - } - }); - }, - context:context - }); -}); - -test("jQuery.ajax context modification", function() { - expect(1); - - stop(); - - var obj = {}; - - jQuery.ajax({ - url: url("data/name.html"), - context: obj, - beforeSend: function(){ - this.test = "foo"; - }, - complete: function() { - start(); - } - }); - - equals( obj.test, "foo", "Make sure the original object is maintained." ); -}); - -test("jQuery.ajax context modification through ajaxSetup", function() { - expect(4); - - stop(); - - var obj = {}; - - jQuery.ajaxSetup({ - context: obj - }); - - strictEqual( jQuery.ajaxSettings.context, obj, "Make sure the context is properly set in ajaxSettings." ); - - jQuery.ajax({ - url: url("data/name.html"), - complete: function() { - strictEqual( this, obj, "Make sure the original object is maintained." ); - jQuery.ajax({ - url: url("data/name.html"), - context: {}, - complete: function() { - ok( this !== obj, "Make sure overidding context is possible." ); - jQuery.ajaxSetup({ - context: false - }); - jQuery.ajax({ - url: url("data/name.html"), - beforeSend: function(){ - this.test = "foo2"; - }, - complete: function() { - ok( this !== obj, "Make sure unsetting context is possible." ); - start(); - } - }); - } - }); - } - }); -}); - -test("jQuery.ajax() - disabled globals", function() { - expect( 3 ); - stop(); - - jQuery("#foo").ajaxStart(function(){ - ok( false, "ajaxStart" ); - }).ajaxStop(function(){ - ok( false, "ajaxStop" ); - }).ajaxSend(function(){ - ok( false, "ajaxSend" ); - }).ajaxComplete(function(){ - ok( false, "ajaxComplete" ); - }).ajaxError(function(){ - ok( false, "ajaxError" ); - }).ajaxSuccess(function(){ - ok( false, "ajaxSuccess" ); - }); - - jQuery.ajax({ - global: false, - url: url("data/name.html"), - beforeSend: function(){ ok(true, "beforeSend"); }, - success: function(){ ok(true, "success"); }, - error: function(){ ok(false, "error"); }, - complete: function(){ - ok(true, "complete"); - setTimeout(function(){ start(); }, 13); - } - }); -}); - -test("jQuery.ajax - xml: non-namespace elements inside namespaced elements", function() { - expect(3); - stop(); - jQuery.ajax({ - url: url("data/with_fries.xml"), - dataType: "xml", - success: function(resp) { - equals( jQuery("properties", resp).length, 1, "properties in responseXML" ); - equals( jQuery("jsconf", resp).length, 1, "jsconf in responseXML" ); - equals( jQuery("thing", resp).length, 2, "things in responseXML" ); - start(); - } - }); -}); - -test("jQuery.ajax - xml: non-namespace elements inside namespaced elements (over JSONP)", function() { - expect(3); - stop(); - jQuery.ajax({ - url: url("data/with_fries_over_jsonp.php"), - dataType: "jsonp xml", - success: function(resp) { - equals( jQuery("properties", resp).length, 1, "properties in responseXML" ); - equals( jQuery("jsconf", resp).length, 1, "jsconf in responseXML" ); - equals( jQuery("thing", resp).length, 2, "things in responseXML" ); - start(); - }, - error: function(_1,_2,error) { - ok( false, error ); - start(); - } - }); -}); - -test("jQuery.ajax - HEAD requests", function() { - expect(2); - - stop(); - jQuery.ajax({ - url: url("data/name.html"), - type: "HEAD", - success: function(data, status, xhr){ - var h = xhr.getAllResponseHeaders(); - ok( /Date/i.test(h), "No Date in HEAD response" ); - - jQuery.ajax({ - url: url("data/name.html"), - data: { whip_it: "good" }, - type: "HEAD", - success: function(data, status, xhr){ - var h = xhr.getAllResponseHeaders(); - ok( /Date/i.test(h), "No Date in HEAD response with data" ); - start(); - } - }); - } - }); - -}); - -test("jQuery.ajax - beforeSend", function() { - expect(1); - stop(); - - var check = false; - - jQuery.ajaxSetup({ timeout: 0 }); - - jQuery.ajax({ - url: url("data/name.html"), - beforeSend: function(xml) { - check = true; - }, - success: function(data) { - ok( check, "check beforeSend was executed" ); - start(); - } - }); -}); - -test("jQuery.ajax - beforeSend, cancel request (#2688)", function() { - expect(2); - var request = jQuery.ajax({ - url: url("data/name.html"), - beforeSend: function() { - ok( true, "beforeSend got called, canceling" ); - return false; - }, - success: function() { - ok( false, "request didn't get canceled" ); - }, - complete: function() { - ok( false, "request didn't get canceled" ); - }, - error: function() { - ok( false, "request didn't get canceled" ); - } - }); - ok( request === false, "canceled request must return false instead of XMLHttpRequest instance" ); -}); - -test("jQuery.ajax - beforeSend, cancel request manually", function() { - expect(2); - var request = jQuery.ajax({ - url: url("data/name.html"), - beforeSend: function(xhr) { - ok( true, "beforeSend got called, canceling" ); - xhr.abort(); - }, - success: function() { - ok( false, "request didn't get canceled" ); - }, - complete: function() { - ok( false, "request didn't get canceled" ); - }, - error: function() { - ok( false, "request didn't get canceled" ); - } - }); - ok( request === false, "canceled request must return false instead of XMLHttpRequest instance" ); -}); - -window.foobar = null; -window.testFoo = undefined; - -test("jQuery.ajax - dataType html", function() { - expect(5); - stop(); - - var verifyEvaluation = function() { - equals( testFoo, "foo", "Check if script was evaluated for datatype html" ); - equals( foobar, "bar", "Check if script src was evaluated for datatype html" ); - - start(); - }; - - jQuery.ajax({ - dataType: "html", - url: url("data/test.html"), - success: function(data) { - jQuery("#ap").html(data); - ok( data.match(/^html text/), "Check content for datatype html" ); - setTimeout(verifyEvaluation, 600); - } - }); -}); - -test("serialize()", function() { - expect(5); - - // Add html5 elements only for serialize because selector can't yet find them on non-html5 browsers - jQuery("#search").after( - ""+ - "" - ); - - equals( jQuery("#form").serialize(), - "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3", - "Check form serialization as query string"); - - equals( jQuery("#form :input").serialize(), - "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3", - "Check input serialization as query string"); - - equals( jQuery("#testForm").serialize(), - "T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=", - "Check form serialization as query string"); - - equals( jQuery("#testForm :input").serialize(), - "T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=", - "Check input serialization as query string"); - - equals( jQuery("#form, #testForm").serialize(), - "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=", - "Multiple form serialization as query string"); - - /* Temporarily disabled. Opera 10 has problems with form serialization. - equals( jQuery("#form, #testForm :input").serialize(), - "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=", - "Mixed form/input serialization as query string"); - */ - jQuery("#html5email, #html5number").remove(); -}); - -test("jQuery.param()", function() { - expect(21); - - equals( !jQuery.ajaxSettings.traditional, true, "traditional flag, falsy by default" ); - - var params = {foo:"bar", baz:42, quux:"All your base are belong to us"}; - equals( jQuery.param(params), "foo=bar&baz=42&quux=All+your+base+are+belong+to+us", "simple" ); - - params = {someName: [1, 2, 3], regularThing: "blah" }; - equals( jQuery.param(params), "someName%5B%5D=1&someName%5B%5D=2&someName%5B%5D=3®ularThing=blah", "with array" ); - - params = {foo: ["a", "b", "c"]}; - equals( jQuery.param(params), "foo%5B%5D=a&foo%5B%5D=b&foo%5B%5D=c", "with array of strings" ); - - params = {foo: ["baz", 42, "All your base are belong to us"] }; - equals( jQuery.param(params), "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All+your+base+are+belong+to+us", "more array" ); - - params = {foo: { bar: "baz", beep: 42, quux: "All your base are belong to us" } }; - equals( jQuery.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" ); - - params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" }; - equals( decodeURIComponent( jQuery.param(params) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=undefined&i[]=10&i[]=11&j=true&k=false&l[]=undefined&l[]=0&m=cowboy+hat?", "huge structure" ); - - params = { a: [ 0, [ 1, 2 ], [ 3, [ 4, 5 ], [ 6 ] ], { b: [ 7, [ 8, 9 ], [ { c: 10, d: 11 } ], [ [ 12 ] ], [ [ [ 13 ] ] ], { e: { f: { g: [ 14, [ 15 ] ] } } }, 16 ] }, 17 ] }; - equals( decodeURIComponent( jQuery.param(params) ), "a[]=0&a[1][]=1&a[1][]=2&a[2][]=3&a[2][1][]=4&a[2][1][]=5&a[2][2][]=6&a[3][b][]=7&a[3][b][1][]=8&a[3][b][1][]=9&a[3][b][2][0][c]=10&a[3][b][2][0][d]=11&a[3][b][3][0][]=12&a[3][b][4][0][0][]=13&a[3][b][5][e][f][g][]=14&a[3][b][5][e][f][g][1][]=15&a[3][b][]=16&a[]=17", "nested arrays" ); - - params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" }; - equals( jQuery.param(params,true), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=undefined&l=0&m=cowboy+hat%3F", "huge structure, forced traditional" ); - - equals( decodeURIComponent( jQuery.param({ a: [1,2,3], "b[]": [4,5,6], "c[d]": [7,8,9], e: { f: [10], g: [11,12], h: 13 } }) ), "a[]=1&a[]=2&a[]=3&b[]=4&b[]=5&b[]=6&c[d][]=7&c[d][]=8&c[d][]=9&e[f][]=10&e[g][]=11&e[g][]=12&e[h]=13", "Make sure params are not double-encoded." ); - - // #7945 - equals( jQuery.param({"jquery": "1.4.2"}), "jquery=1.4.2", "Check that object with a jQuery property get serialized correctly" ); - - jQuery.ajaxSetup({ traditional: true }); - - var params = {foo:"bar", baz:42, quux:"All your base are belong to us"}; - equals( jQuery.param(params), "foo=bar&baz=42&quux=All+your+base+are+belong+to+us", "simple" ); - - params = {someName: [1, 2, 3], regularThing: "blah" }; - equals( jQuery.param(params), "someName=1&someName=2&someName=3®ularThing=blah", "with array" ); - - params = {foo: ["a", "b", "c"]}; - equals( jQuery.param(params), "foo=a&foo=b&foo=c", "with array of strings" ); - - params = {"foo[]":["baz", 42, "All your base are belong to us"]}; - equals( jQuery.param(params), "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All+your+base+are+belong+to+us", "more array" ); - - params = {"foo[bar]":"baz", "foo[beep]":42, "foo[quux]":"All your base are belong to us"}; - equals( jQuery.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" ); - - params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" }; - equals( jQuery.param(params), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=undefined&l=0&m=cowboy+hat%3F", "huge structure" ); - - params = { a: [ 0, [ 1, 2 ], [ 3, [ 4, 5 ], [ 6 ] ], { b: [ 7, [ 8, 9 ], [ { c: 10, d: 11 } ], [ [ 12 ] ], [ [ [ 13 ] ] ], { e: { f: { g: [ 14, [ 15 ] ] } } }, 16 ] }, 17 ] }; - equals( jQuery.param(params), "a=0&a=1%2C2&a=3%2C4%2C5%2C6&a=%5Bobject+Object%5D&a=17", "nested arrays (not possible when jQuery.param.traditional == true)" ); - - params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" }; - equals( decodeURIComponent( jQuery.param(params,false) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=undefined&i[]=10&i[]=11&j=true&k=false&l[]=undefined&l[]=0&m=cowboy+hat?", "huge structure, forced not traditional" ); - - params = { param1: null }; - equals( jQuery.param(params,false), "param1=null", "Make sure that null params aren't traversed." ); - - params = {"test": {"length": 3, "foo": "bar"} }; - equals( jQuery.param( params, false ), "test%5Blength%5D=3&test%5Bfoo%5D=bar", "Sub-object with a length property" ); -}); - -test("synchronous request", function() { - expect(1); - ok( /^{ "data"/.test( jQuery.ajax({url: url("data/json_obj.js"), dataType: "text", async: false}).responseText ), "check returned text" ); -}); - -test("synchronous request with callbacks", function() { - expect(2); - var result; - jQuery.ajax({url: url("data/json_obj.js"), async: false, dataType: "text", success: function(data) { ok(true, "sucess callback executed"); result = data; } }); - ok( /^{ "data"/.test( result ), "check returned text" ); -}); - -test("pass-through request object", function() { - expect(8); - stop(); - - var target = "data/name.html"; - var successCount = 0; - var errorCount = 0; - var errorEx = ""; - var success = function() { - successCount++; - }; - jQuery("#foo").ajaxError(function (e, xml, s, ex) { - errorCount++; - errorEx += ": " + xml.status; - }); - jQuery("#foo").one("ajaxStop", function () { - equals(successCount, 5, "Check all ajax calls successful"); - equals(errorCount, 0, "Check no ajax errors (status" + errorEx + ")"); - jQuery("#foo").unbind("ajaxError"); - - start(); - }); - - ok( jQuery.get(url(target), success), "get" ); - ok( jQuery.post(url(target), success), "post" ); - ok( jQuery.getScript(url("data/test.js"), success), "script" ); - ok( jQuery.getJSON(url("data/json_obj.js"), success), "json" ); - ok( jQuery.ajax({url: url(target), success: success}), "generic" ); -}); - -test("ajax cache", function () { - expect(18); - - stop(); - - var count = 0; - - jQuery("#firstp").bind("ajaxSuccess", function (e, xml, s) { - var re = /_=(.*?)(&|$)/g; - var oldOne = null; - for (var i = 0; i < 6; i++) { - var ret = re.exec(s.url); - if (!ret) { - break; - } - oldOne = ret[1]; - } - equals(i, 1, "Test to make sure only one 'no-cache' parameter is there"); - ok(oldOne != "tobereplaced555", "Test to be sure parameter (if it was there) was replaced"); - if(++count == 6) - start(); - }); - - ok( jQuery.ajax({url: "data/text.php", cache:false}), "test with no parameters" ); - ok( jQuery.ajax({url: "data/text.php?pizza=true", cache:false}), "test with 1 parameter" ); - ok( jQuery.ajax({url: "data/text.php?_=tobereplaced555", cache:false}), "test with _= parameter" ); - ok( jQuery.ajax({url: "data/text.php?pizza=true&_=tobereplaced555", cache:false}), "test with 1 parameter plus _= one" ); - ok( jQuery.ajax({url: "data/text.php?_=tobereplaced555&tv=false", cache:false}), "test with 1 parameter plus _= one before it" ); - ok( jQuery.ajax({url: "data/text.php?name=David&_=tobereplaced555&washere=true", cache:false}), "test with 2 parameters surrounding _= one" ); -}); - -/* - * Test disabled. - * The assertions expect that the passed-in object will be modified, - * which shouldn't be the case. Fixes #5439. -test("global ajaxSettings", function() { - expect(2); - - var tmp = jQuery.extend({}, jQuery.ajaxSettings); - var orig = { url: "data/with_fries.xml" }; - var t; - - jQuery.ajaxSetup({ data: {foo: "bar", bar: "BAR"} }); - - t = jQuery.extend({}, orig); - t.data = {}; - jQuery.ajax(t); - ok( t.url.indexOf("foo") > -1 && t.url.indexOf("bar") > -1, "Check extending {}" ); - - t = jQuery.extend({}, orig); - t.data = { zoo: "a", ping: "b" }; - jQuery.ajax(t); - ok( t.url.indexOf("ping") > -1 && t.url.indexOf("zoo") > -1 && t.url.indexOf("foo") > -1 && t.url.indexOf("bar") > -1, "Check extending { zoo: "a", ping: "b" }" ); - - jQuery.ajaxSettings = tmp; -}); -*/ - -test("load(String)", function() { - expect(1); - stop(); // check if load can be called with only url - jQuery("#first").load("data/name.html", function() { - start(); - }); -}); - -test("load('url selector')", function() { - expect(1); - stop(); // check if load can be called with only url - jQuery("#first").load("data/test3.html div.user", function(){ - equals( jQuery(this).children("div").length, 2, "Verify that specific elements were injected" ); - start(); - }); -}); - -test("load(String, Function) with ajaxSetup on dataType json, see #2046", function() { - expect(1); - stop(); - jQuery.ajaxSetup({ dataType: "json" }); - jQuery("#first").ajaxComplete(function (e, xml, s) { - equals( s.dataType, "html", "Verify the load() dataType was html" ); - jQuery("#first").unbind("ajaxComplete"); - jQuery.ajaxSetup({ dataType: "" }); - start(); - }); - jQuery("#first").load("data/test3.html"); -}); - -test("load(String, Function) - simple: inject text into DOM", function() { - expect(2); - stop(); - jQuery("#first").load(url("data/name.html"), function() { - ok( /^ERROR/.test(jQuery("#first").text()), "Check if content was injected into the DOM" ); - start(); - }); -}); - -test("load(String, Function) - check scripts", function() { - expect(7); - stop(); - - var verifyEvaluation = function() { - equals( foobar, "bar", "Check if script src was evaluated after load" ); - equals( jQuery("#ap").html(), "bar", "Check if script evaluation has modified DOM"); - - start(); - }; - jQuery("#first").load(url("data/test.html"), function() { - ok( jQuery("#first").html().match(/^html text/), "Check content after loading html" ); - equals( jQuery("#foo").html(), "foo", "Check if script evaluation has modified DOM"); - equals( testFoo, "foo", "Check if script was evaluated after load" ); - setTimeout(verifyEvaluation, 600); - }); -}); - -test("load(String, Function) - check file with only a script tag", function() { - expect(3); - stop(); - - jQuery("#first").load(url("data/test2.html"), function() { - equals( jQuery("#foo").html(), "foo", "Check if script evaluation has modified DOM"); - equals( testFoo, "foo", "Check if script was evaluated after load" ); - - start(); - }); -}); - -test("load(String, Function) - dataFilter in ajaxSettings", function() { - expect(2); - stop(); - jQuery.ajaxSetup({ dataFilter: function() { return "Hello World"; } }); - var div = jQuery("
    ").load(url("data/name.html"), function(responseText) { - strictEqual( div.html(), "Hello World" , "Test div was filled with filtered data" ); - strictEqual( responseText, "Hello World" , "Test callback receives filtered data" ); - jQuery.ajaxSetup({ dataFilter: 0 }); - start(); - }); -}); - -test("load(String, Object, Function)", function() { - expect(2); - stop(); - - jQuery("
    ").load(url("data/params_html.php"), { foo: 3, bar: "ok" }, function() { - var $post = jQuery(this).find("#post"); - equals( $post.find("#foo").text(), "3", "Check if a hash of data is passed correctly"); - equals( $post.find("#bar").text(), "ok", "Check if a hash of data is passed correctly"); - start(); - }); -}); - -test("load(String, String, Function)", function() { - expect(2); - stop(); - - jQuery("
    ").load(url("data/params_html.php"), "foo=3&bar=ok", function() { - var $get = jQuery(this).find("#get"); - equals( $get.find("#foo").text(), "3", "Check if a string of data is passed correctly"); - equals( $get.find("#bar").text(), "ok", "Check if a of data is passed correctly"); - start(); - }); -}); - -test("jQuery.get(String, Function) - data in ajaxSettings (#8277)", function() { - expect(1); - stop(); - jQuery.ajaxSetup({ - data: "helloworld" - }); - jQuery.get(url("data/echoQuery.php"), function(data) { - ok( /helloworld$/.test( data ), "Data from ajaxSettings was used"); - jQuery.ajaxSetup({ - data: null - }); - start(); - }); -}); - -test("jQuery.get(String, Hash, Function) - parse xml and use text() on nodes", function() { - expect(2); - stop(); - jQuery.get(url("data/dashboard.xml"), function(xml) { - var content = []; - jQuery("tab", xml).each(function() { - content.push(jQuery(this).text()); - }); - equals( content[0], "blabla", "Check first tab"); - equals( content[1], "blublu", "Check second tab"); - start(); - }); -}); - -test("jQuery.getScript(String, Function) - with callback", function() { - expect(3); - stop(); - jQuery.getScript(url("data/test.js"), function( data, _, jqXHR ) { - equals( foobar, "bar", "Check if script was evaluated" ); - strictEqual( data, jqXHR.responseText, "Same-domain script requests returns the source of the script (#8082)" ); - setTimeout(start, 100); - }); -}); - -test("jQuery.getScript(String, Function) - no callback", function() { - expect(1); - stop(); - jQuery.getScript(url("data/test.js"), function(){ - start(); - }); -}); - -jQuery.each( [ "Same Domain", "Cross Domain" ] , function( crossDomain , label ) { - - test("jQuery.ajax() - JSONP, " + label, function() { - expect(20); - - var count = 0; - function plus(){ if ( ++count == 18 ) start(); } - - stop(); - - jQuery.ajax({ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - success: function(data){ - ok( data.data, "JSON results returned (GET, no callback)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, no callback)" ); - plus(); - } - }); - - jQuery.ajax({ - url: "data/jsonp.php?callback=?", - dataType: "jsonp", - crossDomain: crossDomain, - success: function(data){ - ok( data.data, "JSON results returned (GET, url callback)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, url callback)" ); - plus(); - } - }); - - jQuery.ajax({ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - data: "callback=?", - success: function(data){ - ok( data.data, "JSON results returned (GET, data callback)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, data callback)" ); - plus(); - } - }); - - jQuery.ajax({ - url: "data/jsonp.php?callback=??", - dataType: "jsonp", - crossDomain: crossDomain, - success: function(data){ - ok( data.data, "JSON results returned (GET, url context-free callback)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, url context-free callback)" ); - plus(); - } - }); - - jQuery.ajax({ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - data: "callback=??", - success: function(data){ - ok( data.data, "JSON results returned (GET, data context-free callback)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, data context-free callback)" ); - plus(); - } - }); - - jQuery.ajax({ - url: "data/jsonp.php/??", - dataType: "jsonp", - crossDomain: crossDomain, - success: function(data){ - ok( data.data, "JSON results returned (GET, REST-like)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, REST-like)" ); - plus(); - } - }); - - jQuery.ajax({ - url: "data/jsonp.php/???json=1", - dataType: "jsonp", - crossDomain: crossDomain, - success: function(data){ - strictEqual( jQuery.type(data), "array", "JSON results returned (GET, REST-like with param)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, REST-like with param)" ); - plus(); - } - }); - - jQuery.ajax({ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - jsonp: "callback", - success: function(data){ - ok( data.data, "JSON results returned (GET, data obj callback)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, data obj callback)" ); - plus(); - } - }); - - window.jsonpResults = function(data) { - ok( data.data, "JSON results returned (GET, custom callback function)" ); - window.jsonpResults = undefined; - plus(); - }; - - jQuery.ajax({ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - jsonpCallback: "jsonpResults", - success: function(data){ - ok( data.data, "JSON results returned (GET, custom callback name)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, custom callback name)" ); - plus(); - } - }); - - jQuery.ajax({ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - jsonpCallback: "functionToCleanUp", - success: function(data){ - ok( data.data, "JSON results returned (GET, custom callback name to be cleaned up)" ); - strictEqual( window.functionToCleanUp, undefined, "Callback was removed (GET, custom callback name to be cleaned up)" ); - plus(); - var xhr; - jQuery.ajax({ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - jsonpCallback: "functionToCleanUp", - beforeSend: function( jqXHR ) { - xhr = jqXHR; - return false; - } - }); - xhr.error(function() { - ok( true, "Ajax error JSON (GET, custom callback name to be cleaned up)" ); - strictEqual( window.functionToCleanUp, undefined, "Callback was removed after early abort (GET, custom callback name to be cleaned up)" ); - plus(); - }); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, custom callback name to be cleaned up)" ); - plus(); - } - }); - - jQuery.ajax({ - type: "POST", - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - success: function(data){ - ok( data.data, "JSON results returned (POST, no callback)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, data obj callback)" ); - plus(); - } - }); - - jQuery.ajax({ - type: "POST", - url: "data/jsonp.php", - data: "callback=?", - dataType: "jsonp", - crossDomain: crossDomain, - success: function(data){ - ok( data.data, "JSON results returned (POST, data callback)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (POST, data callback)" ); - plus(); - } - }); - - jQuery.ajax({ - type: "POST", - url: "data/jsonp.php", - jsonp: "callback", - dataType: "jsonp", - crossDomain: crossDomain, - success: function(data){ - ok( data.data, "JSON results returned (POST, data obj callback)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (POST, data obj callback)" ); - plus(); - } - }); - - //#7578 - jQuery.ajax({ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - beforeSend: function(){ - strictEqual( this.cache, false, "cache must be false on JSON request" ); - plus(); - return false; - } - }); - - jQuery.ajax({ - url: "data/jsonp.php?callback=XXX", - dataType: "jsonp", - jsonp: false, - jsonpCallback: "XXX", - crossDomain: crossDomain, - beforeSend: function() { - ok( /^data\/jsonp.php\?callback=XXX&_=\d+$/.test( this.url ) , - "The URL wasn't messed with (GET, custom callback name with no url manipulation)" ); - plus(); - }, - success: function(data){ - ok( data.data, "JSON results returned (GET, custom callback name with no url manipulation)" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, custom callback name with no url manipulation)" ); - plus(); - } - }); - - }); -}); - -test("jQuery.ajax() - script, Remote", function() { - expect(2); - - var base = window.location.href.replace(/[^\/]*$/, ""); - - stop(); - - jQuery.ajax({ - url: base + "data/test.js", - dataType: "script", - success: function(data){ - ok( foobar, "Script results returned (GET, no callback)" ); - start(); - } - }); -}); - -test("jQuery.ajax() - script, Remote with POST", function() { - expect(3); - - var base = window.location.href.replace(/[^\/]*$/, ""); - - stop(); - - jQuery.ajax({ - url: base + "data/test.js", - type: "POST", - dataType: "script", - success: function(data, status){ - ok( foobar, "Script results returned (POST, no callback)" ); - equals( status, "success", "Script results returned (POST, no callback)" ); - start(); - }, - error: function(xhr) { - ok( false, "ajax error, status code: " + xhr.status ); - start(); - } - }); -}); - -test("jQuery.ajax() - script, Remote with scheme-less URL", function() { - expect(2); - - var base = window.location.href.replace(/[^\/]*$/, ""); - base = base.replace(/^.*?\/\//, "//"); - - stop(); - - jQuery.ajax({ - url: base + "data/test.js", - dataType: "script", - success: function(data){ - ok( foobar, "Script results returned (GET, no callback)" ); - start(); - } - }); -}); - -test("jQuery.ajax() - malformed JSON", function() { - expect(2); - - stop(); - - jQuery.ajax({ - url: "data/badjson.js", - dataType: "json", - success: function(){ - ok( false, "Success." ); - start(); - }, - error: function(xhr, msg, detailedMsg) { - equals( "parsererror", msg, "A parse error occurred." ); - ok( /^(Invalid|SyntaxError|exception)/i.test(detailedMsg), "Detailed parsererror message provided" ); - start(); - } - }); -}); - -test("jQuery.ajax() - script by content-type", function() { - expect(2); - - stop(); - - jQuery.when( - - jQuery.ajax({ - url: "data/script.php", - data: { header: "script" } - }), - - jQuery.ajax({ - url: "data/script.php", - data: { header: "ecma" } - }) - - ).always(function() { - start(); - }); -}); - -test("jQuery.ajax() - json by content-type", function() { - expect(5); - - stop(); - - jQuery.ajax({ - url: "data/json.php", - data: { header: "json", json: "array" }, - success: function( json ) { - ok( json.length >= 2, "Check length"); - equals( json[0].name, "John", "Check JSON: first, name" ); - equals( json[0].age, 21, "Check JSON: first, age" ); - equals( json[1].name, "Peter", "Check JSON: second, name" ); - equals( json[1].age, 25, "Check JSON: second, age" ); - start(); - } - }); -}); - -test("jQuery.ajax() - json by content-type disabled with options", function() { - expect(6); - - stop(); - - jQuery.ajax({ - url: url("data/json.php"), - data: { header: "json", json: "array" }, - contents: { - json: false - }, - success: function( text ) { - equals( typeof text , "string" , "json wasn't auto-determined" ); - var json = jQuery.parseJSON( text ); - ok( json.length >= 2, "Check length"); - equals( json[0].name, "John", "Check JSON: first, name" ); - equals( json[0].age, 21, "Check JSON: first, age" ); - equals( json[1].name, "Peter", "Check JSON: second, name" ); - equals( json[1].age, 25, "Check JSON: second, age" ); - start(); - } - }); -}); - -test("jQuery.getJSON(String, Hash, Function) - JSON array", function() { - expect(5); - stop(); - jQuery.getJSON(url("data/json.php"), {json: "array"}, function(json) { - ok( json.length >= 2, "Check length"); - equals( json[0].name, "John", "Check JSON: first, name" ); - equals( json[0].age, 21, "Check JSON: first, age" ); - equals( json[1].name, "Peter", "Check JSON: second, name" ); - equals( json[1].age, 25, "Check JSON: second, age" ); - start(); - }); -}); - -test("jQuery.getJSON(String, Function) - JSON object", function() { - expect(2); - stop(); - jQuery.getJSON(url("data/json.php"), function(json) { - if (json && json.data) { - equals( json.data.lang, "en", "Check JSON: lang" ); - equals( json.data.length, 25, "Check JSON: length" ); - } - start(); - }); -}); - -test("jQuery.getJSON - Using Native JSON", function() { - expect(2); - - var old = window.JSON; - JSON = { - parse: function(str){ - ok( true, "Verifying that parse method was run" ); - return true; - } - }; - - stop(); - jQuery.getJSON(url("data/json.php"), function(json) { - window.JSON = old; - equals( json, true, "Verifying return value" ); - start(); - }); -}); - -test("jQuery.getJSON(String, Function) - JSON object with absolute url to local content", function() { - expect(2); - - var base = window.location.href.replace(/[^\/]*$/, ""); - - stop(); - jQuery.getJSON(url(base + "data/json.php"), function(json) { - equals( json.data.lang, "en", "Check JSON: lang" ); - equals( json.data.length, 25, "Check JSON: length" ); - start(); - }); -}); - -test("jQuery.post - data", 3, function() { - stop(); - - jQuery.when( - jQuery.post( url( "data/name.php" ), { xml: "5-2", length: 3 }, function( xml ) { - jQuery( "math", xml ).each(function() { - equals( jQuery( "calculation", this ).text(), "5-2", "Check for XML" ); - equals( jQuery( "result", this ).text(), "3", "Check for XML" ); - }); - }), - - jQuery.ajax({ - url: url("data/echoData.php"), - type: "POST", - data: { - "test": { - "length": 7, - "foo": "bar" - } - }, - success: function( data ) { - strictEqual( data, "test%5Blength%5D=7&test%5Bfoo%5D=bar", "Check if a sub-object with a length param is serialized correctly"); - } - }) - ).always(function() { - start(); - }); - -}); - -test("jQuery.post(String, Hash, Function) - simple with xml", function() { - expect(4); - stop(); - var done = 0; - - jQuery.post(url("data/name.php"), {xml: "5-2"}, function(xml){ - jQuery("math", xml).each(function() { - equals( jQuery("calculation", this).text(), "5-2", "Check for XML" ); - equals( jQuery("result", this).text(), "3", "Check for XML" ); - }); - if ( ++done === 2 ) start(); - }); - - jQuery.post(url("data/name.php?xml=5-2"), {}, function(xml){ - jQuery("math", xml).each(function() { - equals( jQuery("calculation", this).text(), "5-2", "Check for XML" ); - equals( jQuery("result", this).text(), "3", "Check for XML" ); - }); - if ( ++done === 2 ) start(); - }); -}); - -test("jQuery.ajaxSetup({timeout: Number}) - with global timeout", function() { - stop(); - - var passed = 0; - - jQuery.ajaxSetup({timeout: 1000}); - - var pass = function() { - passed++; - if ( passed == 2 ) { - ok( true, "Check local and global callbacks after timeout" ); - jQuery("#qunit-fixture").unbind("ajaxError"); - start(); - } - }; - - var fail = function(a,b,c) { - ok( false, "Check for timeout failed " + a + " " + b ); - start(); - }; - - jQuery("#qunit-fixture").ajaxError(pass); - - jQuery.ajax({ - type: "GET", - url: url("data/name.php?wait=5"), - error: pass, - success: fail - }); - - // reset timeout - jQuery.ajaxSetup({timeout: 0}); -}); - -test("jQuery.ajaxSetup({timeout: Number}) with localtimeout", function() { - stop(); - jQuery.ajaxSetup({timeout: 50}); - - jQuery.ajax({ - type: "GET", - timeout: 15000, - url: url("data/name.php?wait=1"), - error: function() { - ok( false, "Check for local timeout failed" ); - start(); - }, - success: function() { - ok( true, "Check for local timeout" ); - start(); - } - }); - - // reset timeout - jQuery.ajaxSetup({timeout: 0}); -}); - -test("jQuery.ajax - simple get", function() { - expect(1); - stop(); - jQuery.ajax({ - type: "GET", - url: url("data/name.php?name=foo"), - success: function(msg){ - equals( msg, "bar", "Check for GET" ); - start(); - } - }); -}); - -test("jQuery.ajax - simple post", function() { - expect(1); - stop(); - jQuery.ajax({ - type: "POST", - url: url("data/name.php"), - data: "name=peter", - success: function(msg){ - equals( msg, "pan", "Check for POST" ); - start(); - } - }); -}); - -test("ajaxSetup()", function() { - expect(1); - stop(); - jQuery.ajaxSetup({ - url: url("data/name.php?name=foo"), - success: function(msg){ - equals( msg, "bar", "Check for GET" ); - start(); - } - }); - jQuery.ajax(); -}); - -/* -test("custom timeout does not set error message when timeout occurs, see #970", function() { - stop(); - jQuery.ajax({ - url: "data/name.php?wait=1", - timeout: 500, - error: function(request, status) { - ok( status != null, "status shouldn't be null in error handler" ); - equals( "timeout", status ); - start(); - } - }); -}); -*/ - -test("data option: evaluate function values (#2806)", function() { - stop(); - jQuery.ajax({ - url: "data/echoQuery.php", - data: { - key: function() { - return "value"; - } - }, - success: function(result) { - equals( result, "key=value" ); - start(); - } - }); -}); - -test("data option: empty bodies for non-GET requests", function() { - stop(); - jQuery.ajax({ - url: "data/echoData.php", - data: undefined, - type: "post", - success: function(result) { - equals( result, "" ); - start(); - } - }); -}); - -var ifModifiedNow = new Date(); - -jQuery.each( { " (cache)": true, " (no cache)": false }, function( label, cache ) { - - test("jQuery.ajax - If-Modified-Since support" + label, function() { - expect( 3 ); - - stop(); - - var url = "data/if_modified_since.php?ts=" + ifModifiedNow++; - - jQuery.ajax({ - url: url, - ifModified: true, - cache: cache, - success: function(data, status) { - equals(status, "success" ); - - jQuery.ajax({ - url: url, - ifModified: true, - cache: cache, - success: function(data, status) { - if ( data === "FAIL" ) { - ok(jQuery.browser.opera, "Opera is incapable of doing .setRequestHeader('If-Modified-Since')."); - ok(jQuery.browser.opera, "Opera is incapable of doing .setRequestHeader('If-Modified-Since')."); - } else { - equals(status, "notmodified"); - ok(data == null, "response body should be empty"); - } - start(); - }, - error: function() { - // Do this because opera simply refuses to implement 304 handling :( - // A feature-driven way of detecting this would be appreciated - // See: http://gist.github.com/599419 - ok(jQuery.browser.opera, "error"); - ok(jQuery.browser.opera, "error"); - start(); - } - }); - }, - error: function() { - equals(false, "error"); - // Do this because opera simply refuses to implement 304 handling :( - // A feature-driven way of detecting this would be appreciated - // See: http://gist.github.com/599419 - ok(jQuery.browser.opera, "error"); - start(); - } - }); - }); - - test("jQuery.ajax - Etag support" + label, function() { - expect( 3 ); - - stop(); - - var url = "data/etag.php?ts=" + ifModifiedNow++; - - jQuery.ajax({ - url: url, - ifModified: true, - cache: cache, - success: function(data, status) { - equals(status, "success" ); - - jQuery.ajax({ - url: url, - ifModified: true, - cache: cache, - success: function(data, status) { - if ( data === "FAIL" ) { - ok(jQuery.browser.opera, "Opera is incapable of doing .setRequestHeader('If-None-Match')."); - ok(jQuery.browser.opera, "Opera is incapable of doing .setRequestHeader('If-None-Match')."); - } else { - equals(status, "notmodified"); - ok(data == null, "response body should be empty"); - } - start(); - }, - error: function() { - // Do this because opera simply refuses to implement 304 handling :( - // A feature-driven way of detecting this would be appreciated - // See: http://gist.github.com/599419 - ok(jQuery.browser.opera, "error"); - ok(jQuery.browser.opera, "error"); - start(); - } - }); - }, - error: function() { - // Do this because opera simply refuses to implement 304 handling :( - // A feature-driven way of detecting this would be appreciated - // See: http://gist.github.com/599419 - ok(jQuery.browser.opera, "error"); - start(); - } - }); - }); -}); - -test("jQuery ajax - failing cross-domain", function() { - - expect( 2 ); - - stop(); - - var i = 2; - - jQuery.ajax({ - url: "http://somewebsitethatdoesnotexist-67864863574657654.com", - success: function(){ ok( false , "success" ); }, - error: function(xhr,_,e){ ok( true , "file not found: " + xhr.status + " => " + e ); }, - complete: function() { if ( ! --i ) start(); } - }); - - jQuery.ajax({ - url: "http://www.google.com", - success: function(){ ok( false , "success" ); }, - error: function(xhr,_,e){ ok( true , "access denied: " + xhr.status + " => " + e ); }, - complete: function() { if ( ! --i ) start(); } - }); - -}); - -test("jQuery ajax - atom+xml", function() { - - stop(); - - jQuery.ajax({ - url: url( "data/atom+xml.php" ), - success: function(){ ok( true , "success" ); }, - error: function(){ ok( false , "error" ); }, - complete: function() { start(); } - }); - -}); - -test( "jQuery.ajax - Location object as url (#7531)", 1, function () { - var success = false; - try { - var xhr = jQuery.ajax({ url: window.location }); - success = true; - xhr.abort(); - } catch (e) {} - - ok( success, "document.location did not generate exception" ); -}); - -test( "jQuery.ajax - Context with circular references (#9887)", 2, function () { - var success = false, - context = {}; - context.field = context; - try { - success = !jQuery.ajax( "non-existing", { - context: context, - beforeSend: function() { - ok( this === context, "context was not deep extended" ); - return false; - } - }); - } catch (e) { console.log( e ); } - ok( success, "context with circular reference did not generate an exception" ); -}); - -test( "jQuery.ajax - statusText" , 4, function() { - stop(); - jQuery.ajax( url( "data/statusText.php?status=200&text=Hello" ) ).done(function( _, statusText, jqXHR ) { - strictEqual( statusText, "success", "callback status text ok for success" ); - ok( jqXHR.statusText === "Hello" || jQuery.browser.safari && jqXHR.statusText === "OK", "jqXHR status text ok for success (" + jqXHR.statusText + ")" ); - jQuery.ajax( url( "data/statusText.php?status=404&text=World" ) ).fail(function( jqXHR, statusText ) { - strictEqual( statusText, "error", "callback status text ok for error" ); - ok( jqXHR.statusText === "World" || jQuery.browser.safari && jqXHR.statusText === "Not Found", "jqXHR status text ok for error (" + jqXHR.statusText + ")" ); - start(); - }); - }); -}); - -test( "jQuery.ajax - statusCode" , function() { - - var count = 12; - - expect( 20 ); - stop(); - - function countComplete() { - if ( ! --count ) { - start(); - } - } - - function createStatusCodes( name , isSuccess ) { - name = "Test " + name + " " + ( isSuccess ? "success" : "error" ); - return { - 200: function() { - ok( isSuccess , name ); - }, - 404: function() { - ok( ! isSuccess , name ); - } - }; - } - - jQuery.each( { - "data/name.html": true, - "data/someFileThatDoesNotExist.html": false - } , function( uri , isSuccess ) { - - jQuery.ajax( url( uri ) , { - statusCode: createStatusCodes( "in options" , isSuccess ), - complete: countComplete - }); - - jQuery.ajax( url( uri ) , { - complete: countComplete - }).statusCode( createStatusCodes( "immediately with method" , isSuccess ) ); - - jQuery.ajax( url( uri ) , { - complete: function(jqXHR) { - jqXHR.statusCode( createStatusCodes( "on complete" , isSuccess ) ); - countComplete(); - } - }); - - jQuery.ajax( url( uri ) , { - complete: function(jqXHR) { - setTimeout(function() { - jqXHR.statusCode( createStatusCodes( "very late binding" , isSuccess ) ); - countComplete(); - } , 100 ); - } - }); - - jQuery.ajax( url( uri ) , { - statusCode: createStatusCodes( "all (options)" , isSuccess ), - complete: function(jqXHR) { - jqXHR.statusCode( createStatusCodes( "all (on complete)" , isSuccess ) ); - setTimeout(function() { - jqXHR.statusCode( createStatusCodes( "all (very late binding)" , isSuccess ) ); - countComplete(); - } , 100 ); - } - }).statusCode( createStatusCodes( "all (immediately with method)" , isSuccess ) ); - - var testString = ""; - - jQuery.ajax( url( uri ), { - success: function( a , b , jqXHR ) { - ok( isSuccess , "success" ); - var statusCode = {}; - statusCode[ jqXHR.status ] = function() { - testString += "B"; - }; - jqXHR.statusCode( statusCode ); - testString += "A"; - }, - error: function( jqXHR ) { - ok( ! isSuccess , "error" ); - var statusCode = {}; - statusCode[ jqXHR.status ] = function() { - testString += "B"; - }; - jqXHR.statusCode( statusCode ); - testString += "A"; - }, - complete: function() { - strictEqual( testString , "AB" , "Test statusCode callbacks are ordered like " + - ( isSuccess ? "success" : "error" ) + " callbacks" ); - countComplete(); - } - } ); - - }); -}); - -test("jQuery.ajax - transitive conversions", function() { - - expect( 8 ); - - stop(); - - jQuery.when( - - jQuery.ajax( url("data/json.php") , { - converters: { - "json myJson": function( data ) { - ok( true , "converter called" ); - return data; - } - }, - dataType: "myJson", - success: function() { - ok( true , "Transitive conversion worked" ); - strictEqual( this.dataTypes[0] , "text" , "response was retrieved as text" ); - strictEqual( this.dataTypes[1] , "myjson" , "request expected myjson dataType" ); - } - }), - - jQuery.ajax( url("data/json.php") , { - converters: { - "json myJson": function( data ) { - ok( true , "converter called (*)" ); - return data; - } - }, - contents: false, /* headers are wrong so we ignore them */ - dataType: "* myJson", - success: function() { - ok( true , "Transitive conversion worked (*)" ); - strictEqual( this.dataTypes[0] , "text" , "response was retrieved as text (*)" ); - strictEqual( this.dataTypes[1] , "myjson" , "request expected myjson dataType (*)" ); - } - }) - - ).always(function() { - start(); - }); - -}); - -test("jQuery.ajax - overrideMimeType", function() { - - expect( 2 ); - - stop(); - - jQuery.when( - - jQuery.ajax( url("data/json.php") , { - beforeSend: function( xhr ) { - xhr.overrideMimeType( "application/json" ); - }, - success: function( json ) { - ok( json.data , "Mimetype overriden using beforeSend" ); - } - }), - - jQuery.ajax( url("data/json.php") , { - mimeType: "application/json", - success: function( json ) { - ok( json.data , "Mimetype overriden using mimeType option" ); - } - }) - - ).always(function() { - start(); - }); - -}); - -test("jQuery.ajax - abort in prefilter", function() { - - expect( 1 ); - - jQuery.ajaxPrefilter(function( options, _, jqXHR ) { - if ( options.abortInPrefilter ) { - jqXHR.abort(); - } - }); - - strictEqual( jQuery.ajax({ - abortInPrefilter: true, - error: function() { - ok( false, "error callback called" ); - } - }), false, "Request was properly aborted early by the prefilter" ); - -}); - -test("jQuery.ajax - active counter", function() { - ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active ); -}); - -} - -//} diff --git a/bower_components/jquery/test/unit/attributes.js b/bower_components/jquery/test/unit/attributes.js deleted file mode 100644 index a9d79462..00000000 --- a/bower_components/jquery/test/unit/attributes.js +++ /dev/null @@ -1,1172 +0,0 @@ -module("attributes", { teardown: moduleTeardown }); - -var bareObj = function(value) { return value; }; -var functionReturningObj = function(value) { return (function() { return value; }); }; - - -test("jQuery.propFix integrity test", function() { - expect(1); - - // This must be maintained and equal jQuery.attrFix when appropriate - // Ensure that accidental or erroneous property - // overwrites don't occur - // This is simply for better code coverage and future proofing. - var props = { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }; - - if ( !jQuery.support.enctype ) { - props.enctype = "encoding"; - } - - deepEqual(props, jQuery.propFix, "jQuery.propFix passes integrity check"); -}); - -test("attr(String)", function() { - expect(46); - - equals( jQuery("#text1").attr("type"), "text", "Check for type attribute" ); - equals( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" ); - equals( jQuery("#check1").attr("type"), "checkbox", "Check for type attribute" ); - equals( jQuery("#simon1").attr("rel"), "bookmark", "Check for rel attribute" ); - equals( jQuery("#google").attr("title"), "Google!", "Check for title attribute" ); - equals( jQuery("#mark").attr("hreflang"), "en", "Check for hreflang attribute" ); - equals( jQuery("#en").attr("lang"), "en", "Check for lang attribute" ); - equals( jQuery("#simon").attr("class"), "blog link", "Check for class attribute" ); - equals( jQuery("#name").attr("name"), "name", "Check for name attribute" ); - equals( jQuery("#text1").attr("name"), "action", "Check for name attribute" ); - ok( jQuery("#form").attr("action").indexOf("formaction") >= 0, "Check for action attribute" ); - equals( jQuery("#text1").attr("value", "t").attr("value"), "t", "Check setting the value attribute" ); - equals( jQuery("
    ").attr("value"), "t", "Check setting custom attr named 'value' on a div" ); - equals( jQuery("#form").attr("blah", "blah").attr("blah"), "blah", "Set non-existant attribute on a form" ); - equals( jQuery("#foo").attr("height"), undefined, "Non existent height attribute should return undefined" ); - - // [7472] & [3113] (form contains an input with name="action" or name="id") - var extras = jQuery("").appendTo("#testForm"); - equal( jQuery("#form").attr("action","newformaction").attr("action"), "newformaction", "Check that action attribute was changed" ); - equal( jQuery("#testForm").attr("target"), undefined, "Retrieving target does not equal the input with name=target" ); - equal( jQuery("#testForm").attr("target", "newTarget").attr("target"), "newTarget", "Set target successfully on a form" ); - equal( jQuery("#testForm").removeAttr("id").attr("id"), undefined, "Retrieving id does not equal the input with name=id after id is removed [#7472]" ); - // Bug #3685 (form contains input with name="name") - equals( jQuery("#testForm").attr("name"), undefined, "Retrieving name does not retrieve input with name=name" ); - extras.remove(); - - equals( jQuery("#text1").attr("maxlength"), "30", "Check for maxlength attribute" ); - equals( jQuery("#text1").attr("maxLength"), "30", "Check for maxLength attribute" ); - equals( jQuery("#area1").attr("maxLength"), "30", "Check for maxLength attribute" ); - - // using innerHTML in IE causes href attribute to be serialized to the full path - jQuery("").attr({ "id": "tAnchor5", "href": "#5" }).appendTo("#qunit-fixture"); - equals( jQuery("#tAnchor5").attr("href"), "#5", "Check for non-absolute href (an anchor)" ); - - // list attribute is readonly by default in browsers that support it - jQuery("#list-test").attr("list", "datalist"); - equals( jQuery("#list-test").attr("list"), "datalist", "Check setting list attribute" ); - - // Related to [5574] and [5683] - var body = document.body, $body = jQuery(body); - - strictEqual( $body.attr("foo"), undefined, "Make sure that a non existent attribute returns undefined" ); - - body.setAttribute("foo", "baz"); - equals( $body.attr("foo"), "baz", "Make sure the dom attribute is retrieved when no expando is found" ); - - $body.attr("foo","cool"); - equals( $body.attr("foo"), "cool", "Make sure that setting works well when both expando and dom attribute are available" ); - - body.removeAttribute("foo"); // Cleanup - - var select = document.createElement("select"), optgroup = document.createElement("optgroup"), option = document.createElement("option"); - optgroup.appendChild( option ); - select.appendChild( optgroup ); - - equal( jQuery( option ).attr("selected"), "selected", "Make sure that a single option is selected, even when in an optgroup." ); - - var $img = jQuery("").appendTo("body"); - equals( $img.attr("width"), "215", "Retrieve width attribute an an element with display:none." ); - equals( $img.attr("height"), "53", "Retrieve height attribute an an element with display:none." ); - - // Check for style support - ok( !!~jQuery("#dl").attr("style").indexOf("position"), "Check style attribute getter, also normalize css props to lowercase" ); - ok( !!~jQuery("#foo").attr("style", "position:absolute;").attr("style").indexOf("position"), "Check style setter" ); - - // Check value on button element (#1954) - var $button = jQuery("").insertAfter("#button"); - equals( $button.attr("value"), "foobar", "Value retrieval on a button does not return innerHTML" ); - equals( $button.attr("value", "baz").html(), "text", "Setting the value does not change innerHTML" ); - - // Attributes with a colon on a table element (#1591) - equals( jQuery("#table").attr("test:attrib"), undefined, "Retrieving a non-existent attribute on a table with a colon does not throw an error." ); - equals( jQuery("#table").attr("test:attrib", "foobar").attr("test:attrib"), "foobar", "Setting an attribute on a table with a colon does not throw an error." ); - - var $form = jQuery("
    ").appendTo("#qunit-fixture"); - equal( $form.attr("class"), "something", "Retrieve the class attribute on a form." ); - - var $a = jQuery("
    Click").appendTo("#qunit-fixture"); - equal( $a.attr("onclick"), "something()", "Retrieve ^on attribute without anonymous function wrapper." ); - - ok( jQuery("
    ").attr("doesntexist") === undefined, "Make sure undefined is returned when no attribute is found." ); - ok( jQuery("
    ").attr("title") === undefined, "Make sure undefined is returned when no attribute is found." ); - equal( jQuery("
    ").attr("title", "something").attr("title"), "something", "Set the title attribute." ); - ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." ); - equal( jQuery("
    ").attr("value"), undefined, "An unset value on a div returns undefined." ); - equal( jQuery("").attr("value"), "", "An unset value on an input returns current value." ); - - $form = jQuery("#form").attr("enctype", "multipart/form-data"); - equal( $form.prop("enctype"), "multipart/form-data", "Set the enctype of a form (encoding in IE6/7 #6743)" ); -}); - -if ( !isLocal ) { - test("attr(String) in XML Files", function() { - expect(3); - stop(); - jQuery.get("data/dashboard.xml", function( xml ) { - equal( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" ); - equal( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" ); - equal( jQuery( "location", xml ).attr("checked"), "different", "Check that hooks are not attached in XML document" ); - start(); - }); - }); -} - -test("attr(String, Function)", function() { - expect(2); - equals( jQuery("#text1").attr("value", function() { return this.id; })[0].value, "text1", "Set value from id" ); - equals( jQuery("#text1").attr("title", function(i) { return i; }).attr("title"), "0", "Set value with an index"); -}); - -test("attr(Hash)", function() { - expect(3); - var pass = true; - jQuery("div").attr({foo: "baz", zoo: "ping"}).each(function(){ - if ( this.getAttribute("foo") != "baz" && this.getAttribute("zoo") != "ping" ) pass = false; - }); - ok( pass, "Set Multiple Attributes" ); - equals( jQuery("#text1").attr({value: function() { return this.id; }})[0].value, "text1", "Set attribute to computed value #1" ); - equals( jQuery("#text1").attr({title: function(i) { return i; }}).attr("title"), "0", "Set attribute to computed value #2"); -}); - -test("attr(String, Object)", function() { - expect(78); - - var div = jQuery("div").attr("foo", "bar"), - fail = false; - - for ( var i = 0; i < div.size(); i++ ) { - if ( div.get(i).getAttribute("foo") != "bar" ){ - fail = i; - break; - } - } - - equals( fail, false, "Set Attribute, the #" + fail + " element didn't get the attribute 'foo'" ); - - ok( jQuery("#foo").attr({ "width": null }), "Try to set an attribute to nothing" ); - - jQuery("#name").attr("name", "something"); - equals( jQuery("#name").attr("name"), "something", "Set name attribute" ); - jQuery("#name").attr("name", null); - equals( jQuery("#name").attr("name"), undefined, "Remove name attribute" ); - var $input = jQuery("", { name: "something", id: "specified" }); - equal( $input.attr("name"), "something", "Check element creation gets/sets the name attribute." ); - equal( $input.attr("id"), "specified", "Check element creation gets/sets the id attribute." ); - - jQuery("#check2").prop("checked", true).prop("checked", false).attr("checked", true); - equals( document.getElementById("check2").checked, true, "Set checked attribute" ); - equals( jQuery("#check2").prop("checked"), true, "Set checked attribute" ); - equals( jQuery("#check2").attr("checked"), "checked", "Set checked attribute" ); - jQuery("#check2").attr("checked", false); - equals( document.getElementById("check2").checked, false, "Set checked attribute" ); - equals( jQuery("#check2").prop("checked"), false, "Set checked attribute" ); - equals( jQuery("#check2").attr("checked"), undefined, "Set checked attribute" ); - jQuery("#text1").attr("readonly", true); - equals( document.getElementById("text1").readOnly, true, "Set readonly attribute" ); - equals( jQuery("#text1").prop("readOnly"), true, "Set readonly attribute" ); - equals( jQuery("#text1").attr("readonly"), "readonly", "Set readonly attribute" ); - jQuery("#text1").attr("readonly", false); - equals( document.getElementById("text1").readOnly, false, "Set readonly attribute" ); - equals( jQuery("#text1").prop("readOnly"), false, "Set readonly attribute" ); - equals( jQuery("#text1").attr("readonly"), undefined, "Set readonly attribute" ); - - jQuery("#check2").prop("checked", true); - equals( document.getElementById("check2").checked, true, "Set checked attribute" ); - equals( jQuery("#check2").prop("checked"), true, "Set checked attribute" ); - equals( jQuery("#check2").attr("checked"), "checked", "Set checked attribute" ); - jQuery("#check2").prop("checked", false); - equals( document.getElementById("check2").checked, false, "Set checked attribute" ); - equals( jQuery("#check2").prop("checked"), false, "Set checked attribute" ); - equals( jQuery("#check2").attr("checked"), undefined, "Set checked attribute" ); - - jQuery("#check2").attr("checked", "checked"); - equal( document.getElementById("check2").checked, true, "Set checked attribute with 'checked'" ); - equal( jQuery("#check2").prop("checked"), true, "Set checked attribute" ); - equal( jQuery("#check2").attr("checked"), "checked", "Set checked attribute" ); - - QUnit.reset(); - - var $radios = jQuery("#checkedtest").find("input[type='radio']"); - $radios.eq(1).click(); - equal( $radios.eq(1).prop("checked"), true, "Second radio was checked when clicked"); - equal( $radios.attr("checked"), $radios[0].checked ? "checked" : undefined, "Known booleans do not fall back to attribute presence (#10278)"); - - jQuery("#text1").prop("readOnly", true); - equals( document.getElementById("text1").readOnly, true, "Set readonly attribute" ); - equals( jQuery("#text1").prop("readOnly"), true, "Set readonly attribute" ); - equals( jQuery("#text1").attr("readonly"), "readonly", "Set readonly attribute" ); - jQuery("#text1").prop("readOnly", false); - equals( document.getElementById("text1").readOnly, false, "Set readonly attribute" ); - equals( jQuery("#text1").prop("readOnly"), false, "Set readonly attribute" ); - equals( jQuery("#text1").attr("readonly"), undefined, "Set readonly attribute" ); - - jQuery("#name").attr("maxlength", "5"); - equals( document.getElementById("name").maxLength, 5, "Set maxlength attribute" ); - jQuery("#name").attr("maxLength", "10"); - equals( document.getElementById("name").maxLength, 10, "Set maxlength attribute" ); - - // HTML5 boolean attributes - var $text = jQuery("#text1").attr({ - "autofocus": true, - "required": true - }); - equal( $text.attr("autofocus"), "autofocus", "Set boolean attributes to the same name" ); - equal( $text.attr("autofocus", false).attr("autofocus"), undefined, "Setting autofocus attribute to false removes it" ); - equal( $text.attr("required"), "required", "Set boolean attributes to the same name" ); - equal( $text.attr("required", false).attr("required"), undefined, "Setting required attribute to false removes it" ); - - var $details = jQuery("
    ").appendTo("#qunit-fixture"); - equal( $details.attr("open"), "open", "open attribute presense indicates true" ); - equal( $details.attr("open", false).attr("open"), undefined, "Setting open attribute to false removes it" ); - - $text.attr("data-something", true); - equal( $text.attr("data-something"), "true", "Set data attributes"); - equal( $text.data("something"), true, "Setting data attributes are not affected by boolean settings"); - $text.attr("data-another", false); - equal( $text.attr("data-another"), "false", "Set data attributes"); - equal( $text.data("another"), false, "Setting data attributes are not affected by boolean settings" ); - equal( $text.attr("aria-disabled", false).attr("aria-disabled"), "false", "Setting aria attributes are not affected by boolean settings"); - $text.removeData("something").removeData("another").removeAttr("aria-disabled"); - - jQuery("#foo").attr("contenteditable", true); - equals( jQuery("#foo").attr("contenteditable"), "true", "Enumerated attributes are set properly" ); - - var attributeNode = document.createAttribute("irrelevant"), - commentNode = document.createComment("some comment"), - textNode = document.createTextNode("some text"), - obj = {}; - - jQuery.each( [commentNode, textNode, attributeNode], function( i, elem ) { - var $elem = jQuery( elem ); - $elem.attr( "nonexisting", "foo" ); - strictEqual( $elem.attr("nonexisting"), undefined, "attr(name, value) works correctly on comment and text nodes (bug #7500)." ); - }); - - jQuery.each( [window, document, obj, "#firstp"], function( i, elem ) { - var $elem = jQuery( elem ); - strictEqual( $elem.attr("nonexisting"), undefined, "attr works correctly for non existing attributes (bug #7500)." ); - equal( $elem.attr("something", "foo" ).attr("something"), "foo", "attr falls back to prop on unsupported arguments" ); - }); - - var table = jQuery("#table").append("cellcellcellcellcell"), - td = table.find("td:first"); - td.attr("rowspan", "2"); - equals( td[0].rowSpan, 2, "Check rowspan is correctly set" ); - td.attr("colspan", "2"); - equals( td[0].colSpan, 2, "Check colspan is correctly set" ); - table.attr("cellspacing", "2"); - equals( table[0].cellSpacing, "2", "Check cellspacing is correctly set" ); - - equals( jQuery("#area1").attr("value"), "foobar", "Value attribute retrieves the property for backwards compatibility." ); - - // for #1070 - jQuery("#name").attr("someAttr", "0"); - equals( jQuery("#name").attr("someAttr"), "0", "Set attribute to a string of \"0\"" ); - jQuery("#name").attr("someAttr", 0); - equals( jQuery("#name").attr("someAttr"), "0", "Set attribute to the number 0" ); - jQuery("#name").attr("someAttr", 1); - equals( jQuery("#name").attr("someAttr"), "1", "Set attribute to the number 1" ); - - // using contents will get comments regular, text, and comment nodes - var j = jQuery("#nonnodes").contents(); - - j.attr("name", "attrvalue"); - equals( j.attr("name"), "attrvalue", "Check node,textnode,comment for attr" ); - j.removeAttr("name"); - - // Type - var type = jQuery("#check2").attr("type"); - var thrown = false; - try { - jQuery("#check2").attr("type","hidden"); - } catch(e) { - thrown = true; - } - ok( thrown, "Exception thrown when trying to change type property" ); - equals( type, jQuery("#check2").attr("type"), "Verify that you can't change the type of an input element" ); - - var check = document.createElement("input"); - thrown = true; - try { - jQuery(check).attr("type", "checkbox"); - } catch(e) { - thrown = false; - } - ok( thrown, "Exception thrown when trying to change type property" ); - equals( "checkbox", jQuery(check).attr("type"), "Verify that you can change the type of an input element that isn't in the DOM" ); - - check = jQuery(""); - thrown = true; - try { - check.attr("type","checkbox"); - } catch(e) { - thrown = false; - } - ok( thrown, "Exception thrown when trying to change type property" ); - equals( "checkbox", check.attr("type"), "Verify that you can change the type of an input element that isn't in the DOM" ); - - var button = jQuery("#button"); - thrown = false; - try { - button.attr("type","submit"); - } catch(e) { - thrown = true; - } - ok( thrown, "Exception thrown when trying to change type property" ); - equals( "button", button.attr("type"), "Verify that you can't change the type of a button element" ); - - var $radio = jQuery("", { "value": "sup", "type": "radio" }).appendTo("#testForm"); - equals( $radio.val(), "sup", "Value is not reset when type is set after value on a radio" ); - - // Setting attributes on svg elements (bug #3116) - var $svg = jQuery("" - + "" - + "").appendTo("body"); - equals( $svg.attr("cx", 100).attr("cx"), "100", "Set attribute on svg element" ); - $svg.remove(); -}); - -test("attr(jquery_method)", function(){ - expect(7); - - var $elem = jQuery("
    "), - elem = $elem[0]; - - // one at a time - $elem.attr({html: "foo"}, true); - equals( elem.innerHTML, "foo", "attr(html)"); - - $elem.attr({text: "bar"}, true); - equals( elem.innerHTML, "bar", "attr(text)"); - - $elem.attr({css: {color: "red"}}, true); - ok( /^(#ff0000|red)$/i.test(elem.style.color), "attr(css)"); - - $elem.attr({height: 10}, true); - equals( elem.style.height, "10px", "attr(height)"); - - // Multiple attributes - - $elem.attr({ - width:10, - css:{ paddingLeft:1, paddingRight:1 } - }, true); - - equals( elem.style.width, "10px", "attr({...})"); - equals( elem.style.paddingLeft, "1px", "attr({...})"); - equals( elem.style.paddingRight, "1px", "attr({...})"); -}); - -if ( !isLocal ) { - test("attr(String, Object) - Loaded via XML document", function() { - expect(2); - stop(); - jQuery.get("data/dashboard.xml", function( xml ) { - var titles = []; - jQuery( "tab", xml ).each(function() { - titles.push( jQuery(this).attr("title") ); - }); - equals( titles[0], "Location", "attr() in XML context: Check first title" ); - equals( titles[1], "Users", "attr() in XML context: Check second title" ); - start(); - }); - }); -} - -test("attr('tabindex')", function() { - expect(8); - - // elements not natively tabbable - equals(jQuery("#listWithTabIndex").attr("tabindex"), 5, "not natively tabbable, with tabindex set to 0"); - equals(jQuery("#divWithNoTabIndex").attr("tabindex"), undefined, "not natively tabbable, no tabindex set"); - - // anchor with href - equals(jQuery("#linkWithNoTabIndex").attr("tabindex"), 0, "anchor with href, no tabindex set"); - equals(jQuery("#linkWithTabIndex").attr("tabindex"), 2, "anchor with href, tabindex set to 2"); - equals(jQuery("#linkWithNegativeTabIndex").attr("tabindex"), -1, "anchor with href, tabindex set to -1"); - - // anchor without href - equals(jQuery("#linkWithNoHrefWithNoTabIndex").attr("tabindex"), undefined, "anchor without href, no tabindex set"); - equals(jQuery("#linkWithNoHrefWithTabIndex").attr("tabindex"), 1, "anchor without href, tabindex set to 2"); - equals(jQuery("#linkWithNoHrefWithNegativeTabIndex").attr("tabindex"), -1, "anchor without href, no tabindex set"); -}); - -test("attr('tabindex', value)", function() { - expect(9); - - var element = jQuery("#divWithNoTabIndex"); - equals(element.attr("tabindex"), undefined, "start with no tabindex"); - - // set a positive string - element.attr("tabindex", "1"); - equals(element.attr("tabindex"), 1, "set tabindex to 1 (string)"); - - // set a zero string - element.attr("tabindex", "0"); - equals(element.attr("tabindex"), 0, "set tabindex to 0 (string)"); - - // set a negative string - element.attr("tabindex", "-1"); - equals(element.attr("tabindex"), -1, "set tabindex to -1 (string)"); - - // set a positive number - element.attr("tabindex", 1); - equals(element.attr("tabindex"), 1, "set tabindex to 1 (number)"); - - // set a zero number - element.attr("tabindex", 0); - equals(element.attr("tabindex"), 0, "set tabindex to 0 (number)"); - - // set a negative number - element.attr("tabindex", -1); - equals(element.attr("tabindex"), -1, "set tabindex to -1 (number)"); - - element = jQuery("#linkWithTabIndex"); - equals(element.attr("tabindex"), 2, "start with tabindex 2"); - - element.attr("tabindex", -1); - equals(element.attr("tabindex"), -1, "set negative tabindex"); -}); - -test("removeAttr(String)", function() { - expect(9); - var $first; - - equal( jQuery("#mark").removeAttr( "class" ).attr("class"), undefined, "remove class" ); - equal( jQuery("#form").removeAttr("id").attr("id"), undefined, "Remove id" ); - equal( jQuery("#foo").attr("style", "position:absolute;").removeAttr("style").attr("style"), undefined, "Check removing style attribute" ); - equal( jQuery("#form").attr("style", "position:absolute;").removeAttr("style").attr("style"), undefined, "Check removing style attribute on a form" ); - equal( jQuery("
    ").appendTo("#foo").removeAttr("style").prop("style").cssText, "", "Check removing style attribute (#9699 Webkit)" ); - equal( jQuery("#fx-test-group").attr("height", "3px").removeAttr("height").css("height"), "1px", "Removing height attribute has no effect on height set with style attribute" ); - - jQuery("#check1").removeAttr("checked").prop("checked", true).removeAttr("checked"); - equal( document.getElementById("check1").checked, false, "removeAttr sets boolean properties to false" ); - jQuery("#text1").prop("readOnly", true).removeAttr("readonly"); - equal( document.getElementById("text1").readOnly, false, "removeAttr sets boolean properties to false" ); - - try { - $first = jQuery("#first").attr("contenteditable", "true").removeAttr("contenteditable"); - equal( $first.attr('contenteditable'), undefined, "Remove the contenteditable attribute" ); - } catch(e) { - ok( false, "Removing contenteditable threw an error (#10429)" ); - } -}); - -test("prop(String, Object)", function() { - expect(31); - - equals( jQuery("#text1").prop("value"), "Test", "Check for value attribute" ); - equals( jQuery("#text1").prop("value", "Test2").prop("defaultValue"), "Test", "Check for defaultValue attribute" ); - equals( jQuery("#select2").prop("selectedIndex"), 3, "Check for selectedIndex attribute" ); - equals( jQuery("#foo").prop("nodeName").toUpperCase(), "DIV", "Check for nodeName attribute" ); - equals( jQuery("#foo").prop("tagName").toUpperCase(), "DIV", "Check for tagName attribute" ); - equals( jQuery(""); - $select1.val(valueObj( 4 )); - equals( $select1.val(), "4", "Should be possible to set the val() to a newly created option" ); - - // using contents will get comments regular, text, and comment nodes - var j = jQuery("#nonnodes").contents(); - j.val(valueObj( "asdf" )); - equals( j.val(), "asdf", "Check node,textnode,comment with val()" ); - j.removeAttr("value"); -} - -test("val(String/Number)", function() { - testVal(bareObj); -}); - -test("val(Function)", function() { - testVal(functionReturningObj); -}); - -test( "val(Array of Numbers) (Bug #7123)", function() { - expect(4); - jQuery("#form").append(""); - var elements = jQuery("input[name=arrayTest]").val([ 1, 2 ]); - ok( elements[0].checked, "First element was checked" ); - ok( elements[1].checked, "Second element was checked" ); - ok( !elements[2].checked, "Third element was unchecked" ); - ok( !elements[3].checked, "Fourth element remained unchecked" ); - - elements.remove(); -}); - -test("val(Function) with incoming value", function() { - expect(10); - - QUnit.reset(); - var oldVal = jQuery("#text1").val(); - - jQuery("#text1").val(function(i, val) { - equals( val, oldVal, "Make sure the incoming value is correct." ); - return "test"; - }); - - equals( document.getElementById("text1").value, "test", "Check for modified (via val(String)) value of input element" ); - - oldVal = jQuery("#text1").val(); - - jQuery("#text1").val(function(i, val) { - equals( val, oldVal, "Make sure the incoming value is correct." ); - return 67; - }); - - equals( document.getElementById("text1").value, "67", "Check for modified (via val(Number)) value of input element" ); - - oldVal = jQuery("#select1").val(); - - jQuery("#select1").val(function(i, val) { - equals( val, oldVal, "Make sure the incoming value is correct." ); - return "3"; - }); - - equals( jQuery("#select1").val(), "3", "Check for modified (via val(String)) value of select element" ); - - oldVal = jQuery("#select1").val(); - - jQuery("#select1").val(function(i, val) { - equals( val, oldVal, "Make sure the incoming value is correct." ); - return 2; - }); - - equals( jQuery("#select1").val(), "2", "Check for modified (via val(Number)) value of select element" ); - - jQuery("#select1").append(""); - - oldVal = jQuery("#select1").val(); - - jQuery("#select1").val(function(i, val) { - equals( val, oldVal, "Make sure the incoming value is correct." ); - return 4; - }); - - equals( jQuery("#select1").val(), "4", "Should be possible to set the val() to a newly created option" ); -}); - -// testing if a form.reset() breaks a subsequent call to a select element's .val() (in IE only) -test("val(select) after form.reset() (Bug #2551)", function() { - expect(3); - - jQuery("
    ").appendTo("#qunit-fixture"); - - jQuery("#kkk").val( "gf" ); - - document.kk.reset(); - - equal( jQuery("#kkk")[0].value, "cf", "Check value of select after form reset." ); - equal( jQuery("#kkk").val(), "cf", "Check value of select after form reset." ); - - // re-verify the multi-select is not broken (after form.reset) by our fix for single-select - same( jQuery("#select3").val(), ["1", "2"], "Call val() on a multiple=\"multiple\" select" ); - - jQuery("#kk").remove(); -}); - -var testAddClass = function(valueObj) { - expect(9); - - var div = jQuery("div"); - div.addClass( valueObj("test") ); - var pass = true; - for ( var i = 0; i < div.size(); i++ ) { - if ( !~div.get(i).className.indexOf("test") ) { - pass = false; - } - } - ok( pass, "Add Class" ); - - // using contents will get regular, text, and comment nodes - var j = jQuery("#nonnodes").contents(); - j.addClass( valueObj("asdf") ); - ok( j.hasClass("asdf"), "Check node,textnode,comment for addClass" ); - - div = jQuery("
    "); - - div.addClass( valueObj("test") ); - equals( div.attr("class"), "test", "Make sure there's no extra whitespace." ); - - div.attr("class", " foo"); - div.addClass( valueObj("test") ); - equals( div.attr("class"), "foo test", "Make sure there's no extra whitespace." ); - - div.attr("class", "foo"); - div.addClass( valueObj("bar baz") ); - equals( div.attr("class"), "foo bar baz", "Make sure there isn't too much trimming." ); - - div.removeClass(); - div.addClass( valueObj("foo") ).addClass( valueObj("foo") ); - equal( div.attr("class"), "foo", "Do not add the same class twice in separate calls." ); - - div.addClass( valueObj("fo") ); - equal( div.attr("class"), "foo fo", "Adding a similar class does not get interrupted." ); - div.removeClass().addClass("wrap2"); - ok( div.addClass("wrap").hasClass("wrap"), "Can add similarly named classes"); - - div.removeClass(); - div.addClass( valueObj("bar bar") ); - equal( div.attr("class"), "bar", "Do not add the same class twice in the same call." ); -}; - -test("addClass(String)", function() { - testAddClass(bareObj); -}); - -test("addClass(Function)", function() { - testAddClass(functionReturningObj); -}); - -test("addClass(Function) with incoming value", function() { - expect(48); - var div = jQuery("div"), old = div.map(function(){ - return jQuery(this).attr("class") || ""; - }); - - div.addClass(function(i, val) { - if ( this.id !== "_firebugConsole") { - equals( val, old[i], "Make sure the incoming value is correct." ); - return "test"; - } - }); - - var pass = true; - for ( var i = 0; i < div.length; i++ ) { - if ( div.get(i).className.indexOf("test") == -1 ) pass = false; - } - ok( pass, "Add Class" ); -}); - -var testRemoveClass = function(valueObj) { - expect(7); - - var $divs = jQuery("div"); - - $divs.addClass("test").removeClass( valueObj("test") ); - - ok( !$divs.is(".test"), "Remove Class" ); - - QUnit.reset(); - $divs = jQuery("div"); - - $divs.addClass("test").addClass("foo").addClass("bar"); - $divs.removeClass( valueObj("test") ).removeClass( valueObj("bar") ).removeClass( valueObj("foo") ); - - ok( !$divs.is(".test,.bar,.foo"), "Remove multiple classes" ); - - QUnit.reset(); - $divs = jQuery("div"); - - // Make sure that a null value doesn't cause problems - $divs.eq(0).addClass("test").removeClass( valueObj(null) ); - ok( $divs.eq(0).is(".test"), "Null value passed to removeClass" ); - - $divs.eq(0).addClass("test").removeClass( valueObj("") ); - ok( $divs.eq(0).is(".test"), "Empty string passed to removeClass" ); - - // using contents will get regular, text, and comment nodes - var j = jQuery("#nonnodes").contents(); - j.removeClass( valueObj("asdf") ); - ok( !j.hasClass("asdf"), "Check node,textnode,comment for removeClass" ); - - var div = document.createElement("div"); - div.className = " test foo "; - - jQuery(div).removeClass( valueObj("foo") ); - equals( div.className, "test", "Make sure remaining className is trimmed." ); - - div.className = " test "; - - jQuery(div).removeClass( valueObj("test") ); - equals( div.className, "", "Make sure there is nothing left after everything is removed." ); -}; - -test("removeClass(String) - simple", function() { - testRemoveClass(bareObj); -}); - -test("removeClass(Function) - simple", function() { - testRemoveClass(functionReturningObj); -}); - -test("removeClass(Function) with incoming value", function() { - expect(48); - - var $divs = jQuery("div").addClass("test"), old = $divs.map(function(){ - return jQuery(this).attr("class"); - }); - - $divs.removeClass(function(i, val) { - if ( this.id !== "_firebugConsole" ) { - equals( val, old[i], "Make sure the incoming value is correct." ); - return "test"; - } - }); - - ok( !$divs.is(".test"), "Remove Class" ); - - QUnit.reset(); -}); - -var testToggleClass = function(valueObj) { - expect(17); - - var e = jQuery("#firstp"); - ok( !e.is(".test"), "Assert class not present" ); - e.toggleClass( valueObj("test") ); - ok( e.is(".test"), "Assert class present" ); - e.toggleClass( valueObj("test") ); - ok( !e.is(".test"), "Assert class not present" ); - - // class name with a boolean - e.toggleClass( valueObj("test"), false ); - ok( !e.is(".test"), "Assert class not present" ); - e.toggleClass( valueObj("test"), true ); - ok( e.is(".test"), "Assert class present" ); - e.toggleClass( valueObj("test"), false ); - ok( !e.is(".test"), "Assert class not present" ); - - // multiple class names - e.addClass("testA testB"); - ok( (e.is(".testA.testB")), "Assert 2 different classes present" ); - e.toggleClass( valueObj("testB testC") ); - ok( (e.is(".testA.testC") && !e.is(".testB")), "Assert 1 class added, 1 class removed, and 1 class kept" ); - e.toggleClass( valueObj("testA testC") ); - ok( (!e.is(".testA") && !e.is(".testB") && !e.is(".testC")), "Assert no class present" ); - - // toggleClass storage - e.toggleClass(true); - ok( e[0].className === "", "Assert class is empty (data was empty)" ); - e.addClass("testD testE"); - ok( e.is(".testD.testE"), "Assert class present" ); - e.toggleClass(); - ok( !e.is(".testD.testE"), "Assert class not present" ); - ok( jQuery._data(e[0], "__className__") === "testD testE", "Assert data was stored" ); - e.toggleClass(); - ok( e.is(".testD.testE"), "Assert class present (restored from data)" ); - e.toggleClass(false); - ok( !e.is(".testD.testE"), "Assert class not present" ); - e.toggleClass(true); - ok( e.is(".testD.testE"), "Assert class present (restored from data)" ); - e.toggleClass(); - e.toggleClass(false); - e.toggleClass(); - ok( e.is(".testD.testE"), "Assert class present (restored from data)" ); - - // Cleanup - e.removeClass("testD"); - jQuery.removeData(e[0], "__className__", true); -}; - -test("toggleClass(String|boolean|undefined[, boolean])", function() { - testToggleClass(bareObj); -}); - -test("toggleClass(Function[, boolean])", function() { - testToggleClass(functionReturningObj); -}); - -test("toggleClass(Fucntion[, boolean]) with incoming value", function() { - expect(14); - - var e = jQuery("#firstp"), old = e.attr("class") || ""; - ok( !e.is(".test"), "Assert class not present" ); - - e.toggleClass(function(i, val) { - equal( old, val, "Make sure the incoming value is correct." ); - return "test"; - }); - ok( e.is(".test"), "Assert class present" ); - - old = e.attr("class"); - - e.toggleClass(function(i, val) { - equal( old, val, "Make sure the incoming value is correct." ); - return "test"; - }); - ok( !e.is(".test"), "Assert class not present" ); - - old = e.attr("class") || ""; - - // class name with a boolean - e.toggleClass(function(i, val, state) { - equal( old, val, "Make sure the incoming value is correct." ); - equal( state, false, "Make sure that the state is passed in." ); - return "test"; - }, false ); - ok( !e.is(".test"), "Assert class not present" ); - - old = e.attr("class") || ""; - - e.toggleClass(function(i, val, state) { - equal( old, val, "Make sure the incoming value is correct." ); - equal( state, true, "Make sure that the state is passed in." ); - return "test"; - }, true ); - ok( e.is(".test"), "Assert class present" ); - - old = e.attr("class"); - - e.toggleClass(function(i, val, state) { - equal( old, val, "Make sure the incoming value is correct." ); - equal( state, false, "Make sure that the state is passed in." ); - return "test"; - }, false ); - ok( !e.is(".test"), "Assert class not present" ); - - // Cleanup - e.removeClass("test"); - jQuery.removeData(e[0], "__className__", true); -}); - -test("addClass, removeClass, hasClass", function() { - expect(17); - - var jq = jQuery("

    Hi

    "), x = jq[0]; - - jq.addClass("hi"); - equals( x.className, "hi", "Check single added class" ); - - jq.addClass("foo bar"); - equals( x.className, "hi foo bar", "Check more added classes" ); - - jq.removeClass(); - equals( x.className, "", "Remove all classes" ); - - jq.addClass("hi foo bar"); - jq.removeClass("foo"); - equals( x.className, "hi bar", "Check removal of one class" ); - - ok( jq.hasClass("hi"), "Check has1" ); - ok( jq.hasClass("bar"), "Check has2" ); - - var jq = jQuery("

    "); - ok( jq.hasClass("class1"), "Check hasClass with line feed" ); - ok( jq.is(".class1"), "Check is with line feed" ); - ok( jq.hasClass("class2"), "Check hasClass with tab" ); - ok( jq.is(".class2"), "Check is with tab" ); - ok( jq.hasClass("cla.ss3"), "Check hasClass with dot" ); - ok( jq.hasClass("class4"), "Check hasClass with carriage return" ); - ok( jq.is(".class4"), "Check is with carriage return" ); - - jq.removeClass("class2"); - ok( jq.hasClass("class2")==false, "Check the class has been properly removed" ); - jq.removeClass("cla"); - ok( jq.hasClass("cla.ss3"), "Check the dotted class has not been removed" ); - jq.removeClass("cla.ss3"); - ok( jq.hasClass("cla.ss3")==false, "Check the dotted class has been removed" ); - jq.removeClass("class4"); - ok( jq.hasClass("class4")==false, "Check the class has been properly removed" ); -}); - -test("contents().hasClass() returns correct values", function() { - expect(2); - - var $div = jQuery("
    text
    "), - $contents = $div.contents(); - - ok( $contents.hasClass("foo"), "Found 'foo' in $contents" ); - ok( !$contents.hasClass("undefined"), "Did not find 'undefined' in $contents (correctly)" ); -}); diff --git a/bower_components/jquery/test/unit/callbacks.js b/bower_components/jquery/test/unit/callbacks.js deleted file mode 100644 index a1935e74..00000000 --- a/bower_components/jquery/test/unit/callbacks.js +++ /dev/null @@ -1,182 +0,0 @@ -module("callbacks", { teardown: moduleTeardown }); - -(function() { - -var output, - addToOutput = function( string ) { - return function() { - output += string; - }; - }, - outputA = addToOutput( "A" ), - outputB = addToOutput( "B" ), - outputC = addToOutput( "C" ), - tests = { - "": "XABC X XABCABCC X XBB X XABA X", - "once": "XABC X X X X X XABA X", - "memory": "XABC XABC XABCABCCC XA XBB XB XABA XC", - "unique": "XABC X XABCA X XBB X XAB X", - "stopOnFalse": "XABC X XABCABCC X XBB X XA X", - "once memory": "XABC XABC X XA X XA XABA XC", - "once unique": "XABC X X X X X XAB X", - "once stopOnFalse": "XABC X X X X X XA X", - "memory unique": "XABC XA XABCA XA XBB XB XAB XC", - "memory stopOnFalse": "XABC XABC XABCABCCC XA XBB XB XA X", - "unique stopOnFalse": "XABC X XABCA X XBB X XA X" - }, - filters = { - "no filter": undefined, - "filter": function( fn ) { - return function() { - return fn.apply( this, arguments ); - }; - } - }; - -jQuery.each( tests, function( flags, resultString ) { - - jQuery.each( filters, function( filterLabel, filter ) { - - test( "jQuery.Callbacks( \"" + flags + "\" ) - " + filterLabel, function() { - - expect( 19 ); - - // Give qunit a little breathing room - stop(); - setTimeout( start, 0 ); - - var cblist; - results = resultString.split( /\s+/ ); - - // Basic binding and firing - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add(function( str ) { - output += str; - }); - cblist.fire( "A" ); - strictEqual( output, "XA", "Basic binding and firing" ); - output = "X"; - cblist.disable(); - cblist.add(function( str ) { - output += str; - }); - strictEqual( output, "X", "Adding a callback after disabling" ); - cblist.fire( "A" ); - strictEqual( output, "X", "Firing after disabling" ); - - // Basic binding and firing (context, arguments) - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add(function() { - equals( this, window, "Basic binding and firing (context)" ); - output += Array.prototype.join.call( arguments, "" ); - }); - cblist.fireWith( window, [ "A", "B" ] ); - strictEqual( output, "XAB", "Basic binding and firing (arguments)" ); - - // fireWith with no arguments - output = ""; - cblist = jQuery.Callbacks( flags ); - cblist.add(function() { - equals( this, window, "fireWith with no arguments (context is window)" ); - strictEqual( arguments.length, 0, "fireWith with no arguments (no arguments)" ); - }); - cblist.fireWith(); - - // Basic binding, removing and firing - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add( outputA, outputB, outputC ); - cblist.remove( outputB, outputC ); - cblist.fire(); - strictEqual( output, "XA", "Basic binding, removing and firing" ); - - // Empty - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add( outputA ); - cblist.add( outputB ); - cblist.add( outputC ); - cblist.empty(); - cblist.fire(); - strictEqual( output, "X", "Empty" ); - - // Locking - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add( function( str ) { - output += str; - }); - cblist.lock(); - cblist.add( function( str ) { - output += str; - }); - cblist.fire( "A" ); - cblist.add( function( str ) { - output += str; - }); - strictEqual( output, "X", "Lock early" ); - - // Ordering - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add( function() { - cblist.add( outputC ); - outputA(); - }, outputB ); - cblist.fire(); - strictEqual( output, results.shift(), "Proper ordering" ); - - // Add and fire again - output = "X"; - cblist.add( function() { - cblist.add( outputC ); - outputA(); - }, outputB ); - strictEqual( output, results.shift(), "Add after fire" ); - - output = "X"; - cblist.fire(); - strictEqual( output, results.shift(), "Fire again" ); - - // Multiple fire - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add( function( str ) { - output += str; - } ); - cblist.fire( "A" ); - strictEqual( output, "XA", "Multiple fire (first fire)" ); - output = "X"; - cblist.add( function( str ) { - output += str; - } ); - strictEqual( output, results.shift(), "Multiple fire (first new callback)" ); - output = "X"; - cblist.fire( "B" ); - strictEqual( output, results.shift(), "Multiple fire (second fire)" ); - output = "X"; - cblist.add( function( str ) { - output += str; - } ); - strictEqual( output, results.shift(), "Multiple fire (second new callback)" ); - - // Return false - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add( outputA, function() { return false; }, outputB ); - cblist.add( outputA ); - cblist.fire(); - strictEqual( output, results.shift(), "Callback returning false" ); - - // Add another callback (to control lists with memory do not fire anymore) - output = "X"; - cblist.add( outputC ); - strictEqual( output, results.shift(), "Adding a callback after one returned false" ); - - }); - }); -}); - -})(); diff --git a/bower_components/jquery/test/unit/core.js b/bower_components/jquery/test/unit/core.js deleted file mode 100644 index 0756e794..00000000 --- a/bower_components/jquery/test/unit/core.js +++ /dev/null @@ -1,1262 +0,0 @@ -module("core", { teardown: moduleTeardown }); - -test("Basic requirements", function() { - expect(7); - ok( Array.prototype.push, "Array.push()" ); - ok( Function.prototype.apply, "Function.apply()" ); - ok( document.getElementById, "getElementById" ); - ok( document.getElementsByTagName, "getElementsByTagName" ); - ok( RegExp, "RegExp" ); - ok( jQuery, "jQuery" ); - ok( $, "$" ); -}); - -test("jQuery()", function() { - expect(29); - - // Basic constructor's behavior - - equals( jQuery().length, 0, "jQuery() === jQuery([])" ); - equals( jQuery(undefined).length, 0, "jQuery(undefined) === jQuery([])" ); - equals( jQuery(null).length, 0, "jQuery(null) === jQuery([])" ); - equals( jQuery("").length, 0, "jQuery('') === jQuery([])" ); - equals( jQuery("#").length, 0, "jQuery('#') === jQuery([])" ); - - var obj = jQuery("div"); - equals( jQuery(obj).selector, "div", "jQuery(jQueryObj) == jQueryObj" ); - - // can actually yield more than one, when iframes are included, the window is an array as well - equals( jQuery(window).length, 1, "Correct number of elements generated for jQuery(window)" ); - - - var main = jQuery("#qunit-fixture"); - same( jQuery("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" ); - -/* - // disabled since this test was doing nothing. i tried to fix it but i'm not sure - // what the expected behavior should even be. FF returns "\n" for the text node - // make sure this is handled - var crlfContainer = jQuery('

    \r\n

    '); - var x = crlfContainer.contents().get(0).nodeValue; - equals( x, what???, "Check for \\r and \\n in jQuery()" ); -*/ - - /* // Disabled until we add this functionality in - var pass = true; - try { - jQuery("
    Testing
    ").appendTo(document.getElementById("iframe").contentDocument.body); - } catch(e){ - pass = false; - } - ok( pass, "jQuery('<tag>') needs optional document parameter to ease cross-frame DOM wrangling, see #968" );*/ - - var code = jQuery(""); - equals( code.length, 1, "Correct number of elements generated for code" ); - equals( code.parent().length, 0, "Make sure that the generated HTML has no parent." ); - var img = jQuery(""); - equals( img.length, 1, "Correct number of elements generated for img" ); - equals( img.parent().length, 0, "Make sure that the generated HTML has no parent." ); - var div = jQuery("

    "); - equals( div.length, 4, "Correct number of elements generated for div hr code b" ); - equals( div.parent().length, 0, "Make sure that the generated HTML has no parent." ); - - equals( jQuery([1,2,3]).get(1), 2, "Test passing an array to the factory" ); - - equals( jQuery(document.body).get(0), jQuery("body").get(0), "Test passing an html node to the factory" ); - - var exec = false; - - var elem = jQuery("
    ", { - width: 10, - css: { paddingLeft:1, paddingRight:1 }, - click: function(){ ok(exec, "Click executed."); }, - text: "test", - "class": "test2", - id: "test3" - }); - - equals( elem[0].style.width, "10px", "jQuery() quick setter width"); - equals( elem[0].style.paddingLeft, "1px", "jQuery quick setter css"); - equals( elem[0].style.paddingRight, "1px", "jQuery quick setter css"); - equals( elem[0].childNodes.length, 1, "jQuery quick setter text"); - equals( elem[0].firstChild.nodeValue, "test", "jQuery quick setter text"); - equals( elem[0].className, "test2", "jQuery() quick setter class"); - equals( elem[0].id, "test3", "jQuery() quick setter id"); - - exec = true; - elem.click(); - - // manually clean up detached elements - elem.remove(); - - for ( var i = 0; i < 3; ++i ) { - elem = jQuery(""); - } - equals( elem[0].defaultValue, "TEST", "Ensure cached nodes are cloned properly (Bug #6655)" ); - - // manually clean up detached elements - elem.remove(); - - equals( jQuery("
    ").length, 1, "Make sure whitespace is trimmed." ); - equals( jQuery(" a
    b ").length, 1, "Make sure whitespace and other characters are trimmed." ); - - var long = ""; - for ( var i = 0; i < 128; i++ ) { - long += "12345678"; - } - - equals( jQuery("
    " + long + "
    ").length, 1, "Make sure whitespace is trimmed on long strings." ); - equals( jQuery(" a
    " + long + "
    b ").length, 1, "Make sure whitespace and other characters are trimmed on long strings." ); -}); - -test("selector state", function() { - expect(31); - - var test; - - test = jQuery(undefined); - equals( test.selector, "", "Empty jQuery Selector" ); - equals( test.context, undefined, "Empty jQuery Context" ); - - test = jQuery(document); - equals( test.selector, "", "Document Selector" ); - equals( test.context, document, "Document Context" ); - - test = jQuery(document.body); - equals( test.selector, "", "Body Selector" ); - equals( test.context, document.body, "Body Context" ); - - test = jQuery("#qunit-fixture"); - equals( test.selector, "#qunit-fixture", "#qunit-fixture Selector" ); - equals( test.context, document, "#qunit-fixture Context" ); - - test = jQuery("#notfoundnono"); - equals( test.selector, "#notfoundnono", "#notfoundnono Selector" ); - equals( test.context, document, "#notfoundnono Context" ); - - test = jQuery("#qunit-fixture", document); - equals( test.selector, "#qunit-fixture", "#qunit-fixture Selector" ); - equals( test.context, document, "#qunit-fixture Context" ); - - test = jQuery("#qunit-fixture", document.body); - equals( test.selector, "#qunit-fixture", "#qunit-fixture Selector" ); - equals( test.context, document.body, "#qunit-fixture Context" ); - - // Test cloning - test = jQuery(test); - equals( test.selector, "#qunit-fixture", "#qunit-fixture Selector" ); - equals( test.context, document.body, "#qunit-fixture Context" ); - - test = jQuery(document.body).find("#qunit-fixture"); - equals( test.selector, "#qunit-fixture", "#qunit-fixture find Selector" ); - equals( test.context, document.body, "#qunit-fixture find Context" ); - - test = jQuery("#qunit-fixture").filter("div"); - equals( test.selector, "#qunit-fixture.filter(div)", "#qunit-fixture filter Selector" ); - equals( test.context, document, "#qunit-fixture filter Context" ); - - test = jQuery("#qunit-fixture").not("div"); - equals( test.selector, "#qunit-fixture.not(div)", "#qunit-fixture not Selector" ); - equals( test.context, document, "#qunit-fixture not Context" ); - - test = jQuery("#qunit-fixture").filter("div").not("div"); - equals( test.selector, "#qunit-fixture.filter(div).not(div)", "#qunit-fixture filter, not Selector" ); - equals( test.context, document, "#qunit-fixture filter, not Context" ); - - test = jQuery("#qunit-fixture").filter("div").not("div").end(); - equals( test.selector, "#qunit-fixture.filter(div)", "#qunit-fixture filter, not, end Selector" ); - equals( test.context, document, "#qunit-fixture filter, not, end Context" ); - - test = jQuery("#qunit-fixture").parent("body"); - equals( test.selector, "#qunit-fixture.parent(body)", "#qunit-fixture parent Selector" ); - equals( test.context, document, "#qunit-fixture parent Context" ); - - test = jQuery("#qunit-fixture").eq(0); - equals( test.selector, "#qunit-fixture.slice(0,1)", "#qunit-fixture eq Selector" ); - equals( test.context, document, "#qunit-fixture eq Context" ); - - var d = "
    "; - equals( - jQuery(d).appendTo(jQuery(d)).selector, - jQuery(d).appendTo(d).selector, - "manipulation methods make same selector for jQuery objects" - ); -}); - -test( "globalEval", function() { - - expect( 3 ); - - jQuery.globalEval( "var globalEvalTest = true;" ); - ok( window.globalEvalTest, "Test variable declarations are global" ); - - window.globalEvalTest = false; - - jQuery.globalEval( "globalEvalTest = true;" ); - ok( window.globalEvalTest, "Test variable assignments are global" ); - - window.globalEvalTest = false; - - jQuery.globalEval( "this.globalEvalTest = true;" ); - ok( window.globalEvalTest, "Test context (this) is the window object" ); - - window.globalEvalTest = undefined; -}); - -if ( !isLocal ) { -test("browser", function() { - stop(); - - jQuery.get("data/ua.txt", function(data){ - var uas = data.split("\n"); - expect( (uas.length - 1) * 2 ); - - jQuery.each(uas, function(){ - var parts = this.split("\t"); - if ( parts[2] ) { - var ua = jQuery.uaMatch( parts[2] ); - equals( ua.browser, parts[0], "Checking browser for " + parts[2] ); - equals( ua.version, parts[1], "Checking version string for " + parts[2] ); - } - }); - - start(); - }); -}); -} - -test("amdModule", function() { - expect(1); - - equals( jQuery, amdDefined, "Make sure defined module matches jQuery" ); -}); - -test("noConflict", function() { - expect(7); - - var $$ = jQuery; - - equals( jQuery, jQuery.noConflict(), "noConflict returned the jQuery object" ); - equals( jQuery, $$, "Make sure jQuery wasn't touched." ); - equals( $, original$, "Make sure $ was reverted." ); - - jQuery = $ = $$; - - equals( jQuery.noConflict(true), $$, "noConflict returned the jQuery object" ); - equals( jQuery, originaljQuery, "Make sure jQuery was reverted." ); - equals( $, original$, "Make sure $ was reverted." ); - ok( $$("#qunit-fixture").html("test"), "Make sure that jQuery still works." ); - - jQuery = $$; -}); - -test("trim", function() { - expect(9); - - var nbsp = String.fromCharCode(160); - - equals( jQuery.trim("hello "), "hello", "trailing space" ); - equals( jQuery.trim(" hello"), "hello", "leading space" ); - equals( jQuery.trim(" hello "), "hello", "space on both sides" ); - equals( jQuery.trim(" " + nbsp + "hello " + nbsp + " "), "hello", " " ); - - equals( jQuery.trim(), "", "Nothing in." ); - equals( jQuery.trim( undefined ), "", "Undefined" ); - equals( jQuery.trim( null ), "", "Null" ); - equals( jQuery.trim( 5 ), "5", "Number" ); - equals( jQuery.trim( false ), "false", "Boolean" ); -}); - -test("type", function() { - expect(23); - - equals( jQuery.type(null), "null", "null" ); - equals( jQuery.type(undefined), "undefined", "undefined" ); - equals( jQuery.type(true), "boolean", "Boolean" ); - equals( jQuery.type(false), "boolean", "Boolean" ); - equals( jQuery.type(Boolean(true)), "boolean", "Boolean" ); - equals( jQuery.type(0), "number", "Number" ); - equals( jQuery.type(1), "number", "Number" ); - equals( jQuery.type(Number(1)), "number", "Number" ); - equals( jQuery.type(""), "string", "String" ); - equals( jQuery.type("a"), "string", "String" ); - equals( jQuery.type(String("a")), "string", "String" ); - equals( jQuery.type({}), "object", "Object" ); - equals( jQuery.type(/foo/), "regexp", "RegExp" ); - equals( jQuery.type(new RegExp("asdf")), "regexp", "RegExp" ); - equals( jQuery.type([1]), "array", "Array" ); - equals( jQuery.type(new Date()), "date", "Date" ); - equals( jQuery.type(new Function("return;")), "function", "Function" ); - equals( jQuery.type(function(){}), "function", "Function" ); - equals( jQuery.type(window), "object", "Window" ); - equals( jQuery.type(document), "object", "Document" ); - equals( jQuery.type(document.body), "object", "Element" ); - equals( jQuery.type(document.createTextNode("foo")), "object", "TextNode" ); - equals( jQuery.type(document.getElementsByTagName("*")), "object", "NodeList" ); -}); - -test("isPlainObject", function() { - expect(15); - - stop(); - - // The use case that we want to match - ok(jQuery.isPlainObject({}), "{}"); - - // Not objects shouldn't be matched - ok(!jQuery.isPlainObject(""), "string"); - ok(!jQuery.isPlainObject(0) && !jQuery.isPlainObject(1), "number"); - ok(!jQuery.isPlainObject(true) && !jQuery.isPlainObject(false), "boolean"); - ok(!jQuery.isPlainObject(null), "null"); - ok(!jQuery.isPlainObject(undefined), "undefined"); - - // Arrays shouldn't be matched - ok(!jQuery.isPlainObject([]), "array"); - - // Instantiated objects shouldn't be matched - ok(!jQuery.isPlainObject(new Date), "new Date"); - - var fn = function(){}; - - // Functions shouldn't be matched - ok(!jQuery.isPlainObject(fn), "fn"); - - // Again, instantiated objects shouldn't be matched - ok(!jQuery.isPlainObject(new fn), "new fn (no methods)"); - - // Makes the function a little more realistic - // (and harder to detect, incidentally) - fn.prototype = {someMethod: function(){}}; - - // Again, instantiated objects shouldn't be matched - ok(!jQuery.isPlainObject(new fn), "new fn"); - - // DOM Element - ok(!jQuery.isPlainObject(document.createElement("div")), "DOM Element"); - - // Window - ok(!jQuery.isPlainObject(window), "window"); - - try { - jQuery.isPlainObject( window.location ); - ok( true, "Does not throw exceptions on host objects"); - } catch ( e ) { - ok( false, "Does not throw exceptions on host objects -- FAIL"); - } - - try { - var iframe = document.createElement("iframe"); - document.body.appendChild(iframe); - - window.iframeDone = function(otherObject){ - // Objects from other windows should be matched - ok(jQuery.isPlainObject(new otherObject), "new otherObject"); - document.body.removeChild( iframe ); - start(); - }; - - var doc = iframe.contentDocument || iframe.contentWindow.document; - doc.open(); - doc.write(""); - doc.close(); - } catch(e) { - document.body.removeChild( iframe ); - - ok(true, "new otherObject - iframes not supported"); - start(); - } -}); - -test("isFunction", function() { - expect(19); - - // Make sure that false values return false - ok( !jQuery.isFunction(), "No Value" ); - ok( !jQuery.isFunction( null ), "null Value" ); - ok( !jQuery.isFunction( undefined ), "undefined Value" ); - ok( !jQuery.isFunction( "" ), "Empty String Value" ); - ok( !jQuery.isFunction( 0 ), "0 Value" ); - - // Check built-ins - // Safari uses "(Internal Function)" - ok( jQuery.isFunction(String), "String Function("+String+")" ); - ok( jQuery.isFunction(Array), "Array Function("+Array+")" ); - ok( jQuery.isFunction(Object), "Object Function("+Object+")" ); - ok( jQuery.isFunction(Function), "Function Function("+Function+")" ); - - // When stringified, this could be misinterpreted - var mystr = "function"; - ok( !jQuery.isFunction(mystr), "Function String" ); - - // When stringified, this could be misinterpreted - var myarr = [ "function" ]; - ok( !jQuery.isFunction(myarr), "Function Array" ); - - // When stringified, this could be misinterpreted - var myfunction = { "function": "test" }; - ok( !jQuery.isFunction(myfunction), "Function Object" ); - - // Make sure normal functions still work - var fn = function(){}; - ok( jQuery.isFunction(fn), "Normal Function" ); - - var obj = document.createElement("object"); - - // Firefox says this is a function - ok( !jQuery.isFunction(obj), "Object Element" ); - - // IE says this is an object - // Since 1.3, this isn't supported (#2968) - //ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" ); - - var nodes = document.body.childNodes; - - // Safari says this is a function - ok( !jQuery.isFunction(nodes), "childNodes Property" ); - - var first = document.body.firstChild; - - // Normal elements are reported ok everywhere - ok( !jQuery.isFunction(first), "A normal DOM Element" ); - - var input = document.createElement("input"); - input.type = "text"; - document.body.appendChild( input ); - - // IE says this is an object - // Since 1.3, this isn't supported (#2968) - //ok( jQuery.isFunction(input.focus), "A default function property" ); - - document.body.removeChild( input ); - - var a = document.createElement("a"); - a.href = "some-function"; - document.body.appendChild( a ); - - // This serializes with the word 'function' in it - ok( !jQuery.isFunction(a), "Anchor Element" ); - - document.body.removeChild( a ); - - // Recursive function calls have lengths and array-like properties - function callme(callback){ - function fn(response){ - callback(response); - } - - ok( jQuery.isFunction(fn), "Recursive Function Call" ); - - fn({ some: "data" }); - }; - - callme(function(){ - callme(function(){}); - }); -}); - -test( "isNumeric", function() { - expect( 33 ); - - var t = jQuery.isNumeric; - - ok( t("-10"), "Negative integer string"); - ok( t("0"), "Zero string"); - ok( t("5"), "Positive integer string"); - ok( t(-16), "Negative integer number"); - ok( t(0), "Zero integer number"); - ok( t(32), "Positive integer number"); - ok( t("040"), "Octal integer literal string"); - ok( t(0144), "Octal integer literal"); - ok( t("0xFF"), "Hexadecimal integer literal string"); - ok( t(0xFFF), "Hexadecimal integer literal"); - ok( t("-1.6"), "Negative floating point string"); - ok( t("4.536"), "Positive floating point string"); - ok( t(-2.6), "Negative floating point number"); - ok( t(3.1415), "Positive floating point number"); - ok( t(8e5), "Exponential notation"); - ok( t("123e-2"), "Exponential notation string"); - equals( t(""), false, "Empty string"); - equals( t(" "), false, "Whitespace characters string"); - equals( t("\t\t"), false, "Tab characters string"); - equals( t("abcdefghijklm1234567890"), false, "Alphanumeric character string"); - equals( t("xabcdefx"), false, "Non-numeric character string"); - equals( t(true), false, "Boolean true literal"); - equals( t(false), false, "Boolean false literal"); - equals( t("bcfed5.2"), false, "Number with preceding non-numeric characters"); - equals( t("7.2acdgs"), false, "Number with trailling non-numeric characters"); - equals( t(undefined), false, "Undefined value"); - equals( t(null), false, "Null value"); - equals( t(NaN), false, "NaN value"); - equals( t(Infinity), false, "Infinity primitive"); - equals( t(Number.POSITIVE_INFINITY), false, "Positive Infinity"); - equals( t(Number.NEGATIVE_INFINITY), false, "Negative Infinity"); - equals( t({}), false, "Empty object"); - equals( t(function(){} ), false, "Instance of a function"); -}); - -test("isXMLDoc - HTML", function() { - expect(4); - - ok( !jQuery.isXMLDoc( document ), "HTML document" ); - ok( !jQuery.isXMLDoc( document.documentElement ), "HTML documentElement" ); - ok( !jQuery.isXMLDoc( document.body ), "HTML Body Element" ); - - var iframe = document.createElement("iframe"); - document.body.appendChild( iframe ); - - try { - var body = jQuery(iframe).contents()[0]; - - try { - ok( !jQuery.isXMLDoc( body ), "Iframe body element" ); - } catch(e) { - ok( false, "Iframe body element exception" ); - } - - } catch(e) { - ok( true, "Iframe body element - iframe not working correctly" ); - } - - document.body.removeChild( iframe ); -}); - -test("XSS via location.hash", function() { - expect(1); - - stop(); - jQuery._check9521 = function(x){ - ok( x, "script called from #id-like selector with inline handler" ); - jQuery("#check9521").remove(); - delete jQuery._check9521; - start(); - }; - try { - // This throws an error because it's processed like an id - jQuery( '#' ).appendTo("#qunit-fixture"); - } catch (err) { - jQuery._check9521(true); - }; -}); - -if ( !isLocal ) { -test("isXMLDoc - XML", function() { - expect(3); - stop(); - jQuery.get("data/dashboard.xml", function(xml) { - ok( jQuery.isXMLDoc( xml ), "XML document" ); - ok( jQuery.isXMLDoc( xml.documentElement ), "XML documentElement" ); - ok( jQuery.isXMLDoc( jQuery("tab", xml)[0] ), "XML Tab Element" ); - start(); - }); -}); -} - -test("isWindow", function() { - expect( 12 ); - - ok( jQuery.isWindow(window), "window" ); - ok( !jQuery.isWindow(), "empty" ); - ok( !jQuery.isWindow(null), "null" ); - ok( !jQuery.isWindow(undefined), "undefined" ); - ok( !jQuery.isWindow(document), "document" ); - ok( !jQuery.isWindow(document.documentElement), "documentElement" ); - ok( !jQuery.isWindow(""), "string" ); - ok( !jQuery.isWindow(1), "number" ); - ok( !jQuery.isWindow(true), "boolean" ); - ok( !jQuery.isWindow({}), "object" ); - // HMMM - // ok( !jQuery.isWindow({ setInterval: function(){} }), "fake window" ); - ok( !jQuery.isWindow(/window/), "regexp" ); - ok( !jQuery.isWindow(function(){}), "function" ); -}); - -test("jQuery('html')", function() { - expect(18); - - QUnit.reset(); - jQuery.foo = false; - var s = jQuery("")[0]; - ok( s, "Creating a script" ); - ok( !jQuery.foo, "Make sure the script wasn't executed prematurely" ); - jQuery("body").append(""); - ok( jQuery.foo, "Executing a scripts contents in the right context" ); - - // Test multi-line HTML - var div = jQuery("
    \r\nsome text\n

    some p

    \nmore text\r\n
    ")[0]; - equals( div.nodeName.toUpperCase(), "DIV", "Make sure we're getting a div." ); - equals( div.firstChild.nodeType, 3, "Text node." ); - equals( div.lastChild.nodeType, 3, "Text node." ); - equals( div.childNodes[1].nodeType, 1, "Paragraph." ); - equals( div.childNodes[1].firstChild.nodeType, 3, "Paragraph text." ); - - QUnit.reset(); - ok( jQuery("")[0], "Creating a link" ); - - ok( !jQuery(""); - equals(jQuery(".replacewith").length, 1, "Check number of elements in page."); - jQuery(".replacewith").remove(); - - QUnit.reset(); - - jQuery("#qunit-fixture").append("
    "); - equals( jQuery("#qunit-fixture").find("div[id=replaceWith]").length, 1, "Make sure only one div exists." ); - - jQuery("#replaceWith").replaceWith( val("
    ") ); - equals( jQuery("#qunit-fixture").find("div[id=replaceWith]").length, 1, "Make sure only one div exists." ); - - jQuery("#replaceWith").replaceWith( val("
    ") ); - equals( jQuery("#qunit-fixture").find("div[id=replaceWith]").length, 1, "Make sure only one div exists." ); -} - -test("replaceWith(String|Element|Array<Element>|jQuery)", function() { - testReplaceWith(bareObj); -}); - -test("replaceWith(Function)", function() { - testReplaceWith(functionReturningObj); - - expect(22); - - var y = jQuery("#yahoo")[0]; - - jQuery(y).replaceWith(function(){ - equals( this, y, "Make sure the context is coming in correctly." ); - }); - - QUnit.reset(); -}); - -test("replaceWith(string) for more than one element", function(){ - expect(3); - - equals(jQuery("#foo p").length, 3, "ensuring that test data has not changed"); - - jQuery("#foo p").replaceWith("bar"); - equals(jQuery("#foo span").length, 3, "verify that all the three original element have been replaced"); - equals(jQuery("#foo p").length, 0, "verify that all the three original element have been replaced"); -}); - -test("replaceAll(String|Element|Array<Element>|jQuery)", function() { - expect(10); - jQuery("buga").replaceAll("#yahoo"); - ok( jQuery("#replace")[0], "Replace element with string" ); - ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after string" ); - - QUnit.reset(); - jQuery(document.getElementById("first")).replaceAll("#yahoo"); - ok( jQuery("#first")[0], "Replace element with element" ); - ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after element" ); - - QUnit.reset(); - jQuery([document.getElementById("first"), document.getElementById("mark")]).replaceAll("#yahoo"); - ok( jQuery("#first")[0], "Replace element with array of elements" ); - ok( jQuery("#mark")[0], "Replace element with array of elements" ); - ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after array of elements" ); - - QUnit.reset(); - jQuery("#mark, #first").replaceAll("#yahoo"); - ok( jQuery("#first")[0], "Replace element with set of elements" ); - ok( jQuery("#mark")[0], "Replace element with set of elements" ); - ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after set of elements" ); -}); - -test("jQuery.clone() (#8017)", function() { - - expect(2); - - ok( jQuery.clone && jQuery.isFunction( jQuery.clone ) , "jQuery.clone() utility exists and is a function."); - - var main = jQuery("#qunit-fixture")[0], - clone = jQuery.clone( main ); - - equals( main.childNodes.length, clone.childNodes.length, "Simple child length to ensure a large dom tree copies correctly" ); -}); - -test("clone() (#8070)", function () { - expect(2); - - jQuery("").appendTo("#qunit-fixture"); - var selects = jQuery(".test8070"); - selects.append(""); - - equals( selects[0].childNodes.length, 2, "First select got two nodes" ); - equals( selects[1].childNodes.length, 2, "Second select got two nodes" ); - - selects.remove(); -}); - -test("clone()", function() { - expect(40); - equals( "This is a normal link: Yahoo", jQuery("#en").text(), "Assert text for #en" ); - var clone = jQuery("#yahoo").clone(); - equals( "Try them out:Yahoo", jQuery("#first").append(clone).text(), "Check for clone" ); - equals( "This is a normal link: Yahoo", jQuery("#en").text(), "Reassert text for #en" ); - - var cloneTags = [ - "", "", "\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
    ", "
    " ], + area: [ 1, "", "" ], + param: [ 1, "", "" ], + thead: [ 1, "
    ", "
    ", - "
    ", "
    " ], + tr: [ 2, "", "
    " ], + col: [ 2, "", "
    " ], + td: [ 3, "", "
    " ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
    ", "
    " ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + 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 ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : 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.nodeType === 11 || this.nodeType === 9 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + 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 ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function( value ) { + var isFunc = jQuery.isFunction( value ); + + // 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 ( !isFunc && typeof value !== "string" ) { + value = jQuery( value ).not( this ).detach(); + } + + return this.domManip( [ value ], true, function( elem ) { + var next = this.nextSibling, + parent = this.parentNode; + + if ( parent ) { + jQuery( this ).remove(); + parent.insertBefore( elem, next ); + } + }); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + + // Flatten any nested arrays + args = core_concat.apply( [], args ); + + var first, node, hasScripts, + scripts, doc, fragment, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, table ? self.html() : undefined ); + } + self.domManip( args, table, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( + table && jQuery.nodeName( this[i], "table" ) ? + findOrAppend( this[i], "tbody" ) : + this[i], + node, + i + ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Hope ajax is available... + jQuery.ajax({ + url: node.src, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } +}); + +function findOrAppend( elem, tag ) { + return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + var attr = elem.getAttributeNode("type"); + elem.type = ( attr && attr.specified ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { + // 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 + + 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.defaultSelected = 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; + } +} + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + core_push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( manipulation_rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, node, clone, i, srcElements, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var j, elem, contains, + tmp, tag, tbody, wrap, + l = elems.length, + + // Ensure a safe fragment + safe = createSafeFragment( context ), + + nodes = [], + i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted from table fragments + if ( !jQuery.support.tbody ) { + + // String was a , *may* have spurious + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare or + wrap[1] === "
    " && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var elem, type, id, data, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( 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 ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // 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 ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== core_strundefined ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + core_deletedIds.push( id ); + } + } + } + } + } +}); +var iframe, getStyles, curCSS, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity\s*=\s*([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), + elemdisplay = { BODY: "block" }, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, + + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; + +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { + + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } + + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } + + return origName; +} + +function isHidden( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); +} + +function showHide( elements, show ) { + var display, elem, hidden, + values = [], + index = 0, + length = elements.length; + + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + values[ index ] = jQuery._data( elem, "olddisplay" ); + display = elem.style.display; + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && display === "none" ) { + 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 ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else { + + if ( !values[ index ] ) { + hidden = isHidden( elem ); + + if ( display && display !== "none" || !hidden ) { + jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); + } + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } + + return elements; +} + +jQuery.fn.extend({ + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + var len, styles, + map = {}, + i = 0; + + if ( jQuery.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + var bool = typeof state === "boolean"; + + return this.each(function() { + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } +}); + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "columnCount": true, + "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, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, + // but it would mean to define eight (for every problematic property) identical functions + if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== 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, styles ) { + var num, val, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +// NOTE: we've included the "window" in window.getComputedStyle +// because jsdom on node.js will break without it. +if ( window.getComputedStyle ) { + getStyles = function( elem ) { + return window.getComputedStyle( elem, null ); + }; + + curCSS = function( elem, name, _computed ) { + var width, minWidth, maxWidth, + computed = _computed || getStyles( elem ), + + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, + style = elem.style; + + if ( computed ) { + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret; + }; +} else if ( document.documentElement.currentStyle ) { + getStyles = function( elem ) { + return elem.currentStyle; + }; + + curCSS = function( elem, name, _computed ) { + var left, rs, rsLeft, + computed = _computed || getStyles( elem ), + ret = computed ? computed[ name ] : undefined, + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } + + // 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 + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + + // Remember the original values + left = style.left; + rs = elem.runtimeStyle; + rsLeft = rs && rs.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + rs.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + rs.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + // at this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var valueIsBorderBox = true, + val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + styles = getStyles( elem ), + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, styles ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +// Try to determine the default display value of an element +function css_defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + // Use the already-created iframe if possible + iframe = ( iframe || + jQuery("