mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Update vendors, builds, and docs.
Former-commit-id: 08cad493d719ec3ebaa85e0ff279c49f1e2b3655
This commit is contained in:
26
vendor/backbone/README.md
vendored
26
vendor/backbone/README.md
vendored
@@ -1,26 +0,0 @@
|
||||
____ __ __
|
||||
/\ _`\ /\ \ /\ \ __
|
||||
\ \ \ \ \ __ ___\ \ \/'\\ \ \____ ___ ___ __ /\_\ ____
|
||||
\ \ _ <' /'__`\ /'___\ \ , < \ \ '__`\ / __`\ /' _ `\ /'__`\ \/\ \ /',__\
|
||||
\ \ \ \ \/\ \ \.\_/\ \__/\ \ \\`\\ \ \ \ \/\ \ \ \/\ \/\ \/\ __/ __ \ \ \/\__, `\
|
||||
\ \____/\ \__/.\_\ \____\\ \_\ \_\ \_,__/\ \____/\ \_\ \_\ \____\/\_\_\ \ \/\____/
|
||||
\/___/ \/__/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/_/\/_/\/____/\/_/\ \_\ \/___/
|
||||
\ \____/
|
||||
\/___/
|
||||
(_'_______________________________________________________________________________'_)
|
||||
(_.———————————————————————————————————————————————————————————————————————————————._)
|
||||
|
||||
|
||||
Backbone supplies structure to JavaScript-heavy applications by providing models key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface.
|
||||
|
||||
For Docs, License, Tests, pre-packed downloads, and everything else, really, see:
|
||||
http://backbonejs.org
|
||||
|
||||
To suggest a feature, report a bug, or general discussion:
|
||||
http://github.com/documentcloud/backbone/issues/
|
||||
|
||||
All contributors are listed here:
|
||||
http://github.com/documentcloud/backbone/contributors
|
||||
|
||||
Special thanks to Robert Kieffer for the original philosophy behind Backbone.
|
||||
http://github.com/broofa
|
||||
128
vendor/benchmark.js/README.md
vendored
128
vendor/benchmark.js/README.md
vendored
@@ -1,128 +0,0 @@
|
||||
# Benchmark.js <sup>v1.0.0</sup>
|
||||
[](http://travis-ci.org/bestiejs/benchmark.js)
|
||||
|
||||
A [robust](http://calendar.perfplanet.com/2010/bulletproof-javascript-benchmarks/ "Bulletproof JavaScript benchmarks") benchmarking library that works on nearly all JavaScript platforms<sup><a name="fnref1" href="#fn1">1</a></sup>, supports high-resolution timers, and returns statistically significant results. As seen on [jsPerf](http://jsperf.com/).
|
||||
|
||||
## Download
|
||||
|
||||
* [Development source](https://raw.github.com/bestiejs/benchmark.js/v1.0.0/benchmark.js)
|
||||
|
||||
## Dive in
|
||||
|
||||
We’ve got [API docs](http://benchmarkjs.com/docs) and [unit tests](http://benchmarkjs.com/tests).
|
||||
|
||||
For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/benchmark.js/wiki/Roadmap).
|
||||
|
||||
## Support
|
||||
|
||||
Benchmark.js has been tested in at least Chrome 5~27, Firefox 2~21, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.7, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.
|
||||
|
||||
## Installation and usage
|
||||
|
||||
Benchmark.js’ only hard dependency is [Lo-Dash](http://lodash.com/).
|
||||
|
||||
In a browser:
|
||||
|
||||
```html
|
||||
<script src="lodash.js"></script>
|
||||
<script src="benchmark.js"></script>
|
||||
```
|
||||
|
||||
Optionally, expose Java’s nanosecond timer by adding the `nano` applet to the `<body>`:
|
||||
|
||||
```html
|
||||
<applet code="nano" archive="nano.jar"></applet>
|
||||
```
|
||||
|
||||
Or enable Chrome’s microsecond timer by using the [command line switch](http://peter.sh/experiments/chromium-command-line-switches/#enable-benchmarking):
|
||||
|
||||
--enable-benchmarking
|
||||
|
||||
Via [npm](http://npmjs.org/):
|
||||
|
||||
```bash
|
||||
npm install benchmark
|
||||
```
|
||||
|
||||
In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
|
||||
|
||||
```js
|
||||
var Benchmark = require('benchmark');
|
||||
```
|
||||
|
||||
Optionally, use the [microtime module](https://github.com/wadey/node-microtime) by Wade Simmons:
|
||||
|
||||
```bash
|
||||
npm install microtime
|
||||
```
|
||||
|
||||
In [RingoJS v0.7.0-](http://ringojs.org/):
|
||||
|
||||
```js
|
||||
var Benchmark = require('benchmark').Benchmark;
|
||||
```
|
||||
|
||||
In [Rhino](http://www.mozilla.org/rhino/):
|
||||
|
||||
```js
|
||||
load('benchmark.js');
|
||||
```
|
||||
|
||||
In an AMD loader like [RequireJS](http://requirejs.org/):
|
||||
|
||||
```js
|
||||
require({
|
||||
'paths': {
|
||||
'benchmark': 'path/to/benchmark',
|
||||
'lodash': 'path/to/lodash',
|
||||
'platform': 'path/to/platform'
|
||||
}
|
||||
},
|
||||
['benchmark'], function(Benchmark) {
|
||||
console.log(Benchmark.platform.name);
|
||||
});
|
||||
```
|
||||
|
||||
Usage example:
|
||||
|
||||
```js
|
||||
var suite = new Benchmark.Suite;
|
||||
|
||||
// add tests
|
||||
suite.add('RegExp#test', function() {
|
||||
/o/.test('Hello World!');
|
||||
})
|
||||
.add('String#indexOf', function() {
|
||||
'Hello World!'.indexOf('o') > -1;
|
||||
})
|
||||
// add listeners
|
||||
.on('cycle', function(event) {
|
||||
console.log(String(event.target));
|
||||
})
|
||||
.on('complete', function() {
|
||||
console.log('Fastest is ' + this.filter('fastest').pluck('name'));
|
||||
})
|
||||
// run async
|
||||
.run({ 'async': true });
|
||||
|
||||
// logs:
|
||||
// > RegExp#test x 4,161,532 +-0.99% (59 cycles)
|
||||
// > String#indexOf x 6,139,623 +-1.00% (131 cycles)
|
||||
// > Fastest is String#indexOf
|
||||
```
|
||||
|
||||
## BestieJS
|
||||
|
||||
Benchmark.js is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation.
|
||||
|
||||
## Authors
|
||||
|
||||
| [](http://twitter.com/mathias "Follow @mathias on Twitter") | [](http://twitter.com/jdalton "Follow @jdalton on Twitter") |
|
||||
|---|---|
|
||||
| [Mathias Bynens](http://mathiasbynens.be/) | [John-David Dalton](http://allyoucanleet.com/) |
|
||||
|
||||
## Contributors
|
||||
|
||||
| [](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") |
|
||||
|---|
|
||||
| [Kit Cambridge](http://kitcambridge.github.io/) |
|
||||
24
vendor/curl/LICENSE.txt
vendored
Normal file
24
vendor/curl/LICENSE.txt
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
Open Source Initiative OSI - The MIT License
|
||||
|
||||
http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
Copyright (c) 2010-2013 Brian Cavalier and John Hann
|
||||
|
||||
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 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.
|
||||
1323
vendor/curl/src/curl.js
vendored
Normal file
1323
vendor/curl/src/curl.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
35
vendor/docdown/README.md
vendored
35
vendor/docdown/README.md
vendored
@@ -1,35 +0,0 @@
|
||||
# Docdown <sup>v1.0.0</sup>
|
||||
|
||||
A simple JSDoc to Markdown documentation generator.
|
||||
|
||||
## Documentation
|
||||
|
||||
The documentation for Docdown can be viewed here: [/doc/README.md](https://github.com/jdalton/docdown/blob/master/doc/README.md#readme)
|
||||
|
||||
For a list of upcoming features, check out our [roadmap](https://github.com/jdalton/docdown/wiki/Roadmap).
|
||||
|
||||
## Installation and usage
|
||||
|
||||
Usage example:
|
||||
|
||||
```php
|
||||
require("docdown.php");
|
||||
|
||||
// generate Markdown
|
||||
$markdown = docdown(array(
|
||||
"path" => $filepath,
|
||||
"url" => "https://github.com/username/project/blob/master/my.js"
|
||||
));
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
| [](http://twitter.com/jdalton "Follow @jdalton on Twitter") |
|
||||
|---|
|
||||
| [John-David Dalton](http://allyoucanleet.com/) |
|
||||
|
||||
## Contributors
|
||||
|
||||
| [](http://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](http://mathiasbynens.be/) |
|
||||
195
vendor/dojo/LICENSE
vendored
Normal file
195
vendor/dojo/LICENSE
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
Dojo is available under *either* the terms of the modified BSD license *or* the
|
||||
Academic Free License version 2.1. As a recipient of Dojo, you may choose which
|
||||
license to receive this code under (except as noted in per-module LICENSE
|
||||
files). Some modules may not be the copyright of the Dojo Foundation. These
|
||||
modules contain explicit declarations of copyright in both the LICENSE files in
|
||||
the directories in which they reside and in the code itself. No external
|
||||
contributions are allowed under licenses which are fundamentally incompatible
|
||||
with the AFL or BSD licenses that Dojo is distributed under.
|
||||
|
||||
The text of the AFL and BSD licenses is reproduced below.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The "New" BSD License:
|
||||
**********************
|
||||
|
||||
Copyright (c) 2005-2013, The Dojo Foundation
|
||||
All rights reserved.
|
||||
|
||||
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.
|
||||
* Neither the name of the Dojo Foundation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 OWNER OR CONTRIBUTORS 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.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The Academic Free License, v. 2.1:
|
||||
**********************************
|
||||
|
||||
This Academic Free License (the "License") applies to any original work of
|
||||
authorship (the "Original Work") whose owner (the "Licensor") has placed the
|
||||
following notice immediately following the copyright notice for the Original
|
||||
Work:
|
||||
|
||||
Licensed under the Academic Free License version 2.1
|
||||
|
||||
1) Grant of Copyright License. Licensor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive, perpetual, sublicenseable license to do the
|
||||
following:
|
||||
|
||||
a) to reproduce the Original Work in copies;
|
||||
|
||||
b) to prepare derivative works ("Derivative Works") based upon the Original
|
||||
Work;
|
||||
|
||||
c) to distribute copies of the Original Work and Derivative Works to the
|
||||
public;
|
||||
|
||||
d) to perform the Original Work publicly; and
|
||||
|
||||
e) to display the Original Work publicly.
|
||||
|
||||
2) Grant of Patent License. Licensor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive, perpetual, sublicenseable license, under patent
|
||||
claims owned or controlled by the Licensor that are embodied in the Original
|
||||
Work as furnished by the Licensor, to make, use, sell and offer for sale the
|
||||
Original Work and Derivative Works.
|
||||
|
||||
3) Grant of Source Code License. The term "Source Code" means the preferred
|
||||
form of the Original Work for making modifications to it and all available
|
||||
documentation describing how to modify the Original Work. Licensor hereby
|
||||
agrees to provide a machine-readable copy of the Source Code of the Original
|
||||
Work along with each copy of the Original Work that Licensor distributes.
|
||||
Licensor reserves the right to satisfy this obligation by placing a
|
||||
machine-readable copy of the Source Code in an information repository
|
||||
reasonably calculated to permit inexpensive and convenient access by You for as
|
||||
long as Licensor continues to distribute the Original Work, and by publishing
|
||||
the address of that information repository in a notice immediately following
|
||||
the copyright notice that applies to the Original Work.
|
||||
|
||||
4) Exclusions From License Grant. Neither the names of Licensor, nor the names
|
||||
of any contributors to the Original Work, nor any of their trademarks or
|
||||
service marks, may be used to endorse or promote products derived from this
|
||||
Original Work without express prior written permission of the Licensor. Nothing
|
||||
in this License shall be deemed to grant any rights to trademarks, copyrights,
|
||||
patents, trade secrets or any other intellectual property of Licensor except as
|
||||
expressly stated herein. No patent license is granted to make, use, sell or
|
||||
offer to sell embodiments of any patent claims other than the licensed claims
|
||||
defined in Section 2. No right is granted to the trademarks of Licensor even if
|
||||
such marks are included in the Original Work. Nothing in this License shall be
|
||||
interpreted to prohibit Licensor from licensing under different terms from this
|
||||
License any Original Work that Licensor otherwise would have a right to
|
||||
license.
|
||||
|
||||
5) This section intentionally omitted.
|
||||
|
||||
6) Attribution Rights. You must retain, in the Source Code of any Derivative
|
||||
Works that You create, all copyright, patent or trademark notices from the
|
||||
Source Code of the Original Work, as well as any notices of licensing and any
|
||||
descriptive text identified therein as an "Attribution Notice." You must cause
|
||||
the Source Code for any Derivative Works that You create to carry a prominent
|
||||
Attribution Notice reasonably calculated to inform recipients that You have
|
||||
modified the Original Work.
|
||||
|
||||
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
|
||||
the copyright in and to the Original Work and the patent rights granted herein
|
||||
by Licensor are owned by the Licensor or are sublicensed to You under the terms
|
||||
of this License with the permission of the contributor(s) of those copyrights
|
||||
and patent rights. Except as expressly stated in the immediately proceeding
|
||||
sentence, the Original Work is provided under this License on an "AS IS" BASIS
|
||||
and WITHOUT WARRANTY, either express or implied, including, without limitation,
|
||||
the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.
|
||||
This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No
|
||||
license to Original Work is granted hereunder except under this disclaimer.
|
||||
|
||||
8) Limitation of Liability. Under no circumstances and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise, shall the
|
||||
Licensor be liable to any person for any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License
|
||||
or the use of the Original Work including, without limitation, damages for loss
|
||||
of goodwill, work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses. This limitation of liability shall not
|
||||
apply to liability for death or personal injury resulting from Licensor's
|
||||
negligence to the extent applicable law prohibits such limitation. Some
|
||||
jurisdictions do not allow the exclusion or limitation of incidental or
|
||||
consequential damages, so this exclusion and limitation may not apply to You.
|
||||
|
||||
9) Acceptance and Termination. If You distribute copies of the Original Work or
|
||||
a Derivative Work, You must make a reasonable effort under the circumstances to
|
||||
obtain the express assent of recipients to the terms of this License. Nothing
|
||||
else but this License (or another written agreement between Licensor and You)
|
||||
grants You permission to create Derivative Works based upon the Original Work
|
||||
or to exercise any of the rights granted in Section 1 herein, and any attempt
|
||||
to do so except under the terms of this License (or another written agreement
|
||||
between Licensor and You) is expressly prohibited by U.S. copyright law, the
|
||||
equivalent laws of other countries, and by international treaty. Therefore, by
|
||||
exercising any of the rights granted to You in Section 1 herein, You indicate
|
||||
Your acceptance of this License and all of its terms and conditions.
|
||||
|
||||
10) Termination for Patent Action. This License shall terminate automatically
|
||||
and You may no longer exercise any of the rights granted to You by this License
|
||||
as of the date You commence an action, including a cross-claim or counterclaim,
|
||||
against Licensor or any licensee alleging that the Original Work infringes a
|
||||
patent. This termination provision shall not apply for an action alleging
|
||||
patent infringement by combinations of the Original Work with other software or
|
||||
hardware.
|
||||
|
||||
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
|
||||
License may be brought only in the courts of a jurisdiction wherein the
|
||||
Licensor resides or in which Licensor conducts its primary business, and under
|
||||
the laws of that jurisdiction excluding its conflict-of-law provisions. The
|
||||
application of the United Nations Convention on Contracts for the International
|
||||
Sale of Goods is expressly excluded. Any use of the Original Work outside the
|
||||
scope of this License or after its termination shall be subject to the
|
||||
requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et
|
||||
seq., the equivalent laws of other countries, and international treaty. This
|
||||
section shall survive the termination of this License.
|
||||
|
||||
12) Attorneys Fees. In any action to enforce the terms of this License or
|
||||
seeking damages relating thereto, the prevailing party shall be entitled to
|
||||
recover its costs and expenses, including, without limitation, reasonable
|
||||
attorneys' fees and costs incurred in connection with such action, including
|
||||
any appeal of such action. This section shall survive the termination of this
|
||||
License.
|
||||
|
||||
13) Miscellaneous. This License represents the complete agreement concerning
|
||||
the subject matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent necessary to
|
||||
make it enforceable.
|
||||
|
||||
14) Definition of "You" in This License. "You" throughout this License, whether
|
||||
in upper or lower case, means an individual or a legal entity exercising rights
|
||||
under, and complying with all of the terms of, this License. For legal
|
||||
entities, "You" includes any entity that controls, is controlled by, or is
|
||||
under common control with you. For purposes of this definition, "control" means
|
||||
(i) the power, direct or indirect, to cause the direction or management of such
|
||||
entity, whether by contract or otherwise, or (ii) ownership of fifty percent
|
||||
(50%) or more of the outstanding shares, or (iii) beneficial ownership of such
|
||||
entity.
|
||||
|
||||
15) Right to Use. You may use the Original Work in all ways not otherwise
|
||||
restricted or conditioned by this License or by law, and Licensor promises not
|
||||
to interfere with or be responsible for such uses by You.
|
||||
|
||||
This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.
|
||||
Permission is hereby granted to copy and distribute this license without
|
||||
modification. This license may not be modified without the express written
|
||||
permission of its copyright owner.
|
||||
1997
vendor/dojo/dojo.js
vendored
Normal file
1997
vendor/dojo/dojo.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
417
vendor/jquery/README.md
vendored
417
vendor/jquery/README.md
vendored
@@ -1,417 +0,0 @@
|
||||
[jQuery](http://jquery.com/) - New Wave JavaScript
|
||||
==================================================
|
||||
|
||||
Contribution Guides
|
||||
--------------------------------------
|
||||
|
||||
In the spirit of open source software development, jQuery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly:
|
||||
|
||||
1. [Getting Involved](http://docs.jquery.com/Getting_Involved)
|
||||
2. [Core Style Guide](http://docs.jquery.com/JQuery_Core_Style_Guidelines)
|
||||
3. [Tips For Bug Patching](http://docs.jquery.com/Tips_for_jQuery_Bug_Patching)
|
||||
|
||||
|
||||
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/npm latest, 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
|
||||
[Homebrew](http://mxcl.github.com/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:
|
||||
|
||||
```bash
|
||||
git clone git://github.com/jquery/jquery.git
|
||||
```
|
||||
|
||||
Enter the directory and install the Node dependencies:
|
||||
|
||||
```bash
|
||||
cd jquery && npm install
|
||||
```
|
||||
|
||||
|
||||
Make sure you have `grunt` installed by testing:
|
||||
|
||||
```bash
|
||||
grunt -version
|
||||
```
|
||||
|
||||
|
||||
|
||||
Then, to get a complete, minified (w/ Uglify.js), linted (w/ JSHint) version of jQuery, type the following:
|
||||
|
||||
```bash
|
||||
grunt
|
||||
```
|
||||
|
||||
|
||||
The built version of jQuery will be put in the `dist/` subdirectory.
|
||||
|
||||
|
||||
### Modules (new in 1.8)
|
||||
|
||||
Starting in jQuery 1.8, special builds can now be created that optionally exclude or include any of the following modules:
|
||||
|
||||
- ajax
|
||||
- css
|
||||
- dimensions
|
||||
- effects
|
||||
- offset
|
||||
|
||||
|
||||
Before creating a custom build for use in production, be sure to check out the latest stable version:
|
||||
|
||||
```bash
|
||||
git pull; git checkout $(git describe --abbrev=0 --tags)
|
||||
```
|
||||
|
||||
Then, make sure all Node dependencies are installed and all Git submodules are checked out:
|
||||
|
||||
```bash
|
||||
npm install && grunt
|
||||
```
|
||||
|
||||
To create a custom build, use the following special `grunt` commands:
|
||||
|
||||
Exclude **ajax**:
|
||||
|
||||
```bash
|
||||
grunt custom:-ajax
|
||||
```
|
||||
|
||||
Exclude **css**:
|
||||
|
||||
```bash
|
||||
grunt custom:-css
|
||||
```
|
||||
|
||||
Exclude **deprecated**:
|
||||
|
||||
```bash
|
||||
grunt custom:-deprecated
|
||||
```
|
||||
|
||||
Exclude **dimensions**:
|
||||
|
||||
```bash
|
||||
grunt custom:-dimensions
|
||||
```
|
||||
|
||||
Exclude **effects**:
|
||||
|
||||
```bash
|
||||
grunt custom:-effects
|
||||
```
|
||||
|
||||
Exclude **offset**:
|
||||
|
||||
```bash
|
||||
grunt custom:-offset
|
||||
```
|
||||
|
||||
Exclude **all** optional modules:
|
||||
|
||||
```bash
|
||||
grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-offset
|
||||
```
|
||||
|
||||
|
||||
Note: dependencies will be handled internally, by the build process.
|
||||
|
||||
|
||||
Running the Unit Tests
|
||||
--------------------------------------
|
||||
|
||||
|
||||
Start grunt to auto-build jQuery as you work:
|
||||
|
||||
```bash
|
||||
cd jquery && grunt watch
|
||||
```
|
||||
|
||||
|
||||
Run the unit tests with a local server that supports PHP. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:
|
||||
|
||||
- Windows: [WAMP download](http://www.wampserver.com/en/)
|
||||
- Mac: [MAMP download](http://www.mamp.info/en/index.html)
|
||||
- Linux: [Setting up LAMP](https://www.linux.com/learn/tutorials/288158-easy-lamp-server-installation)
|
||||
- [Mongoose (most platforms)](http://code.google.com/p/mongoose/)
|
||||
|
||||
|
||||
|
||||
|
||||
Building to a different directory
|
||||
---------------------------------
|
||||
|
||||
If you want to build jQuery to a directory that is different from the default location:
|
||||
|
||||
```bash
|
||||
grunt && grunt dist:/path/to/special/location/
|
||||
```
|
||||
With this example, the output files would be:
|
||||
|
||||
```bash
|
||||
/path/to/special/location/jquery.js
|
||||
/path/to/special/location/jquery.min.js
|
||||
```
|
||||
|
||||
If you want to add a permanent copy destination, create a file in `dist/` called ".destination.json". Inside the file, paste and customize the following:
|
||||
|
||||
```json
|
||||
|
||||
{
|
||||
"/Absolute/path/to/other/destination": true
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Additionally, both methods can be combined.
|
||||
|
||||
|
||||
|
||||
Updating Submodules
|
||||
-------------------
|
||||
|
||||
Update the submodules to what is probably the latest upstream code.
|
||||
|
||||
```bash
|
||||
grunt update_submodules
|
||||
```
|
||||
|
||||
Note: This task will also be run any time the default `grunt` command is used.
|
||||
|
||||
|
||||
|
||||
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:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/jquery/jquery.git
|
||||
cd jquery
|
||||
git submodule init
|
||||
git submodule update
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/jquery/jquery.git
|
||||
cd jquery
|
||||
git submodule update --init
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
```bash
|
||||
git clone --recursive https://github.com/jquery/jquery.git
|
||||
cd jquery
|
||||
```
|
||||
|
||||
If you want to work inside a submodule, it is possible, but first you need to checkout a branch:
|
||||
|
||||
```bash
|
||||
cd src/sizzle
|
||||
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:
|
||||
|
||||
```bash
|
||||
cd src/sizzle
|
||||
git push origin master
|
||||
cd ..
|
||||
git add src/sizzle
|
||||
git commit
|
||||
```
|
||||
|
||||
|
||||
### 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):
|
||||
|
||||
```bash
|
||||
git reset --hard upstream/master
|
||||
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:
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
[QUnit](http://docs.jquery.com/QUnit) Reference
|
||||
-----------------
|
||||
|
||||
### Test methods ###
|
||||
|
||||
```js
|
||||
expect( numAssertions );
|
||||
stop();
|
||||
start();
|
||||
```
|
||||
|
||||
|
||||
note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite so that start and stop can be passed as callbacks without worrying about their parameters
|
||||
|
||||
### Test assertions ###
|
||||
|
||||
|
||||
```js
|
||||
ok( value, [message] );
|
||||
equal( actual, expected, [message] );
|
||||
notEqual( actual, expected, [message] );
|
||||
deepEqual( actual, expected, [message] );
|
||||
notDeepEqual( actual, expected, [message] );
|
||||
strictEqual( actual, expected, [message] );
|
||||
notStrictEqual( actual, expected, [message] );
|
||||
raises( block, [expected], [message] );
|
||||
```
|
||||
|
||||
|
||||
Test Suite Convenience Methods Reference (See [test/data/testinit.js](https://github.com/jquery/jquery/blob/master/test/data/testinit.js))
|
||||
------------------------------
|
||||
|
||||
### Returns an array of elements with the given IDs ###
|
||||
|
||||
```js
|
||||
q( ... );
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
q("main", "foo", "bar");
|
||||
|
||||
=> [ div#main, span#foo, input#bar ]
|
||||
```
|
||||
|
||||
### Asserts that a selection matches the given IDs ###
|
||||
|
||||
```js
|
||||
t( testName, selector, [ "array", "of", "ids" ] );
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
t("Check for something", "//[a]", ["foo", "baar"]);
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Fires a native DOM event without going through jQuery ###
|
||||
|
||||
```js
|
||||
fireNative( node, eventType )
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
fireNative( jQuery("#elem")[0], "click" );
|
||||
```
|
||||
|
||||
### Add random number to url to stop caching ###
|
||||
|
||||
```js
|
||||
url( "some/url.php" );
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
url("data/test.html");
|
||||
|
||||
=> "data/test.html?10538358428943"
|
||||
|
||||
|
||||
url("data/test.php?foo=bar");
|
||||
|
||||
=> "data/test.php?foo=bar&10538358345554"
|
||||
```
|
||||
|
||||
|
||||
### Load tests in an iframe ###
|
||||
|
||||
Loads a given page constructing a url with fileName: `"./data/" + fileName + ".html"`
|
||||
and fires the given callback on jQuery ready (using the jQuery loading from that page)
|
||||
and passes the iFrame's jQuery to the callback.
|
||||
|
||||
```js
|
||||
testIframe( fileName, testName, callback );
|
||||
```
|
||||
|
||||
Callback arguments:
|
||||
|
||||
```js
|
||||
callback( jQueryFromIFrame, iFrameWindow, iFrameDocument );
|
||||
```
|
||||
|
||||
### Load tests in an iframe (window.iframeCallback) ###
|
||||
|
||||
Loads a given page constructing a url with fileName: `"./data/" + fileName + ".html"`
|
||||
The given callback is fired when window.iframeCallback is called by the page
|
||||
The arguments passed to the callback are the same as the
|
||||
arguments passed to window.iframeCallback, whatever that may be
|
||||
|
||||
```js
|
||||
testIframeWithCallback( testName, fileName, callback );
|
||||
```
|
||||
|
||||
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.
|
||||
4
vendor/json3/LICENSE
vendored
4
vendor/json3/LICENSE
vendored
@@ -1,5 +1,5 @@
|
||||
Copyright (c) 2012 Kit Cambridge.
|
||||
http://kitcambridge.github.com
|
||||
Copyright (c) 2012-2013 Kit Cambridge.
|
||||
http://kitcambridge.be/
|
||||
|
||||
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
|
||||
|
||||
124
vendor/json3/README.md
vendored
124
vendor/json3/README.md
vendored
@@ -1,124 +0,0 @@
|
||||
# JSON 3 #
|
||||
|
||||

|
||||
|
||||
**JSON 3** is a modern JSON implementation compatible with a variety of JavaScript platforms, including Internet Explorer 6, Opera 7, Safari 2, and Netscape 6. The current version is **3.2.4**.
|
||||
|
||||
- [Development Version](http://cdnjs.cloudflare.com/ajax/libs/json3/3.2.4/json3.js) *(36.5 KB; uncompressed with comments)*
|
||||
- [Production Version](http://cdnjs.cloudflare.com/ajax/libs/json3/3.2.4/json3.min.js) *(3.0 KB; compressed and `gzip`-ped)*
|
||||
|
||||
[JSON](http://json.org/) is a language-independent data interchange format based on a loose subset of the JavaScript grammar. Originally popularized by [Douglas Crockford](http://www.crockford.com/), the format was standardized in the [fifth edition](http://es5.github.com/) of the ECMAScript specification. The 5.1 edition, ratified in June 2011, incorporates several modifications to the grammar pertaining to the serialization of dates.
|
||||
|
||||
JSON 3 exposes two functions: `stringify()` for [serializing](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/stringify) a JavaScript value to JSON, and `parse()` for [producing](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON/parse) a JavaScript value from a JSON source string. It is a **drop-in replacement** for [JSON 2](http://json.org/js). The functions behave exactly as described in the ECMAScript spec, **except** for the date serialization discrepancy noted below.
|
||||
|
||||
The JSON 3 parser does **not** use `eval` or regular expressions. This provides security and performance benefits in obsolete and mobile environments, where the margin is particularly significant. The complete [benchmark suite](http://jsperf.com/json3) is available on [jsPerf](http://jsperf.com/).
|
||||
|
||||
The project is [hosted on GitHub](http://git.io/json3), along with the [unit tests](http://bestiejs.github.com/json3/test/test_browser.html). It is part of the [BestieJS](https://github.com/bestiejs) family, a collection of best-in-class JavaScript libraries that promote cross-platform support, specification precedents, unit testing, and plenty of documentation.
|
||||
|
||||
# Changes from JSON 2 #
|
||||
|
||||
JSON 3...
|
||||
|
||||
* Correctly serializes primitive wrapper objects.
|
||||
* Throws a `TypeError` when serializing cyclic structures (JSON 2 recurses until the call stack overflows).
|
||||
* Utilizes **feature tests** to detect broken or incomplete *native* JSON implementations (JSON 2 only checks for the presence of the native functions). The tests are only executed once at runtime, so there is no additional performance cost when parsing or serializing values.
|
||||
|
||||
**As of v3.2.3**, JSON 3 is compatible with [Prototype](http://prototypejs.org) 1.6.1 and older.
|
||||
|
||||
In contrast to JSON 2, JSON 3 **does not**...
|
||||
|
||||
* Add `toJSON()` methods to the `Boolean`, `Number`, and `String` prototypes. These are not part of any standard, and are made redundant by the design of the `stringify()` implementation.
|
||||
* Add `toJSON()` or `toISOString()` methods to `Date.prototype`. See the note about date serialization below.
|
||||
|
||||
## Date Serialization
|
||||
|
||||
**JSON 3 deviates from the specification in one important way**: it does not define `Date#toISOString()` or `Date#toJSON()`. This preserves CommonJS compatibility and avoids polluting native prototypes. Instead, date serialization is performed internally by the `stringify()` implementation: if a date object does not define a custom `toJSON()` method, it is serialized as a [simplified ISO 8601 date-time string](http://es5.github.com/#x15.9.1.15).
|
||||
|
||||
**Several native `Date#toJSON()` implementations produce date time strings that do *not* conform to the grammar outlined in the spec**. For instance, all versions of Safari 4, as well as JSON 2, fail to serialize extended years correctly. Furthermore, JSON 2 and older implementations omit the milliseconds from the date-time string (optional in ES 5, but required in 5.1). Finally, in all versions of Safari 4 and 5, serializing an invalid date will produce the string `"Invalid Date"`, rather than `null`. Because these environments exhibit other serialization bugs, however, JSON 3 will override the native `stringify()` implementation.
|
||||
|
||||
Portions of the date serialization code are adapted from the [`date-shim`](https://github.com/Yaffle/date-shim) project.
|
||||
|
||||
# Usage #
|
||||
|
||||
## Web Browsers
|
||||
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/json3/3.2.4/json3.min.js"></script>
|
||||
<script>
|
||||
JSON.stringify({"Hello": 123});
|
||||
// => '{"Hello":123}'
|
||||
JSON.parse("[[1, 2, 3], 1, 2, 3, 4]", function (key, value) {
|
||||
if (typeof value == "number") {
|
||||
value = value % 2 ? "Odd" : "Even";
|
||||
}
|
||||
return value;
|
||||
});
|
||||
// => [["Odd", "Even", "Odd"], "Odd", "Even", "Odd", "Even"]
|
||||
</script>
|
||||
|
||||
## CommonJS Environments
|
||||
|
||||
var JSON3 = require("./path/to/json3");
|
||||
JSON3.parse("[1, 2, 3]");
|
||||
// => [1, 2, 3]
|
||||
|
||||
## JavaScript Engines
|
||||
|
||||
load("path/to/json3.js");
|
||||
JSON.stringify({"Hello": 123, "Good-bye": 456}, ["Hello"], "\t");
|
||||
// => '{\n\t"Hello": 123\n}'
|
||||
|
||||
# Compatibility #
|
||||
|
||||
JSON 3 has been **tested** with the following web browsers, CommonJS environments, and JavaScript engines.
|
||||
|
||||
## Web Browsers
|
||||
|
||||
- Windows [Internet Explorer](http://www.microsoft.com/windows/internet-explorer), version 6.0 and higher
|
||||
- Mozilla [Firefox](http://www.mozilla.com/firefox), version 1.0 and higher
|
||||
- Apple [Safari](http://www.apple.com/safari), version 2.0 and higher
|
||||
- [Opera](http://www.opera.com) 7.02 and higher
|
||||
- [Mozilla](http://sillydog.org/narchive/gecko.php) 1.0, [Netscape](http://sillydog.org/narchive/) 6.2.3, and [SeaMonkey](http://www.seamonkey-project.org/) 1.0 and higher
|
||||
|
||||
## CommonJS Environments
|
||||
|
||||
- [Node](http://nodejs.org/) 0.2.6 and higher
|
||||
- [RingoJS](http://ringojs.org/) 0.4 and higher
|
||||
- [Narwhal](http://narwhaljs.org/) 0.3.2 and higher
|
||||
|
||||
## JavaScript Engines
|
||||
|
||||
- Mozilla [Rhino](http://www.mozilla.org/rhino) 1.5R5 and higher
|
||||
- WebKit [JSC](https://trac.webkit.org/wiki/JSC)
|
||||
- Google [V8](http://code.google.com/p/v8)
|
||||
|
||||
## Known Incompatibilities
|
||||
|
||||
* Attempting to serialize the `arguments` object may produce inconsistent results across environments due to specification version differences. As a workaround, please convert the `arguments` object to an array first: `JSON.stringify([].slice.call(arguments, 0))`.
|
||||
|
||||
## Required Native Methods
|
||||
|
||||
JSON 3 assumes that the following methods exist and function as described in the ECMAScript specification:
|
||||
|
||||
- The `Number`, `String`, `Array`, `Object`, `Date`, `SyntaxError`, and `TypeError` constructors.
|
||||
- `String.fromCharCode`
|
||||
- `Object#toString`
|
||||
- `Function#call`
|
||||
- `Math.floor`
|
||||
- `Number#toString`
|
||||
- `Date#valueOf`
|
||||
- `String.prototype`: `indexOf`, `charCodeAt`, `charAt`, `slice`.
|
||||
- `Array.prototype`: `push`, `pop`, `join`.
|
||||
|
||||
# Contribute #
|
||||
|
||||
Check out a working copy of the JSON 3 source code with [Git](http://git-scm.com/):
|
||||
|
||||
$ git clone git://github.com/bestiejs/json3.git
|
||||
$ cd json3
|
||||
$ git submodule update --init
|
||||
|
||||
If you'd like to contribute a feature or bug fix, you can [fork](http://help.github.com/fork-a-repo/) JSON 3, commit your changes, and [send a pull request](http://help.github.com/send-pull-requests/). Please make sure to update the unit tests in the `test` directory as well.
|
||||
|
||||
Alternatively, you can use the [GitHub issue tracker](https://github.com/bestiejs/json3/issues) to submit bug reports, feature requests, and questions, or send tweets to [@kitcambridge](http://twitter.com/kitcambridge).
|
||||
|
||||
JSON 3 is released under the [MIT License](http://kit.mit-license.org/).
|
||||
541
vendor/json3/lib/json3.js
vendored
541
vendor/json3/lib/json3.js
vendored
@@ -1,41 +1,36 @@
|
||||
/*! JSON v3.2.4 | http://bestiejs.github.com/json3 | Copyright 2012, Kit Cambridge | http://kit.mit-license.org */
|
||||
;(function () {
|
||||
/*! JSON v3.2.5 | http://bestiejs.github.io/json3 | Copyright 2012-2013, Kit Cambridge | http://kit.mit-license.org */
|
||||
;(function (window) {
|
||||
// Convenience aliases.
|
||||
var getClass = {}.toString, isProperty, forEach, undef;
|
||||
|
||||
// Detect the `define` function exposed by asynchronous module loaders. The
|
||||
// strict `define` check is necessary for compatibility with `r.js`.
|
||||
var isLoader = typeof define === "function" && define.amd, JSON3 = !isLoader && typeof exports == "object" && exports;
|
||||
var isLoader = typeof define === "function" && define.amd, JSON3 = typeof exports == "object" && exports;
|
||||
|
||||
if (JSON3 || isLoader) {
|
||||
if (typeof JSON == "object" && JSON) {
|
||||
// Delegate to the native `stringify` and `parse` implementations in
|
||||
// asynchronous module loaders and CommonJS environments.
|
||||
if (isLoader) {
|
||||
JSON3 = JSON;
|
||||
} else {
|
||||
if (JSON3) {
|
||||
JSON3.stringify = JSON.stringify;
|
||||
JSON3.parse = JSON.parse;
|
||||
} else {
|
||||
JSON3 = JSON;
|
||||
}
|
||||
} else if (isLoader) {
|
||||
JSON3 = this.JSON = {};
|
||||
JSON3 = window.JSON = {};
|
||||
}
|
||||
} else {
|
||||
// Export for web browsers and JavaScript engines.
|
||||
JSON3 = this.JSON || (this.JSON = {});
|
||||
JSON3 = window.JSON || (window.JSON = {});
|
||||
}
|
||||
|
||||
// Local variables.
|
||||
var Escapes, toPaddedString, quote, serialize;
|
||||
var fromCharCode, Unescapes, abort, lex, get, walk, update, Index, Source;
|
||||
|
||||
// Test the `Date#getUTC*` methods. Based on work by @Yaffle.
|
||||
var isExtended = new Date(-3509827334573292), floor, Months, getDay;
|
||||
|
||||
var isExtended = new Date(-3509827334573292);
|
||||
try {
|
||||
// The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
|
||||
// results for certain dates in Opera >= 10.53.
|
||||
isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() == 1 &&
|
||||
isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&
|
||||
// Safari < 2.0.2 stores the internal millisecond time value correctly,
|
||||
// but clips the values returned by the date methods to the range of
|
||||
// signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).
|
||||
@@ -45,11 +40,17 @@
|
||||
// Internal: Determines whether the native `JSON.stringify` and `parse`
|
||||
// implementations are spec-compliant. Based on work by Ken Snyder.
|
||||
function has(name) {
|
||||
var stringifySupported, parseSupported, value, serialized = '{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}', all = name == "json";
|
||||
if (all || name == "json-stringify" || name == "json-parse") {
|
||||
if (name == "bug-string-char-index") {
|
||||
// IE <= 7 doesn't support accessing string characters using square
|
||||
// bracket notation. IE 8 only supports this for primitives.
|
||||
return "a"[0] != "a";
|
||||
}
|
||||
var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}', isAll = name == "json";
|
||||
if (isAll || name == "json-stringify" || name == "json-parse") {
|
||||
// Test `JSON.stringify`.
|
||||
if (name == "json-stringify" || all) {
|
||||
if ((stringifySupported = typeof JSON3.stringify == "function" && isExtended)) {
|
||||
if (name == "json-stringify" || isAll) {
|
||||
var stringify = JSON3.stringify, stringifySupported = typeof stringify == "function" && isExtended;
|
||||
if (stringifySupported) {
|
||||
// A test function object with a custom `toJSON` method.
|
||||
(value = function () {
|
||||
return 1;
|
||||
@@ -58,86 +59,88 @@
|
||||
stringifySupported =
|
||||
// Firefox 3.1b1 and b2 serialize string, number, and boolean
|
||||
// primitives as object literals.
|
||||
JSON3.stringify(0) === "0" &&
|
||||
stringify(0) === "0" &&
|
||||
// FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
|
||||
// literals.
|
||||
JSON3.stringify(new Number()) === "0" &&
|
||||
JSON3.stringify(new String()) == '""' &&
|
||||
stringify(new Number()) === "0" &&
|
||||
stringify(new String()) == '""' &&
|
||||
// FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
|
||||
// does not define a canonical JSON representation (this applies to
|
||||
// objects with `toJSON` properties as well, *unless* they are nested
|
||||
// within an object or array).
|
||||
JSON3.stringify(getClass) === undef &&
|
||||
stringify(getClass) === undef &&
|
||||
// IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
|
||||
// FF 3.1b3 pass this test.
|
||||
JSON3.stringify(undef) === undef &&
|
||||
stringify(undef) === undef &&
|
||||
// Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
|
||||
// respectively, if the value is omitted entirely.
|
||||
JSON3.stringify() === undef &&
|
||||
stringify() === undef &&
|
||||
// FF 3.1b1, 2 throw an error if the given value is not a number,
|
||||
// string, array, object, Boolean, or `null` literal. This applies to
|
||||
// objects with custom `toJSON` methods as well, unless they are nested
|
||||
// inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
|
||||
// methods entirely.
|
||||
JSON3.stringify(value) === "1" &&
|
||||
JSON3.stringify([value]) == "[1]" &&
|
||||
stringify(value) === "1" &&
|
||||
stringify([value]) == "[1]" &&
|
||||
// Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
|
||||
// `"[null]"`.
|
||||
JSON3.stringify([undef]) == "[null]" &&
|
||||
stringify([undef]) == "[null]" &&
|
||||
// YUI 3.0.0b1 fails to serialize `null` literals.
|
||||
JSON3.stringify(null) == "null" &&
|
||||
stringify(null) == "null" &&
|
||||
// FF 3.1b1, 2 halts serialization if an array contains a function:
|
||||
// `[1, true, getClass, 1]` serializes as "[1,true,],". These versions
|
||||
// of Firefox also allow trailing commas in JSON objects and arrays.
|
||||
// FF 3.1b3 elides non-JSON values from objects and arrays, unless they
|
||||
// define custom `toJSON` methods.
|
||||
JSON3.stringify([undef, getClass, null]) == "[null,null,null]" &&
|
||||
stringify([undef, getClass, null]) == "[null,null,null]" &&
|
||||
// Simple serialization test. FF 3.1b1 uses Unicode escape sequences
|
||||
// where character escape codes are expected (e.g., `\b` => `\u0008`).
|
||||
JSON3.stringify({ "A": [value, true, false, null, "\0\b\n\f\r\t"] }) == serialized &&
|
||||
stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized &&
|
||||
// FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
|
||||
JSON3.stringify(null, value) === "1" &&
|
||||
JSON3.stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
|
||||
stringify(null, value) === "1" &&
|
||||
stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" &&
|
||||
// JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
|
||||
// serialize extended years.
|
||||
JSON3.stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
|
||||
stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' &&
|
||||
// The milliseconds are optional in ES 5, but required in 5.1.
|
||||
JSON3.stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
|
||||
stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' &&
|
||||
// Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
|
||||
// four-digit years instead of six-digit years. Credits: @Yaffle.
|
||||
JSON3.stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
|
||||
stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' &&
|
||||
// Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
|
||||
// values less than 1000. Credits: @Yaffle.
|
||||
JSON3.stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
|
||||
stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
|
||||
} catch (exception) {
|
||||
stringifySupported = false;
|
||||
}
|
||||
}
|
||||
if (!all) {
|
||||
if (!isAll) {
|
||||
return stringifySupported;
|
||||
}
|
||||
}
|
||||
// Test `JSON.parse`.
|
||||
if (name == "json-parse" || all) {
|
||||
if (typeof JSON3.parse == "function") {
|
||||
if (name == "json-parse" || isAll) {
|
||||
var parse = JSON3.parse;
|
||||
if (typeof parse == "function") {
|
||||
try {
|
||||
// FF 3.1b1, b2 will throw an exception if a bare literal is provided.
|
||||
// Conforming implementations should also coerce the initial argument to
|
||||
// a string prior to parsing.
|
||||
if (JSON3.parse("0") === 0 && !JSON3.parse(false)) {
|
||||
if (parse("0") === 0 && !parse(false)) {
|
||||
// Simple parsing test.
|
||||
value = JSON3.parse(serialized);
|
||||
if ((parseSupported = value.A.length == 5 && value.A[0] == 1)) {
|
||||
value = parse(serialized);
|
||||
var parseSupported = value["a"].length == 5 && value["a"][0] === 1;
|
||||
if (parseSupported) {
|
||||
try {
|
||||
// Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.
|
||||
parseSupported = !JSON3.parse('"\t"');
|
||||
parseSupported = !parse('"\t"');
|
||||
} catch (exception) {}
|
||||
if (parseSupported) {
|
||||
try {
|
||||
// FF 4.0 and 4.0.1 allow leading `+` signs, and leading and
|
||||
// trailing decimal points. FF 4.0, 4.0.1, and IE 9-10 also
|
||||
// allow certain octal literals.
|
||||
parseSupported = JSON3.parse("01") != 1;
|
||||
parseSupported = parse("01") !== 1;
|
||||
} catch (exception) {}
|
||||
}
|
||||
}
|
||||
@@ -146,7 +149,7 @@
|
||||
parseSupported = false;
|
||||
}
|
||||
}
|
||||
if (!all) {
|
||||
if (!isAll) {
|
||||
return parseSupported;
|
||||
}
|
||||
}
|
||||
@@ -155,19 +158,30 @@
|
||||
}
|
||||
|
||||
if (!has("json")) {
|
||||
// Common `[[Class]]` name aliases.
|
||||
var functionClass = "[object Function]";
|
||||
var dateClass = "[object Date]";
|
||||
var numberClass = "[object Number]";
|
||||
var stringClass = "[object String]";
|
||||
var arrayClass = "[object Array]";
|
||||
var booleanClass = "[object Boolean]";
|
||||
|
||||
// Detect incomplete support for accessing string characters by index.
|
||||
var charIndexBuggy = has("bug-string-char-index");
|
||||
|
||||
// Define additional utility methods if the `Date` methods are buggy.
|
||||
if (!isExtended) {
|
||||
floor = Math.floor;
|
||||
var floor = Math.floor;
|
||||
// A mapping between the months of the year and the number of days between
|
||||
// January 1st and the first of the respective month.
|
||||
Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
|
||||
var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
|
||||
// Internal: Calculates the number of days between the Unix epoch and the
|
||||
// first day of the given month.
|
||||
getDay = function (year, month) {
|
||||
var getDay = function (year, month) {
|
||||
return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Internal: Determines if a property is a direct property of the given
|
||||
// object. Delegates to the native `Object#hasOwnProperty` method.
|
||||
if (!(isProperty = {}.hasOwnProperty)) {
|
||||
@@ -233,7 +247,7 @@
|
||||
// IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable
|
||||
// properties.
|
||||
forEach = function (object, callback) {
|
||||
var isFunction = getClass.call(object) == "[object Function]", property, length;
|
||||
var isFunction = getClass.call(object) == functionClass, property, length;
|
||||
for (property in object) {
|
||||
// Gecko <= 1.0 enumerates the `prototype` property of functions under
|
||||
// certain conditions; IE does not.
|
||||
@@ -248,7 +262,7 @@
|
||||
// Safari <= 2.0.4 enumerates shadowed properties twice.
|
||||
forEach = function (object, callback) {
|
||||
// Create a set of iterated properties.
|
||||
var members = {}, isFunction = getClass.call(object) == "[object Function]", property;
|
||||
var members = {}, isFunction = getClass.call(object) == functionClass, property;
|
||||
for (property in object) {
|
||||
// Store each property name to prevent double enumeration. The
|
||||
// `prototype` property of functions is not enumerated due to cross-
|
||||
@@ -261,7 +275,7 @@
|
||||
} else {
|
||||
// No bugs detected; use the standard `for...in` algorithm.
|
||||
forEach = function (object, callback) {
|
||||
var isFunction = getClass.call(object) == "[object Function]", property, isConstructor;
|
||||
var isFunction = getClass.call(object) == functionClass, property, isConstructor;
|
||||
for (property in object) {
|
||||
if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) {
|
||||
callback(property);
|
||||
@@ -285,48 +299,65 @@
|
||||
// level of the output.
|
||||
if (!has("json-stringify")) {
|
||||
// Internal: A map of control characters and their escaped equivalents.
|
||||
Escapes = {
|
||||
"\\": "\\\\",
|
||||
'"': '\\"',
|
||||
"\b": "\\b",
|
||||
"\f": "\\f",
|
||||
"\n": "\\n",
|
||||
"\r": "\\r",
|
||||
"\t": "\\t"
|
||||
var Escapes = {
|
||||
92: "\\\\",
|
||||
34: '\\"',
|
||||
8: "\\b",
|
||||
12: "\\f",
|
||||
10: "\\n",
|
||||
13: "\\r",
|
||||
9: "\\t"
|
||||
};
|
||||
|
||||
// Internal: Converts `value` into a zero-padded string such that its
|
||||
// length is at least equal to `width`. The `width` must be <= 6.
|
||||
toPaddedString = function (width, value) {
|
||||
var leadingZeroes = "000000";
|
||||
var toPaddedString = function (width, value) {
|
||||
// The `|| 0` expression is necessary to work around a bug in
|
||||
// Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.
|
||||
return ("000000" + (value || 0)).slice(-width);
|
||||
return (leadingZeroes + (value || 0)).slice(-width);
|
||||
};
|
||||
|
||||
// Internal: Double-quotes a string `value`, replacing all ASCII control
|
||||
// characters (characters with code unit values between 0 and 31) with
|
||||
// their escaped equivalents. This is an implementation of the
|
||||
// `Quote(value)` operation defined in ES 5.1 section 15.12.3.
|
||||
quote = function (value) {
|
||||
var result = '"', index = 0, symbol;
|
||||
for (; symbol = value.charAt(index); index++) {
|
||||
// Escape the reverse solidus, double quote, backspace, form feed, line
|
||||
// feed, carriage return, and tab characters.
|
||||
result += '\\"\b\f\n\r\t'.indexOf(symbol) > -1 ? Escapes[symbol] :
|
||||
// If the character is a control character, append its Unicode escape
|
||||
// sequence; otherwise, append the character as-is.
|
||||
(Escapes[symbol] = symbol < " " ? "\\u00" + toPaddedString(2, symbol.charCodeAt(0).toString(16)) : symbol);
|
||||
var unicodePrefix = "\\u00";
|
||||
var quote = function (value) {
|
||||
var result = '"', index = 0, length = value.length, isLarge = length > 10 && charIndexBuggy, symbols;
|
||||
if (isLarge) {
|
||||
symbols = value.split("");
|
||||
}
|
||||
for (; index < length; index++) {
|
||||
var charCode = value.charCodeAt(index);
|
||||
// If the character is a control character, append its Unicode or
|
||||
// shorthand escape sequence; otherwise, append the character as-is.
|
||||
switch (charCode) {
|
||||
case 8: case 9: case 10: case 12: case 13: case 34: case 92:
|
||||
result += Escapes[charCode];
|
||||
break;
|
||||
default:
|
||||
if (charCode < 32) {
|
||||
result += unicodePrefix + toPaddedString(2, charCode.toString(16));
|
||||
break;
|
||||
}
|
||||
result += isLarge ? symbols[index] : charIndexBuggy ? value.charAt(index) : value[index];
|
||||
}
|
||||
}
|
||||
return result + '"';
|
||||
};
|
||||
|
||||
// Internal: Recursively serializes an object. Implements the
|
||||
// `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.
|
||||
serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
|
||||
var value = object[property], className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, any, result;
|
||||
var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {
|
||||
var value = object[property], className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, hasMembers, result;
|
||||
try {
|
||||
// Necessary for host object support.
|
||||
value = object[property];
|
||||
} catch (exception) {}
|
||||
if (typeof value == "object" && value) {
|
||||
className = getClass.call(value);
|
||||
if (className == "[object Date]" && !isProperty.call(value, "toJSON")) {
|
||||
if (className == dateClass && !isProperty.call(value, "toJSON")) {
|
||||
if (value > -1 / 0 && value < 1 / 0) {
|
||||
// Dates are serialized according to the `Date#toJSON` method
|
||||
// specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15
|
||||
@@ -370,7 +401,7 @@
|
||||
} else {
|
||||
value = null;
|
||||
}
|
||||
} else if (typeof value.toJSON == "function" && ((className != "[object Number]" && className != "[object String]" && className != "[object Array]") || isProperty.call(value, "toJSON"))) {
|
||||
} else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) {
|
||||
// Prototype <= 1.6.1 adds non-standard `toJSON` methods to the
|
||||
// `Number`, `String`, `Date`, and `Array` prototypes. JSON 3
|
||||
// ignores all `toJSON` methods on these objects unless they are
|
||||
@@ -387,14 +418,14 @@
|
||||
return "null";
|
||||
}
|
||||
className = getClass.call(value);
|
||||
if (className == "[object Boolean]") {
|
||||
if (className == booleanClass) {
|
||||
// Booleans are represented literally.
|
||||
return "" + value;
|
||||
} else if (className == "[object Number]") {
|
||||
} else if (className == numberClass) {
|
||||
// JSON numbers must be finite. `Infinity` and `NaN` are serialized as
|
||||
// `"null"`.
|
||||
return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";
|
||||
} else if (className == "[object String]") {
|
||||
} else if (className == stringClass) {
|
||||
// Strings are double-quoted and escaped.
|
||||
return quote(value);
|
||||
}
|
||||
@@ -414,13 +445,13 @@
|
||||
// Save the current indentation level and indent one additional level.
|
||||
prefix = indentation;
|
||||
indentation += whitespace;
|
||||
if (className == "[object Array]") {
|
||||
if (className == arrayClass) {
|
||||
// Recursively serialize array elements.
|
||||
for (index = 0, length = value.length; index < length; any || (any = true), index++) {
|
||||
for (index = 0, length = value.length; index < length; hasMembers || (hasMembers = true), index++) {
|
||||
element = serialize(index, value, callback, properties, whitespace, indentation, stack);
|
||||
results.push(element === undef ? "null" : element);
|
||||
}
|
||||
result = any ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]";
|
||||
result = hasMembers ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]";
|
||||
} else {
|
||||
// Recursively serialize object members. Members are selected from
|
||||
// either a user-specified list of property names, or the object
|
||||
@@ -436,9 +467,9 @@
|
||||
// `JSON.stringify`.
|
||||
results.push(quote(property) + ":" + (whitespace ? " " : "") + element);
|
||||
}
|
||||
any || (any = true);
|
||||
hasMembers || (hasMembers = true);
|
||||
});
|
||||
result = any ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}";
|
||||
result = hasMembers ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}";
|
||||
}
|
||||
// Remove the object from the traversed object stack.
|
||||
stack.pop();
|
||||
@@ -448,24 +479,24 @@
|
||||
|
||||
// Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
|
||||
JSON3.stringify = function (source, filter, width) {
|
||||
var whitespace, callback, properties, index, length, value;
|
||||
var whitespace, callback, properties;
|
||||
if (typeof filter == "function" || typeof filter == "object" && filter) {
|
||||
if (getClass.call(filter) == "[object Function]") {
|
||||
if (getClass.call(filter) == functionClass) {
|
||||
callback = filter;
|
||||
} else if (getClass.call(filter) == "[object Array]") {
|
||||
} else if (getClass.call(filter) == arrayClass) {
|
||||
// Convert the property names array into a makeshift set.
|
||||
properties = {};
|
||||
for (index = 0, length = filter.length; index < length; value = filter[index++], ((getClass.call(value) == "[object String]" || getClass.call(value) == "[object Number]") && (properties[value] = 1)));
|
||||
for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((getClass.call(value) == stringClass || getClass.call(value) == numberClass) && (properties[value] = 1)));
|
||||
}
|
||||
}
|
||||
if (width) {
|
||||
if (getClass.call(width) == "[object Number]") {
|
||||
if (getClass.call(width) == numberClass) {
|
||||
// Convert the `width` to an integer and create a string containing
|
||||
// `width` number of space characters.
|
||||
if ((width -= width % 1) > 0) {
|
||||
for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " ");
|
||||
}
|
||||
} else if (getClass.call(width) == "[object String]") {
|
||||
} else if (getClass.call(width) == stringClass) {
|
||||
whitespace = width.length <= 10 ? width : width.slice(0, 10);
|
||||
}
|
||||
}
|
||||
@@ -478,22 +509,26 @@
|
||||
|
||||
// Public: Parses a JSON source string.
|
||||
if (!has("json-parse")) {
|
||||
fromCharCode = String.fromCharCode;
|
||||
var fromCharCode = String.fromCharCode;
|
||||
|
||||
// Internal: A map of escaped control characters and their unescaped
|
||||
// equivalents.
|
||||
Unescapes = {
|
||||
"\\": "\\",
|
||||
'"': '"',
|
||||
"/": "/",
|
||||
"b": "\b",
|
||||
"t": "\t",
|
||||
"n": "\n",
|
||||
"f": "\f",
|
||||
"r": "\r"
|
||||
var Unescapes = {
|
||||
92: "\\",
|
||||
34: '"',
|
||||
47: "/",
|
||||
98: "\b",
|
||||
116: "\t",
|
||||
110: "\n",
|
||||
102: "\f",
|
||||
114: "\r"
|
||||
};
|
||||
|
||||
// Internal: Stores the parser state.
|
||||
var Index, Source;
|
||||
|
||||
// Internal: Resets the parser state and throws a `SyntaxError`.
|
||||
abort = function() {
|
||||
var abort = function() {
|
||||
Index = Source = null;
|
||||
throw SyntaxError();
|
||||
};
|
||||
@@ -501,140 +536,156 @@
|
||||
// Internal: Returns the next token, or `"$"` if the parser has reached
|
||||
// the end of the source string. A token may be a string, number, `null`
|
||||
// literal, or Boolean literal.
|
||||
lex = function () {
|
||||
var source = Source, length = source.length, symbol, value, begin, position, sign;
|
||||
var lex = function () {
|
||||
var source = Source, length = source.length, value, begin, position, isSigned, charCode;
|
||||
while (Index < length) {
|
||||
symbol = source.charAt(Index);
|
||||
if ("\t\r\n ".indexOf(symbol) > -1) {
|
||||
// Skip whitespace tokens, including tabs, carriage returns, line
|
||||
// feeds, and space characters.
|
||||
Index++;
|
||||
} else if ("{}[]:,".indexOf(symbol) > -1) {
|
||||
// Parse a punctuator token at the current position.
|
||||
Index++;
|
||||
return symbol;
|
||||
} else if (symbol == '"') {
|
||||
// Advance to the next character and parse a JSON string at the
|
||||
// current position. String tokens are prefixed with the sentinel
|
||||
// `@` character to distinguish them from punctuators.
|
||||
for (value = "@", Index++; Index < length;) {
|
||||
symbol = source.charAt(Index);
|
||||
if (symbol < " ") {
|
||||
// Unescaped ASCII control characters are not permitted.
|
||||
abort();
|
||||
} else if (symbol == "\\") {
|
||||
// Parse escaped JSON control characters, `"`, `\`, `/`, and
|
||||
// Unicode escape sequences.
|
||||
symbol = source.charAt(++Index);
|
||||
if ('\\"/btnfr'.indexOf(symbol) > -1) {
|
||||
// Revive escaped control characters.
|
||||
value += Unescapes[symbol];
|
||||
Index++;
|
||||
} else if (symbol == "u") {
|
||||
// Advance to the first character of the escape sequence.
|
||||
begin = ++Index;
|
||||
// Validate the Unicode escape sequence.
|
||||
for (position = Index + 4; Index < position; Index++) {
|
||||
symbol = source.charAt(Index);
|
||||
// A valid sequence comprises four hexdigits that form a
|
||||
// single hexadecimal value.
|
||||
if (!(symbol >= "0" && symbol <= "9" || symbol >= "a" && symbol <= "f" || symbol >= "A" && symbol <= "F")) {
|
||||
// Invalid Unicode escape sequence.
|
||||
abort();
|
||||
}
|
||||
}
|
||||
// Revive the escaped character.
|
||||
value += fromCharCode("0x" + source.slice(begin, Index));
|
||||
} else {
|
||||
// Invalid escape sequence.
|
||||
abort();
|
||||
}
|
||||
} else {
|
||||
if (symbol == '"') {
|
||||
// An unescaped double-quote character marks the end of the
|
||||
// string.
|
||||
break;
|
||||
}
|
||||
// Append the original character as-is.
|
||||
value += symbol;
|
||||
Index++;
|
||||
}
|
||||
}
|
||||
if (source.charAt(Index) == '"') {
|
||||
charCode = source.charCodeAt(Index);
|
||||
switch (charCode) {
|
||||
case 9: case 10: case 13: case 32:
|
||||
// Skip whitespace tokens, including tabs, carriage returns, line
|
||||
// feeds, and space characters.
|
||||
Index++;
|
||||
break;
|
||||
case 123: case 125: case 91: case 93: case 58: case 44:
|
||||
// Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at
|
||||
// the current position.
|
||||
value = charIndexBuggy ? source.charAt(Index) : source[Index];
|
||||
Index++;
|
||||
// Return the revived string.
|
||||
return value;
|
||||
}
|
||||
// Unterminated string.
|
||||
abort();
|
||||
} else {
|
||||
// Parse numbers and literals.
|
||||
begin = Index;
|
||||
// Advance the scanner's position past the sign, if one is
|
||||
// specified.
|
||||
if (symbol == "-") {
|
||||
sign = true;
|
||||
symbol = source.charAt(++Index);
|
||||
}
|
||||
// Parse an integer or floating-point value.
|
||||
if (symbol >= "0" && symbol <= "9") {
|
||||
// Leading zeroes are interpreted as octal literals.
|
||||
if (symbol == "0" && (symbol = source.charAt(Index + 1), symbol >= "0" && symbol <= "9")) {
|
||||
// Illegal octal literal.
|
||||
case 34:
|
||||
// `"` delimits a JSON string; advance to the next character and
|
||||
// begin parsing the string. String tokens are prefixed with the
|
||||
// sentinel `@` character to distinguish them from punctuators and
|
||||
// end-of-string tokens.
|
||||
for (value = "@", Index++; Index < length;) {
|
||||
charCode = source.charCodeAt(Index);
|
||||
if (charCode < 32) {
|
||||
// Unescaped ASCII control characters (those with a code unit
|
||||
// less than the space character) are not permitted.
|
||||
abort();
|
||||
} else if (charCode == 92) {
|
||||
// A reverse solidus (`\`) marks the beginning of an escaped
|
||||
// control character (including `"`, `\`, and `/`) or Unicode
|
||||
// escape sequence.
|
||||
charCode = source.charCodeAt(++Index);
|
||||
switch (charCode) {
|
||||
case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114:
|
||||
// Revive escaped control characters.
|
||||
value += Unescapes[charCode];
|
||||
Index++;
|
||||
break;
|
||||
case 117:
|
||||
// `\u` marks the beginning of a Unicode escape sequence.
|
||||
// Advance to the first character and validate the
|
||||
// four-digit code point.
|
||||
begin = ++Index;
|
||||
for (position = Index + 4; Index < position; Index++) {
|
||||
charCode = source.charCodeAt(Index);
|
||||
// A valid sequence comprises four hexdigits (case-
|
||||
// insensitive) that form a single hexadecimal value.
|
||||
if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {
|
||||
// Invalid Unicode escape sequence.
|
||||
abort();
|
||||
}
|
||||
}
|
||||
// Revive the escaped character.
|
||||
value += fromCharCode("0x" + source.slice(begin, Index));
|
||||
break;
|
||||
default:
|
||||
// Invalid escape sequence.
|
||||
abort();
|
||||
}
|
||||
} else {
|
||||
if (charCode == 34) {
|
||||
// An unescaped double-quote character marks the end of the
|
||||
// string.
|
||||
break;
|
||||
}
|
||||
charCode = source.charCodeAt(Index);
|
||||
begin = Index;
|
||||
// Optimize for the common case where a string is valid.
|
||||
while (charCode >= 32 && charCode != 92 && charCode != 34) {
|
||||
charCode = source.charCodeAt(++Index);
|
||||
}
|
||||
// Append the string as-is.
|
||||
value += source.slice(begin, Index);
|
||||
}
|
||||
}
|
||||
if (source.charCodeAt(Index) == 34) {
|
||||
// Advance to the next character and return the revived string.
|
||||
Index++;
|
||||
return value;
|
||||
}
|
||||
// Unterminated string.
|
||||
abort();
|
||||
default:
|
||||
// Parse numbers and literals.
|
||||
begin = Index;
|
||||
// Advance past the negative sign, if one is specified.
|
||||
if (charCode == 45) {
|
||||
isSigned = true;
|
||||
charCode = source.charCodeAt(++Index);
|
||||
}
|
||||
// Parse an integer or floating-point value.
|
||||
if (charCode >= 48 && charCode <= 57) {
|
||||
// Leading zeroes are interpreted as octal literals.
|
||||
if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) {
|
||||
// Illegal octal literal.
|
||||
abort();
|
||||
}
|
||||
isSigned = false;
|
||||
// Parse the integer component.
|
||||
for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++);
|
||||
// Floats cannot contain a leading decimal point; however, this
|
||||
// case is already accounted for by the parser.
|
||||
if (source.charCodeAt(Index) == 46) {
|
||||
position = ++Index;
|
||||
// Parse the decimal component.
|
||||
for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
|
||||
if (position == Index) {
|
||||
// Illegal trailing decimal.
|
||||
abort();
|
||||
}
|
||||
Index = position;
|
||||
}
|
||||
// Parse exponents. The `e` denoting the exponent is
|
||||
// case-insensitive.
|
||||
charCode = source.charCodeAt(Index);
|
||||
if (charCode == 101 || charCode == 69) {
|
||||
charCode = source.charCodeAt(++Index);
|
||||
// Skip past the sign following the exponent, if one is
|
||||
// specified.
|
||||
if (charCode == 43 || charCode == 45) {
|
||||
Index++;
|
||||
}
|
||||
// Parse the exponential component.
|
||||
for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++);
|
||||
if (position == Index) {
|
||||
// Illegal empty exponent.
|
||||
abort();
|
||||
}
|
||||
Index = position;
|
||||
}
|
||||
// Coerce the parsed value to a JavaScript number.
|
||||
return +source.slice(begin, Index);
|
||||
}
|
||||
// A negative sign may only precede numbers.
|
||||
if (isSigned) {
|
||||
abort();
|
||||
}
|
||||
sign = false;
|
||||
// Parse the integer component.
|
||||
for (; Index < length && (symbol = source.charAt(Index), symbol >= "0" && symbol <= "9"); Index++);
|
||||
// Floats cannot contain a leading decimal point; however, this
|
||||
// case is already accounted for by the parser.
|
||||
if (source.charAt(Index) == ".") {
|
||||
position = ++Index;
|
||||
// Parse the decimal component.
|
||||
for (; position < length && (symbol = source.charAt(position), symbol >= "0" && symbol <= "9"); position++);
|
||||
if (position == Index) {
|
||||
// Illegal trailing decimal.
|
||||
abort();
|
||||
}
|
||||
Index = position;
|
||||
// `true`, `false`, and `null` literals.
|
||||
if (source.slice(Index, Index + 4) == "true") {
|
||||
Index += 4;
|
||||
return true;
|
||||
} else if (source.slice(Index, Index + 5) == "false") {
|
||||
Index += 5;
|
||||
return false;
|
||||
} else if (source.slice(Index, Index + 4) == "null") {
|
||||
Index += 4;
|
||||
return null;
|
||||
}
|
||||
// Parse exponents.
|
||||
symbol = source.charAt(Index);
|
||||
if (symbol == "e" || symbol == "E") {
|
||||
// Skip past the sign following the exponent, if one is
|
||||
// specified.
|
||||
symbol = source.charAt(++Index);
|
||||
if (symbol == "+" || symbol == "-") {
|
||||
Index++;
|
||||
}
|
||||
// Parse the exponential component.
|
||||
for (position = Index; position < length && (symbol = source.charAt(position), symbol >= "0" && symbol <= "9"); position++);
|
||||
if (position == Index) {
|
||||
// Illegal empty exponent.
|
||||
abort();
|
||||
}
|
||||
Index = position;
|
||||
}
|
||||
// Coerce the parsed value to a JavaScript number.
|
||||
return +source.slice(begin, Index);
|
||||
}
|
||||
// A negative sign may only precede numbers.
|
||||
if (sign) {
|
||||
// Unrecognized token.
|
||||
abort();
|
||||
}
|
||||
// `true`, `false`, and `null` literals.
|
||||
if (source.slice(Index, Index + 4) == "true") {
|
||||
Index += 4;
|
||||
return true;
|
||||
} else if (source.slice(Index, Index + 5) == "false") {
|
||||
Index += 5;
|
||||
return false;
|
||||
} else if (source.slice(Index, Index + 4) == "null") {
|
||||
Index += 4;
|
||||
return null;
|
||||
}
|
||||
// Unrecognized token.
|
||||
abort();
|
||||
}
|
||||
}
|
||||
// Return the sentinel `$` character if the parser has reached the end
|
||||
@@ -643,14 +694,14 @@
|
||||
};
|
||||
|
||||
// Internal: Parses a JSON `value` token.
|
||||
get = function (value) {
|
||||
var results, any, key;
|
||||
var get = function (value) {
|
||||
var results, hasMembers;
|
||||
if (value == "$") {
|
||||
// Unexpected end of input.
|
||||
abort();
|
||||
}
|
||||
if (typeof value == "string") {
|
||||
if (value.charAt(0) == "@") {
|
||||
if (value[0] == "@") {
|
||||
// Remove the sentinel `@` character.
|
||||
return value.slice(1);
|
||||
}
|
||||
@@ -658,7 +709,7 @@
|
||||
if (value == "[") {
|
||||
// Parses a JSON array, returning a new JavaScript array.
|
||||
results = [];
|
||||
for (;; any || (any = true)) {
|
||||
for (;; hasMembers || (hasMembers = true)) {
|
||||
value = lex();
|
||||
// A closing square bracket marks the end of the array literal.
|
||||
if (value == "]") {
|
||||
@@ -667,7 +718,7 @@
|
||||
// If the array literal contains elements, the current token
|
||||
// should be a comma separating the previous element from the
|
||||
// next.
|
||||
if (any) {
|
||||
if (hasMembers) {
|
||||
if (value == ",") {
|
||||
value = lex();
|
||||
if (value == "]") {
|
||||
@@ -689,7 +740,7 @@
|
||||
} else if (value == "{") {
|
||||
// Parses a JSON object, returning a new JavaScript object.
|
||||
results = {};
|
||||
for (;; any || (any = true)) {
|
||||
for (;; hasMembers || (hasMembers = true)) {
|
||||
value = lex();
|
||||
// A closing curly brace marks the end of the object literal.
|
||||
if (value == "}") {
|
||||
@@ -697,7 +748,7 @@
|
||||
}
|
||||
// If the object literal contains members, the current token
|
||||
// should be a comma separator.
|
||||
if (any) {
|
||||
if (hasMembers) {
|
||||
if (value == ",") {
|
||||
value = lex();
|
||||
if (value == "}") {
|
||||
@@ -712,7 +763,7 @@
|
||||
// Leading commas are not permitted, object property names must be
|
||||
// double-quoted strings, and a `:` must separate each property
|
||||
// name and value.
|
||||
if (value == "," || typeof value != "string" || value.charAt(0) != "@" || lex() != ":") {
|
||||
if (value == "," || typeof value != "string" || value[0] != "@" || lex() != ":") {
|
||||
abort();
|
||||
}
|
||||
results[value.slice(1)] = get(lex());
|
||||
@@ -726,7 +777,7 @@
|
||||
};
|
||||
|
||||
// Internal: Updates a traversed object member.
|
||||
update = function(source, property, callback) {
|
||||
var update = function(source, property, callback) {
|
||||
var element = walk(source, property, callback);
|
||||
if (element === undef) {
|
||||
delete source[property];
|
||||
@@ -738,17 +789,17 @@
|
||||
// Internal: Recursively traverses a parsed JSON object, invoking the
|
||||
// `callback` function for each value. This is an implementation of the
|
||||
// `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
|
||||
walk = function (source, property, callback) {
|
||||
var walk = function (source, property, callback) {
|
||||
var value = source[property], length;
|
||||
if (typeof value == "object" && value) {
|
||||
if (getClass.call(value) == "[object Array]") {
|
||||
// `forEach` can't be used to traverse an array in Opera <= 8.54
|
||||
// because its `Object#hasOwnProperty` implementation returns `false`
|
||||
// for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
|
||||
if (getClass.call(value) == arrayClass) {
|
||||
for (length = value.length; length--;) {
|
||||
update(value, length, callback);
|
||||
}
|
||||
} else {
|
||||
// `forEach` can't be used to traverse an array in Opera <= 8.54,
|
||||
// as `Object#hasOwnProperty` returns `false` for array indices
|
||||
// (e.g., `![1, 2, 3].hasOwnProperty("0")`).
|
||||
forEach(value, function (property) {
|
||||
update(value, property, callback);
|
||||
});
|
||||
@@ -761,7 +812,7 @@
|
||||
JSON3.parse = function (source, callback) {
|
||||
var result, value;
|
||||
Index = 0;
|
||||
Source = source;
|
||||
Source = "" + source;
|
||||
result = get(lex());
|
||||
// If a JSON string contains multiple tokens, it is invalid.
|
||||
if (lex() != "$") {
|
||||
@@ -769,7 +820,7 @@
|
||||
}
|
||||
// Reset the parser state.
|
||||
Index = Source = null;
|
||||
return callback && getClass.call(callback) == "[object Function]" ? walk((value = {}, value[""] = result, value), "", callback) : result;
|
||||
return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -780,4 +831,4 @@
|
||||
return JSON3;
|
||||
});
|
||||
}
|
||||
}).call(this);
|
||||
}(this));
|
||||
|
||||
100
vendor/platform.js/README.md
vendored
100
vendor/platform.js/README.md
vendored
@@ -1,100 +0,0 @@
|
||||
# Platform.js <sup>v1.0.0</sup>
|
||||
|
||||
A platform detection library that works on nearly all JavaScript platforms<sup><a name="fnref1" href="#fn1">1</a></sup>.
|
||||
|
||||
## Disclaimer
|
||||
|
||||
Platform.js is for informational purposes only and **not** intended as a substitution for [feature detection/inference](http://allyoucanleet.com/post/18087210413/feature-testing-costs#screencast2) checks.
|
||||
|
||||
## BestieJS
|
||||
|
||||
Platform.js is part of the BestieJS *"Best in Class"* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation.
|
||||
|
||||
## Documentation
|
||||
|
||||
The documentation for Platform.js can be viewed here: [/doc/README.md](https://github.com/bestiejs/platform.js/blob/master/doc/README.md#readme)
|
||||
|
||||
For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/platform.js/wiki/Roadmap).
|
||||
|
||||
## Support
|
||||
|
||||
Platform.js has been tested in at least Chrome 5~27, Firefox 2~21, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.7, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.
|
||||
|
||||
## Installation and usage
|
||||
|
||||
In a browser or Adobe AIR:
|
||||
|
||||
```html
|
||||
<script src="platform.js"></script>
|
||||
```
|
||||
|
||||
Via [npm](http://npmjs.org/):
|
||||
|
||||
```bash
|
||||
npm install platform
|
||||
```
|
||||
|
||||
In [Node.js](http://nodejs.org/) and [RingoJS](http://ringojs.org/):
|
||||
|
||||
```js
|
||||
var platform = require('platform');
|
||||
```
|
||||
|
||||
In [Rhino](http://www.mozilla.org/rhino/):
|
||||
|
||||
```js
|
||||
load('platform.js');
|
||||
```
|
||||
|
||||
In an AMD loader like [RequireJS](http://requirejs.org/):
|
||||
|
||||
```js
|
||||
require({
|
||||
'paths': {
|
||||
'platform': 'path/to/platform'
|
||||
}
|
||||
},
|
||||
['platform'], function(platform) {
|
||||
console.log(platform.name);
|
||||
});
|
||||
```
|
||||
|
||||
Usage example:
|
||||
|
||||
```js
|
||||
// on IE10 x86 platform preview running in IE7 compatibility mode on Windows 7 64 bit edition
|
||||
platform.name; // 'IE'
|
||||
platform.version; // '10.0'
|
||||
platform.layout; // 'Trident'
|
||||
platform.os; // 'Windows Server 2008 R2 / 7 x64'
|
||||
platform.description; // 'IE 10.0 x86 (platform preview; running in IE 7 mode) on Windows Server 2008 R2 / 7 x64'
|
||||
|
||||
// or on an iPad
|
||||
platform.name; // 'Safari'
|
||||
platform.version; // '5.1'
|
||||
platform.product; // 'iPad'
|
||||
platform.manufacturer; // 'Apple'
|
||||
platform.layout; // 'WebKit'
|
||||
platform.os; // 'iOS 5.0'
|
||||
platform.description; // 'Safari 5.1 on Apple iPad (iOS 5.0)'
|
||||
|
||||
// or parsing a given UA string
|
||||
var info = platform.parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7.2; en; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 11.52');
|
||||
info.name; // 'Opera'
|
||||
info.version; // '11.52'
|
||||
info.layout; // 'Presto'
|
||||
info.os; // 'Mac OS X 10.7.2'
|
||||
info.description; // 'Opera 11.52 (identifying as Firefox 4.0) on Mac OS X 10.7.2'
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
| [](http://twitter.com/jdalton "Follow @jdalton on Twitter") |
|
||||
|---|
|
||||
| [John-David Dalton](http://allyoucanleet.com/) |
|
||||
|
||||
## Contributors
|
||||
|
||||
| [](http://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](http://mathiasbynens.be/) |
|
||||
14
vendor/platform.js/platform.js
vendored
14
vendor/platform.js/platform.js
vendored
@@ -299,6 +299,7 @@
|
||||
'WebPositive',
|
||||
'Opera Mini',
|
||||
'Opera',
|
||||
{ 'label': 'Opera', 'pattern': 'OPR' },
|
||||
'Chrome',
|
||||
{ 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
|
||||
{ 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
|
||||
@@ -459,6 +460,7 @@
|
||||
.replace(/Macintosh/, 'Mac OS')
|
||||
.replace(/_PowerPC/i, ' OS')
|
||||
.replace(/(OS X) [^ \d]+/i, '$1')
|
||||
.replace(/Mac (OS X)/, '$1')
|
||||
.replace(/\/(\d)/, ' $1')
|
||||
.replace(/_/g, '.')
|
||||
.replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '')
|
||||
@@ -555,7 +557,7 @@
|
||||
}
|
||||
// detect Android browsers
|
||||
else if (manufacturer && manufacturer != 'Google' &&
|
||||
/Chrome|Vita/.test(name + ';' + product)) {
|
||||
((/Chrome/.test(name) && !/Mobile Safari/.test(ua)) || /Vita/.test(product))) {
|
||||
name = 'Android Browser';
|
||||
os = /Android/.test(os) ? os : 'Android';
|
||||
}
|
||||
@@ -575,7 +577,7 @@
|
||||
// detect non-Opera versions (order is important)
|
||||
if (!version) {
|
||||
version = getVersion([
|
||||
'(?:Cloud9|CriOS|CrMo|Opera ?Mini|Raven|Silk(?!/[\\d.]+$))',
|
||||
'(?:Cloud9|CriOS|CrMo|Opera ?Mini|OPR|Raven|Silk(?!/[\\d.]+$))',
|
||||
'Version',
|
||||
qualify(name),
|
||||
'(?:Firefox|Minefield|NetFront)'
|
||||
@@ -585,9 +587,9 @@
|
||||
if (layout == 'iCab' && parseFloat(version) > 3) {
|
||||
layout = ['WebKit'];
|
||||
} else if ((data =
|
||||
/Opera/.test(name) && 'Presto' ||
|
||||
/Opera/.test(name) && (/OPR/.test(ua) ? 'Blink' : 'Presto') ||
|
||||
/\b(?:Midori|Nook|Safari)\b/i.test(ua) && 'WebKit' ||
|
||||
!layout && /\bMSIE\b/i.test(ua) && (/^Mac/.test(os) ? 'Tasman' : 'Trident')
|
||||
!layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident')
|
||||
)) {
|
||||
layout = [data];
|
||||
}
|
||||
@@ -688,7 +690,7 @@
|
||||
description.unshift('desktop mode');
|
||||
}
|
||||
// add mobile postfix
|
||||
else if ((name == 'IE' || name && !product && !/Browser|Mobi/.test(name)) &&
|
||||
else if ((name == 'Chrome' || name == 'IE' || name && !product && !/Browser|Mobi/.test(name)) &&
|
||||
(os == 'Windows CE' || /Mobi/i.test(ua))) {
|
||||
name += ' Mobile';
|
||||
}
|
||||
@@ -796,7 +798,7 @@
|
||||
name = 'Chrome Mobile';
|
||||
version = null;
|
||||
|
||||
if (/Mac OS X/.test(os)) {
|
||||
if (/OS X/.test(os)) {
|
||||
manufacturer = 'Apple';
|
||||
os = 'iOS 4.3+';
|
||||
} else {
|
||||
|
||||
60
vendor/qunit-clib/README.md
vendored
60
vendor/qunit-clib/README.md
vendored
@@ -1,60 +0,0 @@
|
||||
# QUnit CLIB <sup>v1.3.0</sup>
|
||||
## command-line interface boilerplate
|
||||
|
||||
QUnit CLIB helps extend QUnit’s CLI support to many common CLI environments.
|
||||
|
||||
## Screenshot
|
||||
|
||||

|
||||
|
||||
## Support
|
||||
|
||||
QUnit CLIB has been tested in at least Node.js 0.4.8-0.10.7, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
;(function(window) {
|
||||
'use strict';
|
||||
|
||||
// use a single "load" function
|
||||
var load = typeof require == 'function' ? require : window.load;
|
||||
|
||||
// load QUnit and CLIB if needed
|
||||
var QUnit = (function() {
|
||||
var noop = Function.prototype;
|
||||
return window.QUnit || (
|
||||
window.addEventListener || (window.addEventListener = noop),
|
||||
window.setTimeout || (window.setTimeout = noop),
|
||||
window.QUnit = load('../vendor/qunit/qunit/qunit.js') || window.QUnit,
|
||||
(load('../vendor/qunit-clib/qunit-clib.js') || { 'runInContext': noop }).runInContext(window),
|
||||
addEventListener === noop && delete window.addEventListener,
|
||||
window.QUnit
|
||||
);
|
||||
}());
|
||||
|
||||
// explicitly call `QUnit.module()` instead of `module()`
|
||||
// in case we are in a CLI environment
|
||||
QUnit.module('A Test Module');
|
||||
|
||||
test('A Test', function() {
|
||||
// ...
|
||||
});
|
||||
|
||||
// call `QUnit.start()` for Narwhal, Node.js, PhantomJS, Rhino, and RingoJS
|
||||
if (!window.document || window.phantom) {
|
||||
QUnit.start();
|
||||
}
|
||||
}(typeof global == 'object' && global || this));
|
||||
```
|
||||
|
||||
## Footnotes
|
||||
|
||||
1. QUnit v1.3.0 does not work with Narwhal or Ringo < v0.8.0
|
||||
2. Rhino v1.7RC4 does not support timeout fallbacks `clearTimeout` and `setTimeout`
|
||||
|
||||
## Author
|
||||
|
||||
| [](http://twitter.com/jdalton "Follow @jdalton on Twitter") |
|
||||
|---|
|
||||
| [John-David Dalton](http://allyoucanleet.com/) |
|
||||
21
vendor/qunit/MIT-LICENSE.txt
vendored
Normal file
21
vendor/qunit/MIT-LICENSE.txt
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
Copyright 2013 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
|
||||
"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 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.
|
||||
62
vendor/qunit/README.md
vendored
62
vendor/qunit/README.md
vendored
@@ -1,62 +0,0 @@
|
||||
[QUnit](http://qunitjs.com) - A JavaScript Unit Testing framework.
|
||||
================================
|
||||
|
||||
QUnit is a powerful, easy-to-use, JavaScript test suite. It's used by the jQuery
|
||||
project to test its code and plugins but is capable of testing any generic
|
||||
JavaScript code (and even capable of testing JavaScript code on the server-side).
|
||||
|
||||
QUnit is especially useful for regression testing: Whenever a bug is reported,
|
||||
write a test that asserts the existence of that particular bug. Then fix it and
|
||||
commit both. Every time you work on the code again, run the tests. If the bug
|
||||
comes up again - a regression - you'll spot it immediately and know how to fix
|
||||
it, because you know what code you just changed.
|
||||
|
||||
Having good unit test coverage makes safe refactoring easy and cheap. You can
|
||||
run the tests after each small refactoring step and always know what change
|
||||
broke something.
|
||||
|
||||
QUnit is similar to other unit testing frameworks like JUnit, but makes use of
|
||||
the features JavaScript provides and helps with testing code in the browser, e.g.
|
||||
with its stop/start facilities for testing asynchronous code.
|
||||
|
||||
If you are interested in helping developing QUnit, you are in the right place.
|
||||
For related discussions, visit the
|
||||
[QUnit and Testing forum](http://forum.jquery.com/qunit-and-testing).
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
To submit patches, fork the repository, create a branch for the change. Then implement
|
||||
the change, run `grunt` to lint and test it, then commit, push and create a pull request.
|
||||
|
||||
Include some background for the change in the commit message and `Fixes #nnn`, referring
|
||||
to the issue number you're addressing.
|
||||
|
||||
To run `grunt`, you need `node` and `npm`, then `npm install grunt -g`. That gives you a global
|
||||
grunt binary. For additional grunt tasks, also run `npm install`.
|
||||
|
||||
Releases
|
||||
--------
|
||||
|
||||
Install git-extras and run `git changelog` to update History.md.
|
||||
Update qunit/qunit.js|css and package.json to the release version, commit and
|
||||
tag, update them again to the next version, commit and push commits and tags
|
||||
(`git push --tags origin master`).
|
||||
|
||||
Put the 'v' in front of the tag, e.g. `v1.8.0`. Clean up the changelog, removing merge commits
|
||||
or whitespace cleanups.
|
||||
|
||||
To upload to code.jquery.com (replace $version accordingly), ssh to code.origin.jquery.com:
|
||||
|
||||
cp qunit/qunit.js /var/www/html/code.jquery.com/qunit/qunit-$version.js
|
||||
cp qunit/qunit.css /var/www/html/code.jquery.com/qunit/qunit-$version.css
|
||||
|
||||
Then update /var/www/html/code.jquery.com/index.html and purge it with:
|
||||
|
||||
curl -s http://code.origin.jquery.com/?reload
|
||||
|
||||
Update web-base-template to link to those files for qunitjs.com.
|
||||
|
||||
Publish to npm via
|
||||
|
||||
npm publish
|
||||
2
vendor/qunit/qunit/qunit.css
vendored
2
vendor/qunit/qunit/qunit.css
vendored
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* QUnit v1.11.0 - A JavaScript Unit Testing Framework
|
||||
* QUnit v1.12.0 - A JavaScript Unit Testing Framework
|
||||
*
|
||||
* http://qunitjs.com
|
||||
*
|
||||
|
||||
262
vendor/qunit/qunit/qunit.js
vendored
262
vendor/qunit/qunit/qunit.js
vendored
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* QUnit v1.11.0 - A JavaScript Unit Testing Framework
|
||||
* QUnit v1.12.0 - A JavaScript Unit Testing Framework
|
||||
*
|
||||
* http://qunitjs.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Copyright 2013 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
* https://jquery.org/license/
|
||||
*/
|
||||
|
||||
(function( window ) {
|
||||
@@ -20,6 +20,7 @@ var QUnit,
|
||||
hasOwn = Object.prototype.hasOwnProperty,
|
||||
// Keep a local reference to Date (GH-283)
|
||||
Date = window.Date,
|
||||
setTimeout = window.setTimeout,
|
||||
defined = {
|
||||
setTimeout: typeof window.setTimeout !== "undefined",
|
||||
sessionStorage: (function() {
|
||||
@@ -115,8 +116,16 @@ Test.prototype = {
|
||||
}
|
||||
},
|
||||
setup: function() {
|
||||
if ( this.module !== config.previousModule ) {
|
||||
if ( config.previousModule ) {
|
||||
if (
|
||||
// Emit moduleStart when we're switching from one module to another
|
||||
this.module !== config.previousModule ||
|
||||
// They could be equal (both undefined) but if the previousModule property doesn't
|
||||
// yet exist it means this is the first test in a suite that isn't wrapped in a
|
||||
// module, in which case we'll just emit a moduleStart event for 'undefined'.
|
||||
// Without this, reporters can get testStart before moduleStart which is a problem.
|
||||
!hasOwn.call( config, "previousModule" )
|
||||
) {
|
||||
if ( hasOwn.call( config, "previousModule" ) ) {
|
||||
runLoggingCallbacks( "moduleDone", QUnit, {
|
||||
name: config.previousModule,
|
||||
failed: config.moduleStats.bad,
|
||||
@@ -129,10 +138,6 @@ Test.prototype = {
|
||||
runLoggingCallbacks( "moduleStart", QUnit, {
|
||||
name: this.module
|
||||
});
|
||||
} else if ( config.autorun ) {
|
||||
runLoggingCallbacks( "moduleStart", QUnit, {
|
||||
name: this.module
|
||||
});
|
||||
}
|
||||
|
||||
config.current = this;
|
||||
@@ -148,19 +153,27 @@ Test.prototype = {
|
||||
module: this.module
|
||||
});
|
||||
|
||||
// allow utility functions to access the current test environment
|
||||
// TODO why??
|
||||
/*jshint camelcase:false */
|
||||
|
||||
|
||||
/**
|
||||
* Expose the current test environment.
|
||||
*
|
||||
* @deprecated since 1.12.0: Use QUnit.config.current.testEnvironment instead.
|
||||
*/
|
||||
QUnit.current_testEnvironment = this.testEnvironment;
|
||||
|
||||
/*jshint camelcase:true */
|
||||
|
||||
if ( !config.pollution ) {
|
||||
saveGlobal();
|
||||
}
|
||||
if ( config.notrycatch ) {
|
||||
this.testEnvironment.setup.call( this.testEnvironment );
|
||||
this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert );
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.testEnvironment.setup.call( this.testEnvironment );
|
||||
this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert );
|
||||
} catch( e ) {
|
||||
QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) );
|
||||
}
|
||||
@@ -208,11 +221,11 @@ Test.prototype = {
|
||||
if ( typeof this.callbackRuntime === "undefined" ) {
|
||||
this.callbackRuntime = +new Date() - this.callbackStarted;
|
||||
}
|
||||
this.testEnvironment.teardown.call( this.testEnvironment );
|
||||
this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert );
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
this.testEnvironment.teardown.call( this.testEnvironment );
|
||||
this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert );
|
||||
} catch( e ) {
|
||||
QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) );
|
||||
}
|
||||
@@ -419,7 +432,7 @@ QUnit = {
|
||||
test.queue();
|
||||
},
|
||||
|
||||
// Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
|
||||
// Specify the number of expected assertions to guarantee that failed test (no assertions are run at all) don't slip through.
|
||||
expect: function( asserts ) {
|
||||
if (arguments.length === 1) {
|
||||
config.current.expected = asserts;
|
||||
@@ -454,7 +467,7 @@ QUnit = {
|
||||
}
|
||||
// A slight delay, to avoid any current callbacks
|
||||
if ( defined.setTimeout ) {
|
||||
window.setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
if ( config.semaphore > 0 ) {
|
||||
return;
|
||||
}
|
||||
@@ -477,7 +490,7 @@ QUnit = {
|
||||
|
||||
if ( config.testTimeout && defined.setTimeout ) {
|
||||
clearTimeout( config.timeout );
|
||||
config.timeout = window.setTimeout(function() {
|
||||
config.timeout = setTimeout(function() {
|
||||
QUnit.ok( false, "Test timed out" );
|
||||
config.semaphore = 1;
|
||||
QUnit.start();
|
||||
@@ -487,7 +500,7 @@ QUnit = {
|
||||
};
|
||||
|
||||
// `assert` initialized at top of scope
|
||||
// Asssert helpers
|
||||
// Assert helpers
|
||||
// All of these must either call QUnit.push() or manually do:
|
||||
// - runLoggingCallbacks( "log", .. );
|
||||
// - config.current.assertions.push({ .. });
|
||||
@@ -505,6 +518,7 @@ assert = {
|
||||
throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) );
|
||||
}
|
||||
result = !!result;
|
||||
msg = msg || (result ? "okay" : "failed" );
|
||||
|
||||
var source,
|
||||
details = {
|
||||
@@ -514,8 +528,7 @@ assert = {
|
||||
message: msg
|
||||
};
|
||||
|
||||
msg = escapeText( msg || (result ? "okay" : "failed" ) );
|
||||
msg = "<span class='test-message'>" + msg + "</span>";
|
||||
msg = "<span class='test-message'>" + escapeText( msg ) + "</span>";
|
||||
|
||||
if ( !result ) {
|
||||
source = sourceFromStacktrace( 2 );
|
||||
@@ -642,13 +655,13 @@ assert = {
|
||||
|
||||
QUnit.push( ok, actual, expectedOutput, message );
|
||||
} else {
|
||||
QUnit.pushFailure( message, null, 'No exception was thrown.' );
|
||||
QUnit.pushFailure( message, null, "No exception was thrown." );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecate since 1.8.0
|
||||
* @deprecated since 1.8.0
|
||||
* Kept assertion helpers in root for backwards compatibility.
|
||||
*/
|
||||
extend( QUnit, assert );
|
||||
@@ -737,7 +750,7 @@ config = {
|
||||
// Export global variables, unless an 'exports' object exists,
|
||||
// in that case we assume we're in CommonJS (dealt with on the bottom of the script)
|
||||
if ( typeof exports === "undefined" ) {
|
||||
extend( window, QUnit );
|
||||
extend( window, QUnit.constructor.prototype );
|
||||
|
||||
// Expose QUnit object
|
||||
window.QUnit = QUnit;
|
||||
@@ -836,6 +849,11 @@ extend( QUnit, {
|
||||
},
|
||||
|
||||
// Resets the test setup. Useful for tests that modify the DOM.
|
||||
/*
|
||||
DEPRECATED: Use multiple tests instead of resetting inside a test.
|
||||
Use testStart or testDone for custom cleanup.
|
||||
This method will throw an error in 2.0, and will be removed in 2.1
|
||||
*/
|
||||
reset: function() {
|
||||
var fixture = id( "qunit-fixture" );
|
||||
if ( fixture ) {
|
||||
@@ -985,11 +1003,10 @@ extend( QUnit, {
|
||||
querystring = "?";
|
||||
|
||||
for ( key in params ) {
|
||||
if ( !hasOwn.call( params, key ) ) {
|
||||
continue;
|
||||
if ( hasOwn.call( params, key ) ) {
|
||||
querystring += encodeURIComponent( key ) + "=" +
|
||||
encodeURIComponent( params[ key ] ) + "&";
|
||||
}
|
||||
querystring += encodeURIComponent( key ) + "=" +
|
||||
encodeURIComponent( params[ key ] ) + "&";
|
||||
}
|
||||
return window.location.protocol + "//" + window.location.host +
|
||||
window.location.pathname + querystring.slice( 0, -1 );
|
||||
@@ -997,7 +1014,10 @@ extend( QUnit, {
|
||||
|
||||
extend: extend,
|
||||
id: id,
|
||||
addEvent: addEvent
|
||||
addEvent: addEvent,
|
||||
addClass: addClass,
|
||||
hasClass: hasClass,
|
||||
removeClass: removeClass
|
||||
// load, equiv, jsDump, diff: Attached later
|
||||
});
|
||||
|
||||
@@ -1044,6 +1064,7 @@ QUnit.load = function() {
|
||||
var banner, filter, i, label, len, main, ol, toolbar, userAgent, val,
|
||||
urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter,
|
||||
numModules = 0,
|
||||
moduleNames = [],
|
||||
moduleFilterHtml = "",
|
||||
urlConfigHtml = "",
|
||||
oldconfig = extend( {}, config );
|
||||
@@ -1072,18 +1093,24 @@ QUnit.load = function() {
|
||||
"'><label for='qunit-urlconfig-" + escapeText( val.id ) +
|
||||
"' title='" + escapeText( val.tooltip ) + "'>" + val.label + "</label>";
|
||||
}
|
||||
|
||||
for ( i in config.modules ) {
|
||||
if ( config.modules.hasOwnProperty( i ) ) {
|
||||
moduleNames.push(i);
|
||||
}
|
||||
}
|
||||
numModules = moduleNames.length;
|
||||
moduleNames.sort( function( a, b ) {
|
||||
return a.localeCompare( b );
|
||||
});
|
||||
moduleFilterHtml += "<label for='qunit-modulefilter'>Module: </label><select id='qunit-modulefilter' name='modulefilter'><option value='' " +
|
||||
( config.module === undefined ? "selected='selected'" : "" ) +
|
||||
">< All Modules ></option>";
|
||||
|
||||
for ( i in config.modules ) {
|
||||
if ( config.modules.hasOwnProperty( i ) ) {
|
||||
numModules += 1;
|
||||
moduleFilterHtml += "<option value='" + escapeText( encodeURIComponent(i) ) + "' " +
|
||||
( config.module === i ? "selected='selected'" : "" ) +
|
||||
">" + escapeText(i) + "</option>";
|
||||
}
|
||||
|
||||
for ( i = 0; i < numModules; i++) {
|
||||
moduleFilterHtml += "<option value='" + escapeText( encodeURIComponent(moduleNames[i]) ) + "' " +
|
||||
( config.module === moduleNames[i] ? "selected='selected'" : "" ) +
|
||||
">" + escapeText(moduleNames[i]) + "</option>";
|
||||
}
|
||||
moduleFilterHtml += "</select>";
|
||||
|
||||
@@ -1137,7 +1164,7 @@ QUnit.load = function() {
|
||||
// `label` initialized at top of scope
|
||||
label = document.createElement( "label" );
|
||||
label.setAttribute( "for", "qunit-filter-pass" );
|
||||
label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." );
|
||||
label.setAttribute( "title", "Only show tests and assertions that fail. Stored in sessionStorage." );
|
||||
label.innerHTML = "Hide passed tests";
|
||||
toolbar.appendChild( label );
|
||||
|
||||
@@ -1157,14 +1184,19 @@ QUnit.load = function() {
|
||||
toolbar.appendChild( urlConfigCheckboxesContainer );
|
||||
|
||||
if (numModules > 1) {
|
||||
moduleFilter = document.createElement( 'span' );
|
||||
moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' );
|
||||
moduleFilter = document.createElement( "span" );
|
||||
moduleFilter.setAttribute( "id", "qunit-modulefilter-container" );
|
||||
moduleFilter.innerHTML = moduleFilterHtml;
|
||||
addEvent( moduleFilter.lastChild, "change", function() {
|
||||
var selectBox = moduleFilter.getElementsByTagName("select")[0],
|
||||
selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value);
|
||||
|
||||
window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } );
|
||||
window.location = QUnit.url({
|
||||
module: ( selectedModule === "" ) ? undefined : selectedModule,
|
||||
// Remove any existing filters
|
||||
filter: undefined,
|
||||
testNumber: undefined
|
||||
});
|
||||
});
|
||||
toolbar.appendChild(moduleFilter);
|
||||
}
|
||||
@@ -1188,7 +1220,7 @@ addEvent( window, "load", QUnit.load );
|
||||
onErrorFnPrev = window.onerror;
|
||||
|
||||
// Cover uncaught exceptions
|
||||
// Returning true will surpress the default browser handler,
|
||||
// Returning true will suppress the default browser handler,
|
||||
// returning false will let it run.
|
||||
window.onerror = function ( error, filePath, linerNr ) {
|
||||
var ret = false;
|
||||
@@ -1197,7 +1229,7 @@ window.onerror = function ( error, filePath, linerNr ) {
|
||||
}
|
||||
|
||||
// Treat return value as window.onerror itself does,
|
||||
// Only do our handling if not surpressed.
|
||||
// Only do our handling if not suppressed.
|
||||
if ( ret !== true ) {
|
||||
if ( QUnit.config.current ) {
|
||||
if ( QUnit.config.current.ignoreGlobalErrors ) {
|
||||
@@ -1227,6 +1259,7 @@ function done() {
|
||||
total: config.moduleStats.all
|
||||
});
|
||||
}
|
||||
delete config.previousModule;
|
||||
|
||||
var i, key,
|
||||
banner = id( "qunit-banner" ),
|
||||
@@ -1386,16 +1419,16 @@ function escapeText( s ) {
|
||||
// Both single quotes and double quotes (for attributes)
|
||||
return s.replace( /['"<>&]/g, function( s ) {
|
||||
switch( s ) {
|
||||
case '\'':
|
||||
return ''';
|
||||
case '"':
|
||||
return '"';
|
||||
case '<':
|
||||
return '<';
|
||||
case '>':
|
||||
return '>';
|
||||
case '&':
|
||||
return '&';
|
||||
case "'":
|
||||
return "'";
|
||||
case "\"":
|
||||
return """;
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
case "&":
|
||||
return "&";
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1419,7 +1452,7 @@ function process( last ) {
|
||||
if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) {
|
||||
config.queue.shift()();
|
||||
} else {
|
||||
window.setTimeout( next, 13 );
|
||||
setTimeout( next, 13 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1434,11 +1467,13 @@ function saveGlobal() {
|
||||
|
||||
if ( config.noglobals ) {
|
||||
for ( var key in window ) {
|
||||
// in Opera sometimes DOM element ids show up here, ignore them
|
||||
if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) {
|
||||
continue;
|
||||
if ( hasOwn.call( window, key ) ) {
|
||||
// in Opera sometimes DOM element ids show up here, ignore them
|
||||
if ( /^qunit-test-output/.test( key ) ) {
|
||||
continue;
|
||||
}
|
||||
config.pollution.push( key );
|
||||
}
|
||||
config.pollution.push( key );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1480,12 +1515,15 @@ function diff( a, b ) {
|
||||
|
||||
function extend( a, b ) {
|
||||
for ( var prop in b ) {
|
||||
if ( b[ prop ] === undefined ) {
|
||||
delete a[ prop ];
|
||||
|
||||
// Avoid "Member not found" error in IE8 caused by setting window.constructor
|
||||
} else if ( prop !== "constructor" || a !== window ) {
|
||||
a[ prop ] = b[ prop ];
|
||||
if ( hasOwn.call( b, prop ) ) {
|
||||
// Avoid "Member not found" error in IE8 caused by messing with window.constructor
|
||||
if ( !( prop === "constructor" && a === window ) ) {
|
||||
if ( b[ prop ] === undefined ) {
|
||||
delete a[ prop ];
|
||||
} else {
|
||||
a[ prop ] = b[ prop ];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1535,8 +1573,8 @@ function removeClass( elem, name ) {
|
||||
while ( set.indexOf(" " + name + " ") > -1 ) {
|
||||
set = set.replace(" " + name + " " , " ");
|
||||
}
|
||||
// If possible, trim it for prettiness, but not neccecarily
|
||||
elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set );
|
||||
// If possible, trim it for prettiness, but not necessarily
|
||||
elem.className = typeof set.trim === "function" ? set.trim() : set.replace(/^\s+|\s+$/g, "");
|
||||
}
|
||||
|
||||
function id( name ) {
|
||||
@@ -1585,8 +1623,10 @@ QUnit.equiv = (function() {
|
||||
callers = [],
|
||||
// stack to avoiding loops from circular referencing
|
||||
parents = [],
|
||||
parentsB = [],
|
||||
|
||||
getProto = Object.getPrototypeOf || function ( obj ) {
|
||||
/*jshint camelcase:false */
|
||||
return obj.__proto__;
|
||||
},
|
||||
callbacks = (function () {
|
||||
@@ -1595,7 +1635,7 @@ QUnit.equiv = (function() {
|
||||
function useStrictEquality( b, a ) {
|
||||
/*jshint eqeqeq:false */
|
||||
if ( b instanceof a.constructor || a instanceof b.constructor ) {
|
||||
// to catch short annotaion VS 'new' annotation of a
|
||||
// to catch short annotation VS 'new' annotation of a
|
||||
// declaration
|
||||
// e.g. var i = 1;
|
||||
// var j = new Number(1);
|
||||
@@ -1624,7 +1664,7 @@ QUnit.equiv = (function() {
|
||||
return QUnit.objectType( b ) === "regexp" &&
|
||||
// the regex itself
|
||||
a.source === b.source &&
|
||||
// and its modifers
|
||||
// and its modifiers
|
||||
a.global === b.global &&
|
||||
// (gmi) ...
|
||||
a.ignoreCase === b.ignoreCase &&
|
||||
@@ -1641,7 +1681,7 @@ QUnit.equiv = (function() {
|
||||
},
|
||||
|
||||
"array": function( b, a ) {
|
||||
var i, j, len, loop;
|
||||
var i, j, len, loop, aCircular, bCircular;
|
||||
|
||||
// b could be an object literal here
|
||||
if ( QUnit.objectType( b ) !== "array" ) {
|
||||
@@ -1656,24 +1696,36 @@ QUnit.equiv = (function() {
|
||||
|
||||
// track reference to avoid circular references
|
||||
parents.push( a );
|
||||
parentsB.push( b );
|
||||
for ( i = 0; i < len; i++ ) {
|
||||
loop = false;
|
||||
for ( j = 0; j < parents.length; j++ ) {
|
||||
if ( parents[j] === a[i] ) {
|
||||
loop = true;// dont rewalk array
|
||||
aCircular = parents[j] === a[i];
|
||||
bCircular = parentsB[j] === b[i];
|
||||
if ( aCircular || bCircular ) {
|
||||
if ( a[i] === b[i] || aCircular && bCircular ) {
|
||||
loop = true;
|
||||
} else {
|
||||
parents.pop();
|
||||
parentsB.pop();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !loop && !innerEquiv(a[i], b[i]) ) {
|
||||
parents.pop();
|
||||
parentsB.pop();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
parents.pop();
|
||||
parentsB.pop();
|
||||
return true;
|
||||
},
|
||||
|
||||
"object": function( b, a ) {
|
||||
var i, j, loop,
|
||||
/*jshint forin:false */
|
||||
var i, j, loop, aCircular, bCircular,
|
||||
// Default to true
|
||||
eq = true,
|
||||
aProperties = [],
|
||||
@@ -1692,28 +1744,36 @@ QUnit.equiv = (function() {
|
||||
|
||||
// stack constructor before traversing properties
|
||||
callers.push( a.constructor );
|
||||
|
||||
// track reference to avoid circular references
|
||||
parents.push( a );
|
||||
parentsB.push( b );
|
||||
|
||||
for ( i in a ) { // be strict: don't ensures hasOwnProperty
|
||||
// and go deep
|
||||
// be strict: don't ensure hasOwnProperty and go deep
|
||||
for ( i in a ) {
|
||||
loop = false;
|
||||
for ( j = 0; j < parents.length; j++ ) {
|
||||
if ( parents[j] === a[i] ) {
|
||||
// don't go down the same path twice
|
||||
loop = true;
|
||||
aCircular = parents[j] === a[i];
|
||||
bCircular = parentsB[j] === b[i];
|
||||
if ( aCircular || bCircular ) {
|
||||
if ( a[i] === b[i] || aCircular && bCircular ) {
|
||||
loop = true;
|
||||
} else {
|
||||
eq = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
aProperties.push(i); // collect a's properties
|
||||
|
||||
if (!loop && !innerEquiv( a[i], b[i] ) ) {
|
||||
aProperties.push(i);
|
||||
if ( !loop && !innerEquiv(a[i], b[i]) ) {
|
||||
eq = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
callers.pop(); // unstack, we are done
|
||||
parents.pop();
|
||||
parentsB.pop();
|
||||
callers.pop(); // unstack, we are done
|
||||
|
||||
for ( i in b ) {
|
||||
bProperties.push( i ); // collect b's properties
|
||||
@@ -1743,7 +1803,7 @@ QUnit.equiv = (function() {
|
||||
}
|
||||
|
||||
// apply transition with (1..n) arguments
|
||||
}( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) );
|
||||
}( args[0], args[1] ) && innerEquiv.apply( this, args.splice(1, args.length - 1 )) );
|
||||
};
|
||||
|
||||
return innerEquiv;
|
||||
@@ -1761,7 +1821,7 @@ QUnit.equiv = (function() {
|
||||
*/
|
||||
QUnit.jsDump = (function() {
|
||||
function quote( str ) {
|
||||
return '"' + str.toString().replace( /"/g, '\\"' ) + '"';
|
||||
return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\"";
|
||||
}
|
||||
function literal( o ) {
|
||||
return o + "";
|
||||
@@ -1854,13 +1914,13 @@ QUnit.jsDump = (function() {
|
||||
if ( this.HTML ) {
|
||||
chr = chr.replace( /\t/g, " " ).replace( / /g, " " );
|
||||
}
|
||||
return new Array( this._depth_ + (extra||0) ).join(chr);
|
||||
return new Array( this.depth + ( extra || 0 ) ).join(chr);
|
||||
},
|
||||
up: function( a ) {
|
||||
this._depth_ += a || 1;
|
||||
this.depth += a || 1;
|
||||
},
|
||||
down: function( a ) {
|
||||
this._depth_ -= a || 1;
|
||||
this.depth -= a || 1;
|
||||
},
|
||||
setParser: function( name, parser ) {
|
||||
this.parsers[name] = parser;
|
||||
@@ -1870,7 +1930,7 @@ QUnit.jsDump = (function() {
|
||||
literal: literal,
|
||||
join: join,
|
||||
//
|
||||
_depth_: 1,
|
||||
depth: 1,
|
||||
// This is the list of parsers, to modify them, use jsDump.setParser
|
||||
parsers: {
|
||||
window: "[Window]",
|
||||
@@ -1898,6 +1958,7 @@ QUnit.jsDump = (function() {
|
||||
nodelist: array,
|
||||
"arguments": array,
|
||||
object: function( map, stack ) {
|
||||
/*jshint forin:false */
|
||||
var ret = [ ], keys, key, val, i;
|
||||
QUnit.jsDump.up();
|
||||
keys = [];
|
||||
@@ -2036,18 +2097,17 @@ QUnit.diff = (function() {
|
||||
}
|
||||
|
||||
for ( i in ns ) {
|
||||
if ( !hasOwn.call( ns, i ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) {
|
||||
n[ ns[i].rows[0] ] = {
|
||||
text: n[ ns[i].rows[0] ],
|
||||
row: os[i].rows[0]
|
||||
};
|
||||
o[ os[i].rows[0] ] = {
|
||||
text: o[ os[i].rows[0] ],
|
||||
row: ns[i].rows[0]
|
||||
};
|
||||
if ( hasOwn.call( ns, i ) ) {
|
||||
if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) {
|
||||
n[ ns[i].rows[0] ] = {
|
||||
text: n[ ns[i].rows[0] ],
|
||||
row: os[i].rows[0]
|
||||
};
|
||||
o[ os[i].rows[0] ] = {
|
||||
text: o[ os[i].rows[0] ],
|
||||
row: ns[i].rows[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2143,9 +2203,9 @@ QUnit.diff = (function() {
|
||||
};
|
||||
}());
|
||||
|
||||
// for CommonJS enviroments, export everything
|
||||
// for CommonJS environments, export everything
|
||||
if ( typeof exports !== "undefined" ) {
|
||||
extend( exports, QUnit );
|
||||
extend( exports, QUnit.constructor.prototype );
|
||||
}
|
||||
|
||||
// get at whatever the global object is, like window in browsers
|
||||
|
||||
51
vendor/requirejs/README.md
vendored
51
vendor/requirejs/README.md
vendored
@@ -1,51 +0,0 @@
|
||||
# RequireJS
|
||||
|
||||
RequireJS loads plain JavaScript files as well as more defined modules. It is
|
||||
optimized for in-browser use, including in
|
||||
[a Web Worker](http://requirejs.org/docs/api.html#webworker), but it can be used
|
||||
in other JavaScript environments, like Rhino and
|
||||
[Node](http://requirejs.org/docs/node.html). It implements the
|
||||
[Asynchronous Module](https://github.com/amdjs/amdjs-api/wiki/AMD)
|
||||
API.
|
||||
|
||||
RequireJS uses plain script tags to load modules/files, so it should allow for
|
||||
easy debugging. It can be used
|
||||
[simply to load existing JavaScript files](http://requirejs.org/docs/api.html#jsfiles),
|
||||
so you can add it to your existing project without having to re-write your
|
||||
JavaScript files.
|
||||
|
||||
RequireJS includes [an optimization tool](http://requirejs.org/docs/optimization.html)
|
||||
you can run as part of your packaging steps for deploying your code. The
|
||||
optimization tool can combine and minify your JavaScript files to allow for
|
||||
better performance.
|
||||
|
||||
If the JavaScript file defines a JavaScript module via
|
||||
[define()](http://requirejs.org/docs/api.html#define), then there are other benefits
|
||||
RequireJS can offer: [improvements over traditional CommonJS modules](http://requirejs.org/docs/commonjs.html)
|
||||
and [loading multiple versions](http://requirejs.org/docs/api.html#multiversion)
|
||||
of a module in a page. RequireJS also has a plugin system that supports features like
|
||||
[i18n string bundles](http://requirejs.org/docs/api.html#i18n), and
|
||||
[text file dependencies](http://requirejs.org/docs/api.html#text).
|
||||
|
||||
RequireJS does not have any dependencies on a JavaScript framework.
|
||||
It is dual-licensed -- new BSD or MIT.
|
||||
|
||||
The standard require.js file is around 5.5KB when minified via Closure Compiler
|
||||
and gzipped.
|
||||
|
||||
RequireJS works in IE 6+, Firefox 2+, Safari 3.2+, Chrome 3+, and Opera 10+.
|
||||
|
||||
[Latest Release](http://requirejs.org/docs/download.html)
|
||||
|
||||
## Directories
|
||||
|
||||
* **dist**: Scripts and assets to generate the requirejs.org docs, and for
|
||||
generating a require.js release.
|
||||
* **docs**: The raw HTML files for the requirejs.org docs. Only includes the
|
||||
body of each page. Files in **dist** are used to generate a complete HTML page.
|
||||
* **tests**: Tests for require.js.
|
||||
* **testBaseUrl.js**: A file used in the tests inside **tests**. Purposely
|
||||
placed outside the tests directory for testing paths that go outside a baseUrl.
|
||||
* **updatesubs.sh**: Updates projects that depend on require.js Assumes the
|
||||
projects are siblings to this directory and have specific names. Useful to
|
||||
copy require.js to dependent projects easily while in development.
|
||||
19
vendor/underscore/README.md
vendored
19
vendor/underscore/README.md
vendored
@@ -1,19 +0,0 @@
|
||||
__
|
||||
/\ \ __
|
||||
__ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____
|
||||
/\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\
|
||||
\ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\
|
||||
\ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/
|
||||
\/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/
|
||||
\ \____/
|
||||
\/___/
|
||||
|
||||
Underscore.js is a utility-belt library for JavaScript that provides
|
||||
support for the usual functional suspects (each, map, reduce, filter...)
|
||||
without extending any core JavaScript objects.
|
||||
|
||||
For Docs, License, Tests, and pre-packed downloads, see:
|
||||
http://underscorejs.org
|
||||
|
||||
Many thanks to our contributors:
|
||||
https://github.com/documentcloud/underscore/contributors
|
||||
Reference in New Issue
Block a user