diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 6a25c29a..00000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "book/bower_components" -} diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 1e8a204e..00000000 --- a/Gruntfile.js +++ /dev/null @@ -1,375 +0,0 @@ -'use strict'; - -// # Globbing -// for performance reasons we're only matching one level down: -// 'test/spec/{,*/}*.js' -// use this if you want to recursively match all subfolders: -// 'test/spec/**/*.js' - -module.exports = function (grunt) { - - // Load grunt tasks automatically - require('load-grunt-tasks')(grunt); - - // Time how long tasks take. Can help when optimizing build times - require('time-grunt')(grunt); - - // Define the configuration for all the tasks - grunt.initConfig({ - - // Project settings - yeoman: { - // Configurable paths - app: 'book', - dist: 'dist' - }, - - // Watches files for changes and runs tasks based on the changed files - watch: { - js: { - files: ['<%= yeoman.app %>/scripts/{,*/}*.js'], - tasks: ['jshint'], - options: { - livereload: true - } - }, - jstest: { - files: ['test/spec/{,*/}*.js'], - tasks: ['test:watch'] - }, - gruntfile: { - files: ['Gruntfile.js'] - }, - compass: { - files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], - tasks: ['compass:server', 'autoprefixer'] - }, - styles: { - files: ['<%= yeoman.app %>/styles/{,*/}*.css'], - tasks: ['newer:copy:styles', 'autoprefixer'] - }, - livereload: { - options: { - livereload: '<%= connect.options.livereload %>' - }, - files: [ - '<%= yeoman.app %>/{,*/}.html', - '.tmp/styles/{,*/}*.css', - '<%= yeoman.app %>/images/{,*/}*.{gif,jpeg,jpg,png,svg,webp}' - ] - } - }, - - // The actual grunt server settings - connect: { - options: { - port: 9000, - livereload: 35729, - // Change this to '0.0.0.0' to access the server from outside - hostname: 'localhost' - }, - livereload: { - options: { - open: true, - base: [ - '.tmp', - '<%= yeoman.app %>' - ] - } - }, - test: { - options: { - port: 9001, - base: [ - '.tmp', - '<%= yeoman.app %>' - ] - } - }, - dist: { - options: { - open: true, - base: '<%= yeoman.dist %>', - livereload: false - } - } - }, - - // Empties folders to start fresh - clean: { - dist: { - files: [{ - dot: true, - src: [ - '.tmp', - '<%= yeoman.dist %>/*', - '!<%= yeoman.dist %>/.git*' - ] - }] - }, - server: '.tmp' - }, - - // Make sure code styles are up to par and there are no obvious mistakes - jshint: { - options: { - jshintrc: '.jshintrc', - reporter: require('jshint-stylish'), - reporterOutput: '' - }, - all: [ - '<%= yeoman.app %>/scripts/{,*/}*.js', - '!<%= yeoman.app %>/scripts/vendor/*', - 'test/spec/{,*/}*.js' - ] - }, - - - // Mocha testing framework configuration options - mocha: { - all: { - options: { - run: true, - urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html'] - } - } - }, - - - - // Compiles Sass to CSS and generates necessary files if requested - compass: { - options: { - sassDir: '<%= yeoman.app %>/styles', - cssDir: '.tmp/styles', - generatedImagesDir: '.tmp/images/generated', - imagesDir: '<%= yeoman.app %>/images', - javascriptsDir: '<%= yeoman.app %>/scripts', - fontsDir: '<%= yeoman.app %>/styles/fonts', - importPath: '<%= yeoman.app %>/bower_components', - httpImagesPath: '/images', - httpGeneratedImagesPath: '/images/generated', - httpFontsPath: '/styles/fonts', - relativeAssets: false, - assetCacheBuster: false - }, - dist: { - options: { - generatedImagesDir: '<%= yeoman.dist %>/images/generated' - } - }, - server: { - options: { - debugInfo: true - } - } - }, - - // Add vendor prefixed styles - autoprefixer: { - options: { - browsers: ['last 1 version'] - }, - dist: { - files: [{ - expand: true, - cwd: '.tmp/styles/', - src: '{,*/}*.css', - dest: '.tmp/styles/' - }] - } - }, - - // Automatically inject Bower components into the HTML file - 'bower-install': { - app: { - html: '<%= yeoman.app %>/index.html', - ignorePath: '<%= yeoman.app %>/' - } - }, - - // Renames files for browser caching purposes - rev: { - dist: { - files: { - src: [ - '<%= yeoman.dist %>/scripts/{,*/}*.js', - '<%= yeoman.dist %>/styles/{,*/}*.css', - '<%= yeoman.dist %>/images/{,*/}*.{gif,jpeg,jpg,png,webp}', - '<%= yeoman.dist %>/styles/fonts/{,*/}*.*' - ] - } - } - }, - - // Reads HTML for usemin blocks to enable smart builds that automatically - // concat, minify and revision files. Creates configurations in memory so - // additional tasks can operate on them - useminPrepare: { - options: { - dest: '<%= yeoman.dist %>' - }, - html: '<%= yeoman.app %>/index.html' - }, - - // Performs rewrites based on rev and the useminPrepare configuration - usemin: { - options: { - assetsDirs: ['<%= yeoman.dist %>'] - }, - html: ['<%= yeoman.dist %>/{,*/}*.html'], - css: ['<%= yeoman.dist %>/styles/{,*/}*.css'] - }, - - // The following *-min tasks produce minified files in the dist folder - imagemin: { - dist: { - files: [{ - expand: true, - cwd: '<%= yeoman.app %>/images', - src: '{,*/}*.{gif,jpeg,jpg,png}', - dest: '<%= yeoman.dist %>/images' - }] - } - }, - svgmin: { - dist: { - files: [{ - expand: true, - cwd: '<%= yeoman.app %>/images', - src: '{,*/}*.svg', - dest: '<%= yeoman.dist %>/images' - }] - } - }, - htmlmin: { - dist: { - options: { - collapseBooleanAttributes: true, - collapseWhitespace: true, - removeAttributeQuotes: true, - removeCommentsFromCDATA: true, - removeEmptyAttributes: true, - removeOptionalTags: true, - removeRedundantAttributes: true, - useShortDoctype: true - }, - files: [{ - expand: true, - cwd: '<%= yeoman.dist %>', - src: '{,*/}*.html', - dest: '<%= yeoman.dist %>' - }] - } - }, - - // By default, your `index.html`'s will take care of - // minification. These next options are pre-configured if you do not wish - // to use the Usemin blocks. - // cssmin: { - // dist: { - // files: { - // '<%= yeoman.dist %>/styles/main.css': [ - // '.tmp/styles/{,*/}*.css', - // '<%= yeoman.app %>/styles/{,*/}*.css' - // ] - // } - // } - // }, - // uglify: { - // dist: { - // files: { - // '<%= yeoman.dist %>/scripts/scripts.js': [ - // '<%= yeoman.dist %>/scripts/scripts.js' - // ] - // } - // } - // }, - // concat: { - // dist: {} - // }, - - // Copies remaining files to places other tasks can use - copy: { - dist: { - files: [{ - expand: true, - dot: true, - cwd: '<%= yeoman.app %>', - dest: '<%= yeoman.dist %>', - src: [ - '*.{ico,png,txt}', - '.htaccess', - 'images/{,*/}*.webp', - '{,*/}*.html', - 'styles/fonts/{,*/}*.*' - ] - }] - }, - styles: { - expand: true, - dot: true, - cwd: '<%= yeoman.app %>/styles', - dest: '.tmp/styles/', - src: '{,*/}*.css' - } - }, - - - - // Run some tasks in parallel to speed up build process - concurrent: { - server: [ - 'compass:server', - 'copy:styles' - ], - test: [ - 'copy:styles' - ], - dist: [ - 'copy:styles', - 'imagemin', - 'svgmin' - ] - } - }); - - - grunt.registerTask('serve', function (target) { - if (target === 'dist') { - return grunt.task.run(['build', 'connect:dist:keepalive']); - } - - grunt.task.run([ - 'clean:server', - 'concurrent:server', - 'autoprefixer', - 'connect:livereload', - 'watch' - ]); - }); - - grunt.registerTask('server', function () { - grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); - grunt.task.run(['serve']); - }); - - - grunt.registerTask('build', [ - 'clean:dist', - 'useminPrepare', - 'concurrent:dist', - 'autoprefixer', - 'concat', - 'cssmin', - 'uglify', - 'copy:dist', - //'rev', - 'usemin' - ]); - - grunt.registerTask('default', [ - 'newer:jshint', - 'build' - ]); -}; diff --git a/book/bower_components/codecode/.bower.json b/book/bower_components/codecode/.bower.json deleted file mode 100644 index 03017b16..00000000 --- a/book/bower_components/codecode/.bower.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "codecode", - "version": "0.1.2", - "author": "Stephen Sawchuk", - "description": "codecode allows your readers to dock your syntax-highlighted code blocks to the bottom of the page, allowing them to refer back without losing their place in your article.", - "homepage": "http://stephenplusplus.github.io/codecode", - "main": [ - "codecode.js", - "codecode.css" - ], - "repository": { - "type": "git", - "url": "git://github.com/stephenplusplus/codecode.git" - }, - "dependencies": { - "jquery": ">= 1.8.0" - }, - "_release": "0.1.2", - "_resolution": { - "type": "version", - "tag": "0.1.2", - "commit": "4cd82899a3c3296ac940fc390cc7d1de91d445f6" - }, - "_source": "git://github.com/stephenplusplus/codecode.git", - "_target": "~0.1.2", - "_originalSource": "codecode" -} \ No newline at end of file diff --git a/book/bower_components/codecode/.editorconfig b/book/bower_components/codecode/.editorconfig deleted file mode 100644 index ae2ebfee..00000000 --- a/book/bower_components/codecode/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 2 -end_of_line = lf -trim_trailing_whitespace = true -insert_final_newline = true diff --git a/book/bower_components/codecode/bower.json b/book/bower_components/codecode/bower.json deleted file mode 100644 index c7b0f0f9..00000000 --- a/book/bower_components/codecode/bower.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "codecode", - "version": "0.1.1", - "author": "Stephen Sawchuk", - "description": "codecode allows your readers to dock your syntax-highlighted code blocks to the bottom of the page, allowing them to refer back without losing their place in your article.", - "homepage": "http://stephenplusplus.github.io/codecode", - "main": [ - "codecode.js", - "codecode.css" - ], - "repository": { - "type": "git", - "url": "git://github.com/stephenplusplus/codecode.git" - }, - "dependencies": { - "jquery": ">= 1.8.0" - } -} diff --git a/book/bower_components/codecode/readme.md b/book/bower_components/codecode/readme.md deleted file mode 100644 index 83f26763..00000000 --- a/book/bower_components/codecode/readme.md +++ /dev/null @@ -1,33 +0,0 @@ -# codecode. ----- - -### What is `codecode`? -If you spend any time reading a programmer's blog, there's a good chance you're going to be reading some code samples. I often have the problem of either looking ahead to the code without reading the text, or I just want to refer back to the code as I'm digesting the author's point. Our monitors are only so tall; I just want to be able to see both at the same time, without losing my place in either. - -That's what `codecode` helps with. It's a jQuery plug-in which will split your page in two, allowing your readers to see your code as they read your article. - -### Will it work with [SyntaxHighlighter](http://alexgorbatchev.com/SyntaxHighlighter/)? -Omg, yes! Just include `codecode.js` on your page, and... that's it! - -### I use my own syntax highlighter / How do I use `codecode`? -`codecode` can be dropped onto your website, anywhere code blocks are used, such as: - -```html - - - - - This is a website! - ... -``` - -All you need to do is: - -1. Have jQuery available. -2. Download and include `codecode.js` or `codecode.min.js`. -3. Call `$('.codeblock').codecode();` - -You're done! - -### A demo! -I've set up a [demo page](http://stephenplusplus.github.com/codecode) to show how `codecode` can help. diff --git a/book/bower_components/jquery/.bower.json b/book/bower_components/jquery/.bower.json deleted file mode 100644 index 90c2ec0a..00000000 --- a/book/bower_components/jquery/.bower.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "jquery", - "version": "1.10.2", - "description": "jQuery component", - "keywords": [ - "jquery", - "component" - ], - "main": "jquery.js", - "license": "MIT", - "homepage": "https://github.com/jquery/jquery", - "_release": "1.10.2", - "_resolution": { - "type": "version", - "tag": "1.10.2", - "commit": "16b079b164d62bd807c612806842a13bf9b04d17" - }, - "_source": "git://github.com/jquery/jquery.git", - "_target": "~1.10.2", - "_originalSource": "jquery" -} \ No newline at end of file diff --git a/book/bower_components/jquery/.editorconfig b/book/bower_components/jquery/.editorconfig deleted file mode 100644 index d06e3185..00000000 --- a/book/bower_components/jquery/.editorconfig +++ /dev/null @@ -1,43 +0,0 @@ -# This file is for unifying the coding style for different editors and IDEs -# editorconfig.org - -root = true - - -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Tabs in JS unless otherwise specified -[**.js] -indent_style = tab - -[Makefile] -indent_style = tab - - -[speed/**.html] -indent_style = tab - -[speed/**.css] -indent_style = tab - -[speed/benchmarker.js] -indent_style = space -indent_size = 2 - - -[test/**.xml] -indent_style = tab - -[test/**.php] -indent_style = tab - -[test/**.html] -indent_style = tab - -[test/**.css] -indent_style = space -indent_size = 8 diff --git a/book/bower_components/jquery/.gitattributes b/book/bower_components/jquery/.gitattributes deleted file mode 100644 index d6dc4705..00000000 --- a/book/bower_components/jquery/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -* eol=lf -*.jar binary diff --git a/book/bower_components/jquery/.gitignore b/book/bower_components/jquery/.gitignore deleted file mode 100644 index 1040aefd..00000000 --- a/book/bower_components/jquery/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -src/selector-sizzle.js -src/selector.js -dist -.project -.settings -*~ -*.diff -*.patch -/*.html -.DS_Store -dist/.destination.json -dist/.sizecache.json -build/.sizecache.json -node_modules diff --git a/book/bower_components/jquery/.gitmodules b/book/bower_components/jquery/.gitmodules deleted file mode 100644 index 19c60418..00000000 --- a/book/bower_components/jquery/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "src/sizzle"] - path = src/sizzle - url = git://github.com/jquery/sizzle.git -[submodule "test/qunit"] - path = test/qunit - url = git://github.com/jquery/qunit.git diff --git a/book/bower_components/jquery/.jshintrc b/book/bower_components/jquery/.jshintrc deleted file mode 100644 index 13a9e01b..00000000 --- a/book/bower_components/jquery/.jshintrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "boss": true, - "curly": true, - "eqeqeq": true, - "eqnull": true, - "expr": true, - "immed": true, - "noarg": true, - "onevar": true, - "quotmark": "double", - "smarttabs": true, - "trailing": true, - "undef": true, - "unused": true, - - "node": true -} \ No newline at end of file diff --git a/book/bower_components/jquery/.mailmap b/book/bower_components/jquery/.mailmap deleted file mode 100644 index 576f2fb4..00000000 --- a/book/bower_components/jquery/.mailmap +++ /dev/null @@ -1,94 +0,0 @@ -Adam Coulombe -Adam J. Sontag -Alexander Farkas -Alexander Farkas -Alexis Abril -Andrew E Monat -Anton Matzneller -Anton Matzneller -Batiste Bieler -Benjamin Truyman -Brandon Aaron -Carl Danley -Carl Fürstenberg -Carl Fürstenberg -Charles McNulty -Colin Snover -Corey Frang -Dan Heberden -Daniel Chatfield -Daniel Gálvez -Danil Somsikov -Dave Methvin -Dave Reed -David Fox -Devin Cooper -Dmitry Gusev -Earle Castledine -Erick Ruiz de Chávez -Gianni Alessandro Chiappetta -Heungsub Lee -Iraê Carvalho -Isaac Z. Schlueter -Ismail Khair -James Burke -James Padolsey -Jason Bedard -Jay Merrifield -Jay Merrifield -Jean Boussier -Jephte Clain -Jess Thrysoee -Joao Henrique de Andrade Bruni -Joe Presbrey -John Resig -John Resig -Jordan Boesch -Josh Varner -Julian Aubourg -Julian Aubourg -Julian Aubourg -Jörn Zaefferer -Jörn Zaefferer -Jörn Zaefferer -Karl Swedberg -Kris Borchers -Lee Carpenter -Li Xudong -Louis-Rémi Babé -Louis-Rémi Babé -Louis-Rémi Babé -Louis-Rémi Babé -Marcel Greter -Matthias Jäggli -Michael Murray -Michał Gołębiowski -Michał Gołębiowski -Mike Alsup -Nguyen Phuc Lam -Oleg Gaidarenko -Rafaël Blais Masson -Richard D. Worth -Rick Waldron -Rick Waldron -Robert Katić -Ron Otten -Sai Lung Wong -Scott González -Scott Jehl -Sebastian Burkhard -Timmy Willison -Timmy Willison -Timo Tijhof -TJ Holowaychuk -Tom H Fuertes -Tom H Fuertes Tom H Fuertes -Tom Viner -Xavi Ramirez -Xavier Montillet -Yehuda Katz -Yehuda Katz -Yehuda Katz -Yehuda Katz -Yiming He -Terry Jones diff --git a/book/bower_components/jquery/AUTHORS.txt b/book/bower_components/jquery/AUTHORS.txt deleted file mode 100644 index 81c4ebfa..00000000 --- a/book/bower_components/jquery/AUTHORS.txt +++ /dev/null @@ -1,170 +0,0 @@ -Authors ordered by first contribution. - -John Resig -Gilles van den Hoven -Michael Geary -Stefan Petre -Yehuda Katz -Corey Jewett -Klaus Hartl -Franck Marcia -Jörn Zaefferer -Paul Bakaus -Brandon Aaron -Mike Alsup -Dave Methvin -Ed Engelhardt -Sean Catchpole -Paul Mclanahan -David Serduke -Richard D. Worth -Scott González -Ariel Flesler -Jon Evans -TJ Holowaychuk -Michael Bensoussan -Robert Katić -Louis-Rémi Babé -Earle Castledine -Damian Janowski -Rich Dougherty -Kim Dalsgaard -Andrea Giammarchi -Mark Gibson -Karl Swedberg -Justin Meyer -Ben Alman -James Padolsey -David Petersen -Batiste Bieler -Alexander Farkas -Rick Waldron -Filipe Fortes -Neeraj Singh -Paul Irish -Iraê Carvalho -Matt Curry -Michael Monteleone -Noah Sloan -Tom Viner -Douglas Neiner -Adam J. Sontag -Dave Reed -Ralph Whitbeck -Carl Fürstenberg -Jacob Wright -J. Ryan Stinnett -Heungsub Lee -Colin Snover -Ryan W Tenney -Ron Otten -Jephte Clain -Anton Matzneller -Alex Sexton -Dan Heberden -Henri Wiechers -Russell Holbrook -Julian Aubourg -Gianni Alessandro Chiappetta -Scott Jehl -James Burke -Jonas Pfenniger -Xavi Ramirez -Jared Grippe -Sylvester Keil -Brandon Sterne -Mathias Bynens -Timmy Willison -Corey Frang -Anton Kovalyov -David Murdoch -Josh Varner -Charles McNulty -Jordan Boesch -Jess Thrysoee -Michael Murray -Lee Carpenter -Alexis Abril -Rob Morgan -John Firebaugh -Sam Bisbee -Gilmore Davidson -Brian Brennan -Xavier Montillet -Daniel Pihlstrom -Sahab Yazdani -Scott Hughes -Mike Sherov -Greg Hazel -Schalk Neethling -Denis Knauf -Timo Tijhof -Steen Nielsen -Anton Ryzhov -Shi Chuan -Berker Peksag -Toby Brain -Matt Mueller -Daniel Herman -Oleg Gaidarenko -Richard Gibson -Rafaël Blais Masson -Joe Presbrey -Sindre Sorhus -Arne de Bree -Vladislav Zarakovsky -Andrew E Monat -Joao Henrique de Andrade Bruni -Dominik D. Geyer -Matt Farmer -Trey Hunner -Jason Moon -Jeffery To -Kris Borchers -Vladimir Zhuravlev -Jacob Thornton -Chad Killingsworth -Nowres Rafid -David Benjamin -Uri Gilad -Chris Faulkner -Elijah Manor -Daniel Chatfield -Nikita Govorov -Wesley Walser -Michael Pennisi -Markus Staab -Benjamin Truyman -James Huston -Ismail Khair -Carl Danley -Michael Petrovich -Callum Macrae -David Bonner -Erick Ruiz de Chávez -Akintayo Akinwunmi -Dave Riddle -Greg Lavallee -Daniel Gálvez -Sai Lung Wong -Tom H Fuertes -Roland Eckl -Jay Merrifield -Allen J Schmidt Jr -Marcel Greter -Matthias Jäggli -Yiming He -Devin Cooper -Bennett Sorbo -Sebastian Burkhard -Danil Somsikov -Jean Boussier -Adam Coulombe -Andrew Plummer -Dmitry Gusev -Michał Gołębiowski -Jason Bedard -Kyle Robinson Young -Renato Oliveira dos Santos -Chris Talkington -Jason Merino diff --git a/book/bower_components/jquery/CONTRIBUTING.md b/book/bower_components/jquery/CONTRIBUTING.md deleted file mode 100644 index 6028db34..00000000 --- a/book/bower_components/jquery/CONTRIBUTING.md +++ /dev/null @@ -1,216 +0,0 @@ -# Contributing to jQuery - -1. [Getting Involved](#getting-involved) -2. [Discussion](#discussion) -3. [How To Report Bugs](#how-to-report-bugs) -4. [Core Style Guide](#jquery-core-style-guide) -5. [Tips For Bug Patching](#tips-for-bug-patching) - - - -## Getting Involved - -There are a number of ways to get involved with the development of jQuery core. Even if you've never contributed code to an Open Source project before, we're always looking for help identifying bugs, writing and reducing test cases and documentation. - -This is the best way to contribute to jQuery core. Please read through the full guide detailing [How to Report Bugs](#how-to-report-bugs). - -## Discussion - -### Forum and IRC - -The jQuery core development team frequently tracks posts on the [jQuery Development Forum](http://forum.jquery.com/developing-jquery-core). If you have longer posts or questions please feel free to post them there. If you think you've found a bug please [file it in the bug tracker](#how-to-report-bugs). - -Additionally most of the jQuery core development team can be found in the [#jquery-dev](http://webchat.freenode.net/?channels=jquery-dev) IRC channel on irc.freenode.net. - -### Weekly Status Meetings - -Every week (unless otherwise noted) the jQuery core dev team has a meeting to discuss the progress of current work and to bring forward possible new blocker bugs for discussion. - -The meeting is held in the [#jquery-meeting](http://webchat.freenode.net/?channels=jquery-meeting) IRC channel on irc.freenode.net at [Noon EST](http://www.timeanddate.com/worldclock/fixedtime.html?month=1&day=17&year=2011&hour=12&min=0&sec=0&p1=43) on Mondays. - -[Past Meeting Notes](https://docs.google.com/document/d/1MrLFvoxW7GMlH9KK-bwypn77cC98jUnz7sMW1rg_TP4/edit?hl=en) - - -## How to Report Bugs - -### Make sure it is a jQuery bug - -Many bugs reported to our bug tracker are actually bugs in user code, not in jQuery code. Keep in mind that just because your code throws an error and the console points to a line number inside of jQuery, this does *not* mean the bug is a jQuery bug; more often than not, these errors result from providing incorrect arguments when calling a jQuery function. - -If you are new to jQuery, it is usually a much better idea to ask for help first in the [Using jQuery Forum](http://forum.jquery.com/using-jquery) or the [jQuery IRC channel](http://webchat.freenode.net/?channels=%23jquery). You will get much quicker support, and you will help avoid tying up the jQuery team with invalid bug reports. These same resources can also be useful if you want to confirm that your bug is indeed a bug in jQuery before filing any tickets. - - -### Disable any browser extensions - -Make sure you have reproduced the bug with all browser extensions and add-ons disabled, as these can sometimes cause things to break in interesting and unpredictable ways. Try using incognito, stealth or anonymous browsing modes. - - -### Try the latest version of jQuery - -Bugs in old versions of jQuery may have already been fixed. In order to avoid reporting known issues, make sure you are always testing against the [latest build](http://code.jquery.com/jquery.js). - -### Try an older version of jQuery - -Sometimes, bugs are introduced in newer versions of jQuery that do not exist in previous versions. When possible, it can be useful to try testing with an older release. - -### Reduce, reduce, reduce! - -When you are experiencing a problem, the most useful thing you can possibly do is to [reduce your code](http://webkit.org/quality/reduction.html) to the bare minimum required to reproduce the issue. This makes it *much* easier to isolate and fix the offending code. Bugs that are reported without reduced test cases take on average 9001% longer to fix than bugs that are submitted with them, so you really should try to do this if at all possible. - -## jQuery Core Style Guide - -See: [jQuery Core Style Guide](http://docs.jquery.com/JQuery_Core_Style_Guidelines) - -## Tips For Bug Patching - - -### Environment: localhost w/ PHP, Node & Grunt - -Starting in jQuery 1.8, a newly overhauled development workflow has been introduced. In this new system, we rely on node & gruntjs to automate the building and validation of source code—while you write code. - -The Ajax tests still depend on PHP running locally*, so make sure you have the following installed: - -* Some kind of localhost server program that supports PHP (any will do) -* Node.js -* NPM (comes with the latest version of Node.js) -* Grunt (install with: `npm install grunt -g` - - -Maintaining a list of platform specific instructions is outside of the scope of this document and there is plenty of existing documentation for the above technologies. - -* The PHP dependency will soon be shed in favor of an all-node solution. - - -### Build a Local Copy of jQuery - -Create a fork of the jQuery repo on github at http://github.com/jquery/jquery - -Change directory to your web root directory, whatever that might be: - -```bash -$ cd /path/to/your/www/root/ -``` - -Clone your jQuery fork to work locally - -```bash -$ git clone git@github.com:username/jquery.git -``` - -Change directory to the newly created dir jquery/ - -```bash -$ cd jquery -``` - -Add the jQuery master as a remote. I label mine "upstream" - -```bash -$ git remote add upstream git://github.com/jquery/jquery.git -``` - -Get in the habit of pulling in the "upstream" master to stay up to date as jQuery receives new commits - -```bash -$ git pull upstream master -``` - -Run the Grunt tools: - -```bash -$ grunt && grunt watch -``` - -Now open the jQuery test suite in a browser at http://localhost/test. If there is a port, be sure to include it. - -Success! You just built and tested jQuery! - - -### Fix a bug from a ticket filed at bugs.jquery.com: - -**NEVER write your patches to the master branch** - it gets messy (I say this from experience!) - -**ALWAYS USE A "TOPIC" BRANCH!** Like so (#### = the ticket #)... - -Make sure you start with your up-to-date master: - -```bash -$ git checkout master -``` - -Create and checkout a new branch that includes the ticket # - -```bash -$ git checkout -b bug_#### - -# ( Explanation: this useful command will: -# "checkout" a "-b" (branch) by the name of "bug_####" -# or create it if it doesn't exist ) -``` - -Now you're on branch: bug_#### - -Determine the module/file you'll be working in... - -Open up the corresponding /test/unit/?????.js and add the initial failing unit tests. This may seem awkward at first, but in the long run it will make sense. To truly and efficiently patch a bug, you need to be working against that bug. - -Next, open the module files and make your changes - -Run http://localhost/test --> **ALL TESTS MUST PASS** - -Once you're satisfied with your patch... - -Stage the files to be tracked: - -```bash -$ git add filename -# (you can use "git status" to list the files you've changed) -``` - - -( I recommend NEVER, EVER using "git add . " ) - -Once you've staged all of your changed files, go ahead and commit them - -```bash -$ git commit -m "Brief description of fix. Fixes #0000" -``` - -For a multiple line commit message, leave off the `-m "description"`. - -You will then be led into vi (or the text editor that you have set up) to complete your commit message. - -Then, push your branch with the bug fix commits to your github fork - -```bash -$ git push origin -u bug_#### -``` - -Before you tackle your next bug patch, return to the master: - -```bash -$ git checkout master -``` - - - -### Test Suite Tips... - -During the process of writing your patch, you will run the test suite MANY times. You can speed up the process by narrowing the running test suite down to the module you are testing by either double clicking the title of the test or appending it to the url. The following examples assume you're working on a local repo, hosted on your localhost server. - -Example: - -http://localhost/test/?filter=css - -This will only run the "css" module tests. This will significantly speed up your development and debugging. - -**ALWAYS RUN THE FULL SUITE BEFORE COMMITTING AND PUSHING A PATCH!** - - -### jQuery supports the following browsers: - -* Chrome Current-1 -* Safari Current-1 -* Firefox Current-1 -* IE 6+ -* Opera Current-1 diff --git a/book/bower_components/jquery/Gruntfile.js b/book/bower_components/jquery/Gruntfile.js deleted file mode 100644 index 4a024a47..00000000 --- a/book/bower_components/jquery/Gruntfile.js +++ /dev/null @@ -1,594 +0,0 @@ -module.exports = function( grunt ) { - - "use strict"; - - var distpaths = [ - "dist/jquery.js", - "dist/jquery.min.map", - "dist/jquery.min.js" - ], - gzip = require("gzip-js"), - readOptionalJSON = function( filepath ) { - var data = {}; - try { - data = grunt.file.readJSON( filepath ); - } catch(e) {} - return data; - }, - srcHintOptions = readOptionalJSON("src/.jshintrc"); - - // The concatenated file won't pass onevar - // But our modules can - delete srcHintOptions.onevar; - - grunt.initConfig({ - pkg: grunt.file.readJSON("package.json"), - dst: readOptionalJSON("dist/.destination.json"), - compare_size: { - files: [ "dist/jquery.js", "dist/jquery.min.js" ], - options: { - compress: { - gz: function( contents ) { - return gzip.zip( contents, {} ).length; - } - }, - cache: "dist/.sizecache.json" - } - }, - selector: { - destFile: "src/selector-sizzle.js", - apiFile: "src/sizzle-jquery.js", - srcFile: "src/sizzle/dist/sizzle.js" - }, - build: { - all: { - dest: "dist/jquery.js", - src: [ - "src/intro.js", - "src/core.js", - "src/selector-sizzle.js", - "src/callbacks.js", - "src/deferred.js", - "src/support.js", - "src/data.js", - "src/queue.js", - "src/attributes.js", - "src/event.js", - "src/traversing.js", - "src/manipulation.js", - { flag: "wrap", src: "src/wrap.js" }, - { flag: "css", src: "src/css.js" }, - "src/serialize.js", - { flag: "event-alias", src: "src/event-alias.js" }, - { flag: "ajax", src: "src/ajax.js" }, - { flag: "ajax/script", src: "src/ajax/script.js", needs: ["ajax"] }, - { flag: "ajax/jsonp", src: "src/ajax/jsonp.js", needs: [ "ajax", "ajax/script" ] }, - { flag: "ajax/xhr", src: "src/ajax/xhr.js", needs: ["ajax"] }, - { flag: "effects", src: "src/effects.js", needs: ["css"] }, - { flag: "offset", src: "src/offset.js", needs: ["css"] }, - { flag: "dimensions", src: "src/dimensions.js", needs: ["css"] }, - { flag: "deprecated", src: "src/deprecated.js" }, - - "src/exports.js", - "src/outro.js" - ] - } - }, - - jshint: { - dist: { - src: [ "dist/jquery.js" ], - options: srcHintOptions - }, - grunt: { - src: [ "Gruntfile.js" ], - options: { - jshintrc: ".jshintrc" - } - }, - tests: { - // TODO: Once .jshintignore is supported, use that instead. - // issue located here: https://github.com/gruntjs/grunt-contrib-jshint/issues/1 - src: [ "test/data/{test,testinit,testrunner}.js", "test/unit/**/*.js" ], - options: { - jshintrc: "test/.jshintrc" - } - } - }, - - testswarm: { - tests: "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector serialize support traversing Sizzle".split(" ") - }, - - watch: { - files: [ "<%= jshint.grunt.src %>", "<%= jshint.tests.src %>", "src/**/*.js" ], - tasks: "dev" - }, - - "pre-uglify": { - all: { - files: { - "dist/jquery.pre-min.js": [ "dist/jquery.js" ] - }, - options: { - banner: "\n\n\n\n\n\n\n\n\n\n" + // banner line size must be preserved - "/*! jQuery v<%= pkg.version %> | " + - "(c) 2005, 2013 jQuery Foundation, Inc. | " + - "jquery.org/license\n" + - "//@ sourceMappingURL=jquery.min.map\n" + - "*/\n" - } - } - }, - uglify: { - all: { - files: { - "dist/jquery.min.js": [ "dist/jquery.pre-min.js" ] - }, - options: { - // Keep our hard-coded banner - preserveComments: "some", - sourceMap: "dist/jquery.min.map", - sourceMappingURL: "jquery.min.map", - report: "min", - beautify: { - ascii_only: true - }, - compress: { - hoist_funs: false, - join_vars: false, - loops: false, - unused: false - } - } - } - }, - "post-uglify": { - all: { - files: { - "dist/jquery.min.map.tmp": [ "dist/jquery.min.map" ], - "dist/jquery.min.js.tmp": [ "dist/jquery.min.js" ] - }, - options: { - tempFiles: [ "dist/jquery.min.map.tmp", "dist/jquery.min.js.tmp", "dist/jquery.pre-min.js" ] - } - } - } - }); - - grunt.registerTask( "testswarm", function( commit, configFile ) { - var jobName, - testswarm = require( "testswarm" ), - runs = {}, - done = this.async(), - pull = /PR-(\d+)/.exec( commit ), - config = grunt.file.readJSON( configFile ).jquery, - tests = grunt.config([ this.name, "tests" ]); - - if ( pull ) { - jobName = "jQuery pull #" + pull[ 1 ] + ""; - } else { - jobName = "jQuery commit #" + commit.substr( 0, 10 ) + ""; - } - - tests.forEach(function( test ) { - runs[test] = config.testUrl + commit + "/test/index.html?module=" + test; - }); - - testswarm.createClient( { - url: config.swarmUrl, - pollInterval: 10000, - timeout: 1000 * 60 * 30 - } ) - .addReporter( testswarm.reporters.cli ) - .auth( { - id: config.authUsername, - token: config.authToken - }) - .addjob( - { - name: jobName, - runs: runs, - runMax: config.runMax, - browserSets: config.browserSets - }, function( err, passed ) { - if ( err ) { - grunt.log.error( err ); - } - done( passed ); - } - ); - }); - - grunt.registerTask( "selector", "Build Sizzle-based selector module", function() { - - var cfg = grunt.config("selector"), - name = cfg.destFile, - sizzle = { - api: grunt.file.read( cfg.apiFile ), - src: grunt.file.read( cfg.srcFile ) - }, - compiled, parts; - - /** - - sizzle-jquery.js -> sizzle between "EXPOSE" blocks, - replace define & window.Sizzle assignment - - - // EXPOSE - if ( typeof define === "function" && define.amd ) { - define(function() { return Sizzle; }); - } else { - window.Sizzle = Sizzle; - } - // EXPOSE - - Becomes... - - Sizzle.attr = jQuery.attr; - jQuery.find = Sizzle; - jQuery.expr = Sizzle.selectors; - jQuery.expr[":"] = jQuery.expr.pseudos; - jQuery.unique = Sizzle.uniqueSort; - jQuery.text = Sizzle.getText; - jQuery.isXMLDoc = Sizzle.isXML; - jQuery.contains = Sizzle.contains; - - */ - - // Break into 3 pieces - parts = sizzle.src.split("// EXPOSE"); - // Replace the if/else block with api - parts[1] = sizzle.api; - // Rejoin the pieces - compiled = parts.join(""); - - grunt.verbose.writeln("Injected " + cfg.apiFile + " into " + cfg.srcFile); - - // Write concatenated source to file, and ensure newline-only termination - grunt.file.write( name, compiled.replace( /\x0d\x0a/g, "\x0a" ) ); - - // Fail task if errors were logged. - if ( this.errorCount ) { - return false; - } - - // Otherwise, print a success message. - grunt.log.writeln( "File '" + name + "' created." ); - }); - - // Special "alias" task to make custom build creation less grawlix-y - grunt.registerTask( "custom", function() { - var done = this.async(), - args = [].slice.call(arguments), - modules = args.length ? args[0].replace(/,/g, ":") : ""; - - - // Translation example - // - // grunt custom:+ajax,-dimensions,-effects,-offset - // - // Becomes: - // - // grunt build:*:*:+ajax:-dimensions:-effects:-offset - - grunt.log.writeln( "Creating custom build...\n" ); - - grunt.util.spawn({ - grunt: true, - args: [ "build:*:*:" + modules, "pre-uglify", "uglify", "dist" ] - }, function( err, result ) { - if ( err ) { - grunt.verbose.error(); - done( err ); - return; - } - - grunt.log.writeln( result.stdout.replace("Done, without errors.", "") ); - - done(); - }); - }); - - // Special concat/build task to handle various jQuery build requirements - grunt.registerMultiTask( - "build", - "Concatenate source (include/exclude modules with +/- flags), embed date/version", - function() { - - // Concat specified files. - var compiled = "", - modules = this.flags, - optIn = !modules["*"], - explicit = optIn || Object.keys(modules).length > 1, - name = this.data.dest, - src = this.data.src, - deps = {}, - excluded = {}, - version = grunt.config( "pkg.version" ), - excluder = function( flag, needsFlag ) { - // optIn defaults implicit behavior to weak exclusion - if ( optIn && !modules[ flag ] && !modules[ "+" + flag ] ) { - excluded[ flag ] = false; - } - - // explicit or inherited strong exclusion - if ( excluded[ needsFlag ] || modules[ "-" + flag ] ) { - excluded[ flag ] = true; - - // explicit inclusion overrides weak exclusion - } else if ( excluded[ needsFlag ] === false && - ( modules[ flag ] || modules[ "+" + flag ] ) ) { - - delete excluded[ needsFlag ]; - - // ...all the way down - if ( deps[ needsFlag ] ) { - deps[ needsFlag ].forEach(function( subDep ) { - modules[ needsFlag ] = true; - excluder( needsFlag, subDep ); - }); - } - } - }; - - // append commit id to version - if ( process.env.COMMIT ) { - version += " " + process.env.COMMIT; - } - - // figure out which files to exclude based on these rules in this order: - // dependency explicit exclude - // > explicit exclude - // > explicit include - // > dependency implicit exclude - // > implicit exclude - // examples: - // * none (implicit exclude) - // *:* all (implicit include) - // *:*:-css all except css and dependents (explicit > implicit) - // *:*:-css:+effects same (excludes effects because explicit include is trumped by explicit exclude of dependency) - // *:+effects none except effects and its dependencies (explicit include trumps implicit exclude of dependency) - src.forEach(function( filepath ) { - var flag = filepath.flag; - - if ( flag ) { - - excluder(flag); - - // check for dependencies - if ( filepath.needs ) { - deps[ flag ] = filepath.needs; - filepath.needs.forEach(function( needsFlag ) { - excluder( flag, needsFlag ); - }); - } - } - }); - - // append excluded modules to version - if ( Object.keys( excluded ).length ) { - version += " -" + Object.keys( excluded ).join( ",-" ); - // set pkg.version to version with excludes, so minified file picks it up - grunt.config.set( "pkg.version", version ); - } - - - // conditionally concatenate source - src.forEach(function( filepath ) { - var flag = filepath.flag, - specified = false, - omit = false, - messages = []; - - if ( flag ) { - if ( excluded[ flag ] !== undefined ) { - messages.push([ - ( "Excluding " + flag ).red, - ( "(" + filepath.src + ")" ).grey - ]); - specified = true; - omit = !filepath.alt; - if ( !omit ) { - flag += " alternate"; - filepath.src = filepath.alt; - } - } - if ( excluded[ flag ] === undefined ) { - messages.push([ - ( "Including " + flag ).green, - ( "(" + filepath.src + ")" ).grey - ]); - - // If this module was actually specified by the - // builder, then set the flag to include it in the - // output list - if ( modules[ "+" + flag ] ) { - specified = true; - } - } - - filepath = filepath.src; - - // Only display the inclusion/exclusion list when handling - // an explicit list. - // - // Additionally, only display modules that have been specified - // by the user - if ( explicit && specified ) { - messages.forEach(function( message ) { - grunt.log.writetableln( [ 27, 30 ], message ); - }); - } - } - - if ( !omit ) { - compiled += grunt.file.read( filepath ); - } - }); - - // Embed Version - // Embed Date - compiled = compiled.replace( /@VERSION/g, version ) - // yyyy-mm-ddThh:mmZ - .replace( /@DATE/g, ( new Date() ).toISOString().replace( /:\d+\.\d+Z$/, "Z" ) ); - - // Write concatenated source to file - grunt.file.write( name, compiled ); - - // Fail task if errors were logged. - if ( this.errorCount ) { - return false; - } - - // Otherwise, print a success message. - grunt.log.writeln( "File '" + name + "' created." ); - }); - - // Process files for distribution - grunt.registerTask( "dist", function() { - var stored, flags, paths, fs, nonascii; - - // Check for stored destination paths - // ( set in dist/.destination.json ) - stored = Object.keys( grunt.config( "dst" ) ); - - // Allow command line input as well - flags = Object.keys( this.flags ); - - // Combine all output target paths - paths = [].concat( stored, flags ).filter(function( path ) { - return path !== "*"; - }); - - // Ensure the dist files are pure ASCII - fs = require( "fs" ); - nonascii = false; - - distpaths.forEach(function( filename ) { - var i, c, - text = fs.readFileSync( filename, "utf8" ); - - // Ensure files use only \n for line endings, not \r\n - if ( /\x0d\x0a/.test( text ) ) { - grunt.log.writeln( filename + ": Incorrect line endings (\\r\\n)" ); - nonascii = true; - } - - // Ensure only ASCII chars so script tags don't need a charset attribute - if ( text.length !== Buffer.byteLength( text, "utf8" ) ) { - grunt.log.writeln( filename + ": Non-ASCII characters detected:" ); - for ( i = 0; i < text.length; i++ ) { - c = text.charCodeAt( i ); - if ( c > 127 ) { - grunt.log.writeln( "- position " + i + ": " + c ); - grunt.log.writeln( "-- " + text.substring( i - 20, i + 20 ) ); - break; - } - } - nonascii = true; - } - - // Modify map/min so that it points to files in the same folder; - // see https://github.com/mishoo/UglifyJS2/issues/47 - if ( /\.map$/.test( filename ) ) { - text = text.replace( /"dist\//g, "\"" ); - fs.writeFileSync( filename, text, "utf-8" ); - - // Use our hard-coded sourceMap directive instead of the autogenerated one (#13274; #13776) - } else if ( /\.min\.js$/.test( filename ) ) { - i = 0; - text = text.replace( /(?:\/\*|)\n?\/\/@\s*sourceMappingURL=.*(\n\*\/|)/g, - function( match ) { - if ( i++ ) { - return ""; - } - return match; - }); - fs.writeFileSync( filename, text, "utf-8" ); - } - - // Optionally copy dist files to other locations - paths.forEach(function( path ) { - var created; - - if ( !/\/$/.test( path ) ) { - path += "/"; - } - - created = path + filename.replace( "dist/", "" ); - grunt.file.write( created, text ); - grunt.log.writeln( "File '" + created + "' created." ); - }); - }); - - return !nonascii; - }); - - // Work around grunt-contrib-uglify sourceMap issues (jQuery #13776) - grunt.registerMultiTask( "pre-uglify", function() { - var banner = this.options().banner; - - this.files.forEach(function( mapping ) { - // Join src - var input = mapping.src.map(function( file ) { - var contents = grunt.file.read( file ); - - // Strip banners - return contents - // Remove the main jQuery banner, it'll be replaced by the new banner anyway. - .replace( /^\/\*!(?:.|\n)*?\*\/\n?/g, "" ) - // Strip other banners preserving line count. - .replace( /^\/\*!(?:.|\n)*?\*\/\n?/gm, function ( match ) { - return match.replace( /[^\n]/gm, "" ); - }); - }).join("\n"); - - // Write temp file (with optional banner) - grunt.file.write( mapping.dest, ( banner || "" ) + input ); - }); - }); - - // Change the map file to point back to jquery.js instead of jquery.pre-min.js. - // The problem is caused by the pre-uglify task. - // Also, remove temporary files. - grunt.registerMultiTask( "post-uglify", function() { - var fs = require( "fs" ); - - this.files.forEach(function( mapping ) { - var mapFileName = mapping.src[ 0 ]; - - // Rename the file to a temporary name. - fs.renameSync( mapFileName, mapping.dest); - grunt.file.write( mapFileName, grunt.file.read( mapping.dest ) - // The uglify task erroneously prepends dist/ to file names. - .replace( /"dist\//g, "\"" ) - // Refer to the source jquery.js, not the temporary jquery.pre-min.js. - .replace( /\.pre-min\./g, "." ) - // There's already a pragma at the beginning of the file, remove the one at the end. - .replace( /\/\/@ sourceMappingURL=jquery\.min\.map$/g, "" )); - }); - - // Remove temporary files. - this.options().tempFiles.forEach(function( fileName ) { - fs.unlink( fileName ); - }); - }); - - // Load grunt tasks from NPM packages - grunt.loadNpmTasks("grunt-compare-size"); - grunt.loadNpmTasks("grunt-git-authors"); - grunt.loadNpmTasks("grunt-update-submodules"); - grunt.loadNpmTasks("grunt-contrib-watch"); - grunt.loadNpmTasks("grunt-contrib-jshint"); - grunt.loadNpmTasks("grunt-contrib-uglify"); - - // Default grunt - grunt.registerTask( "default", [ "update_submodules", "selector", "build:*:*", "jshint", "pre-uglify", "uglify", "post-uglify", "dist:*", "compare_size" ] ); - - // Short list as a high frequency watch task - grunt.registerTask( "dev", [ "selector", "build:*:*", "jshint" ] ); -}; diff --git a/book/bower_components/jquery/MIT-LICENSE.txt b/book/bower_components/jquery/MIT-LICENSE.txt deleted file mode 100644 index 957f26d3..00000000 --- a/book/bower_components/jquery/MIT-LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -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. diff --git a/book/bower_components/jquery/README.md b/book/bower_components/jquery/README.md deleted file mode 100644 index 2fd8146a..00000000 --- a/book/bower_components/jquery/README.md +++ /dev/null @@ -1,398 +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 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) and a - [binary version of Node.js](http://nodejs.org). Make sure all two 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 and which packages), and - a [binary version of Node.js](http://nodejs.org/). - -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 git and Node.js, 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 -``` - -Install the grunt-cli package so that you will have the correct version of grunt available from any project that needs it. This should be done as a global install: - -```bash -npm install -g grunt-cli -``` - -Enter the jquery directory and install the Node dependencies, this time *without* specifying a global install: - -```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, along with the minified copy and associated map file. - - -### Modules - -Special builds can be created that exclude subsets of jQuery functionality. -This allows for smaller custom builds when the builder is certain that those parts of jQuery are not being used. -For example, an app that only used JSONP for `$.ajax()` and did not need to calculate offsets or positions of elements could exclude the offset and ajax/xhr modules. The current modules that can be excluded are: - -- **ajax**: All AJAX functionality: `$.ajax()`, `$.get()`, `$.post()`, `$.ajaxSetup()`, `.load()`, transports, and ajax event shorthands such as `.ajaxStart()`. -- **ajax/xhr**: The XMLHTTPRequest AJAX transport only. -- **ajax/script**: The ` - - - - - - -
-

Hello

-
-
-

lorem ipsum

-

dolor sit amet

-
-
-
-
    - - - diff --git a/book/bower_components/jquery/speed/css.html b/book/bower_components/jquery/speed/css.html deleted file mode 100644 index 4d6700cf..00000000 --- a/book/bower_components/jquery/speed/css.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - Test Event Handling Performance - - - - - - - - -

    Getting Values: Loading...

    -

    Setting Values: Loading...

    - - diff --git a/book/bower_components/jquery/speed/event.html b/book/bower_components/jquery/speed/event.html deleted file mode 100644 index 6d463b4d..00000000 --- a/book/bower_components/jquery/speed/event.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - Test Event Handling Performance - - - - - - - -

    Move the mouse, please!

    -

    - - diff --git a/book/bower_components/jquery/speed/filter.html b/book/bower_components/jquery/speed/filter.html deleted file mode 100644 index e19e82c6..00000000 --- a/book/bower_components/jquery/speed/filter.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - Test .filter() Performance - - - - - - - -
    -

    Hello

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
      - - - diff --git a/book/bower_components/jquery/speed/find.html b/book/bower_components/jquery/speed/find.html deleted file mode 100644 index 01ed1d3a..00000000 --- a/book/bower_components/jquery/speed/find.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - Test .find() Performance - - - - - - - -
      -

      Hello

      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
        - - - diff --git a/book/bower_components/jquery/speed/index.html b/book/bower_components/jquery/speed/index.html deleted file mode 100644 index 74c67bc3..00000000 --- a/book/bower_components/jquery/speed/index.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - Speed Test - - - - - - - - -

        Speed Test

        -
        -
        -

        Using the following selector expressions ( times each):

        -

        NOTE: Number shown is an average.

        -
        - - - - - -
        - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Run?Test
        - -
        - - - - - - -
        -
        -
        - - - - - diff --git a/book/bower_components/jquery/speed/jquery-basis.js b/book/bower_components/jquery/speed/jquery-basis.js deleted file mode 100644 index 9335cc0b..00000000 --- a/book/bower_components/jquery/speed/jquery-basis.js +++ /dev/null @@ -1,6238 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.2 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Sat Feb 13 22:33:48 2010 -0500 - */ -(function( window, undefined ) { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // (both of which we optimize for) - quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, - - // Is it a simple selector - isSimple = /^.[^:#\[\.,]*$/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // Has the ready events already been bound? - readyBound = false, - - // The functions to execute on DOM ready - readyList = [], - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwnProperty = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - indexOf = Array.prototype.indexOf; - -jQuery.fn = jQuery.prototype = { - init: function( selector, context ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context ) { - this.context = document; - this[0] = document.body; - this.selector = "body"; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - match = quickExpr.exec( selector ); - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - doc = (context ? context.ownerDocument || context : document); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = buildFragment( [ match[1] ], [ doc ] ); - selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - if ( elem ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $("TAG") - } else if ( !context && /^\w+$/.test( selector ) ) { - this.selector = selector; - this.context = document; - selector = document.getElementsByTagName( selector ); - return jQuery.merge( this, selector ); - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return (context || rootjQuery).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return jQuery( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if (selector.selector !== undefined) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.4.2", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = jQuery(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + (this.selector ? " " : "") + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // If the DOM is already ready - if ( jQuery.isReady ) { - // Execute the function immediately - fn.call( document, jQuery ); - - // Otherwise, remember the function for later - } else if ( readyList ) { - // Add the function to the wait list - readyList.push( fn ); - } - - return this; - }, - - eq: function( i ) { - return i === -1 ? - this.slice( i ) : - this.slice( i, +i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || jQuery(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - // copy reference to target object - var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging object literal values or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) { - var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src - : jQuery.isArray(copy) ? [] : {}; - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - window.$ = _$; - - if ( deep ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // Handle when the DOM is ready - ready: function() { - // Make sure that the DOM is not already loaded - if ( !jQuery.isReady ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 13 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If there are functions bound, to execute - if ( readyList ) { - // Execute all of them - var fn, i = 0; - while ( (fn = readyList[ i++ ]) ) { - fn.call( document, jQuery ); - } - - // Reset the list of functions - readyList = null; - } - - // Trigger any bound ready events - if ( jQuery.fn.triggerHandler ) { - jQuery( document ).triggerHandler( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyBound ) { - return; - } - - readyBound = true; - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - return jQuery.ready(); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent("onreadystatechange", DOMContentLoaded); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return toString.call(obj) === "[object Function]"; - }, - - isArray: function( obj ) { - return toString.call(obj) === "[object Array]"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) { - return false; - } - - // Not own constructor property must be Object - if ( obj.constructor - && !hasOwnProperty.call(obj, "constructor") - && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwnProperty.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw msg; - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") - .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { - - // Try to use the native JSON parser first - return window.JSON && window.JSON.parse ? - window.JSON.parse( data ) : - (new Function("return " + data))(); - - } else { - jQuery.error( "Invalid JSON: " + data ); - } - }, - - noop: function() {}, - - // Evaluates a script in a global context - globalEval: function( data ) { - if ( data && rnotwhite.test(data) ) { - // Inspired by code by Andrea Giammarchi - // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html - var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement, - script = document.createElement("script"); - - if ( jQuery.support.scriptEval ) { - script.appendChild( document.createTextNode( data ) ); - } else { - script.text = data; - } - - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709). - head.insertBefore( script, head.firstChild ); - head.removeChild( script ); - } - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction(object); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( var value = object[0]; - i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} - } - } - - return object; - }, - - trim: function( text ) { - return (text || "").replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // The extra typeof function check is to prevent crashes - // in Safari 2 (See: #3039) - if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = []; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - if ( !inv !== !callback( elems[ i ], i ) ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var ret = [], value; - - // Go through the array, translating each of the items to their - // new value (or values). - for ( var i = 0, length = elems.length; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - proxy: function( fn, proxy, thisObject ) { - if ( arguments.length === 2 ) { - if ( typeof proxy === "string" ) { - thisObject = fn; - fn = thisObject[ proxy ]; - proxy = undefined; - - } else if ( proxy && !jQuery.isFunction( proxy ) ) { - thisObject = proxy; - proxy = undefined; - } - } - - if ( !proxy && fn ) { - proxy = function() { - return fn.apply( thisObject || this, arguments ); - }; - } - - // Set the guid of unique handler to the same of original handler, so it can be removed - if ( fn ) { - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - } - - // So proxy can be declared as an argument - return proxy; - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) || - /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || - /(msie) ([\w.]+)/.exec( ua ) || - !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - browser: {} -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -if ( indexOf ) { - jQuery.inArray = function( elem, array ) { - return indexOf.call( array, elem ); - }; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch( error ) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -function evalScript( i, elem ) { - if ( elem.src ) { - jQuery.ajax({ - url: elem.src, - async: false, - dataType: "script" - }); - } else { - jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); - } - - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } -} - -// Multifunctional method to get and set values to a collection -// The value/s can be optionally by executed if its a function -function access( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; -} - -function now() { - return (new Date).getTime(); -} -(function() { - - jQuery.support = {}; - - var root = document.documentElement, - script = document.createElement("script"), - div = document.createElement("div"), - id = "script" + now(); - - div.style.display = "none"; - div.innerHTML = "
        a"; - - var all = div.getElementsByTagName("*"), - a = div.getElementsByTagName("a")[0]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return; - } - - jQuery.support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: div.firstChild.nodeType === 3, - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText insted) - style: /red/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: a.getAttribute("href") === "/a", - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55$/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: div.getElementsByTagName("input")[0].value === "on", - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, - - parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null, - - // Will be defined later - deleteExpando: true, - checkClone: false, - scriptEval: false, - noCloneEvent: true, - boxModel: null - }; - - script.type = "text/javascript"; - try { - script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); - } catch(e) {} - - root.insertBefore( script, root.firstChild ); - - // Make sure that the execution of code works by injecting a script - // tag with appendChild/createTextNode - // (IE doesn't support this, fails, and uses .text instead) - if ( window[ id ] ) { - jQuery.support.scriptEval = true; - delete window[ id ]; - } - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete script.test; - - } catch(e) { - jQuery.support.deleteExpando = false; - } - - root.removeChild( script ); - - if ( div.attachEvent && div.fireEvent ) { - div.attachEvent("onclick", function click() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - jQuery.support.noCloneEvent = false; - div.detachEvent("onclick", click); - }); - div.cloneNode(true).fireEvent("onclick"); - } - - div = document.createElement("div"); - div.innerHTML = ""; - - var fragment = document.createDocumentFragment(); - fragment.appendChild( div.firstChild ); - - // WebKit doesn't clone checked state correctly in fragments - jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; - - // Figure out if the W3C box model works as expected - // document.body must exist before we can do this - jQuery(function() { - var div = document.createElement("div"); - div.style.width = div.style.paddingLeft = "1px"; - - document.body.appendChild( div ); - jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; - document.body.removeChild( div ).style.display = 'none'; - - div = null; - }); - - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - var eventSupported = function( eventName ) { - var el = document.createElement("div"); - eventName = "on" + eventName; - - var isSupported = (eventName in el); - if ( !isSupported ) { - el.setAttribute(eventName, "return;"); - isSupported = typeof el[eventName] === "function"; - } - el = null; - - return isSupported; - }; - - jQuery.support.submitBubbles = eventSupported("submit"); - jQuery.support.changeBubbles = eventSupported("change"); - - // release memory in IE - root = script = div = all = a = null; -})(); - -jQuery.props = { - "for": "htmlFor", - "class": "className", - readonly: "readOnly", - maxlength: "maxLength", - cellspacing: "cellSpacing", - rowspan: "rowSpan", - colspan: "colSpan", - tabindex: "tabIndex", - usemap: "useMap", - frameborder: "frameBorder" -}; -var expando = "jQuery" + now(), uuid = 0, windowData = {}; - -jQuery.extend({ - cache: {}, - - expando:expando, - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - "object": true, - "applet": true - }, - - data: function( elem, name, data ) { - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { - return; - } - - elem = elem == window ? - windowData : - elem; - - var id = elem[ expando ], cache = jQuery.cache, thisCache; - - if ( !id && typeof name === "string" && data === undefined ) { - return null; - } - - // Compute a unique ID for the element - if ( !id ) { - id = ++uuid; - } - - // Avoid generating a new cache unless none exists and we - // want to manipulate it. - if ( typeof name === "object" ) { - elem[ expando ] = id; - thisCache = cache[ id ] = jQuery.extend(true, {}, name); - - } else if ( !cache[ id ] ) { - elem[ expando ] = id; - cache[ id ] = {}; - } - - thisCache = cache[ id ]; - - // Prevent overriding the named cache with undefined values - if ( data !== undefined ) { - thisCache[ name ] = data; - } - - return typeof name === "string" ? thisCache[ name ] : thisCache; - }, - - removeData: function( elem, name ) { - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { - return; - } - - elem = elem == window ? - windowData : - elem; - - var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; - - // If we want to remove a specific section of the element's data - if ( name ) { - if ( thisCache ) { - // Remove the section of cache data - delete thisCache[ name ]; - - // If we've removed all the data, remove the element's cache - if ( jQuery.isEmptyObject(thisCache) ) { - jQuery.removeData( elem ); - } - } - - // Otherwise, we want to remove all of the element's data - } else { - if ( jQuery.support.deleteExpando ) { - delete elem[ jQuery.expando ]; - - } else if ( elem.removeAttribute ) { - elem.removeAttribute( jQuery.expando ); - } - - // Completely remove the data cache - delete cache[ id ]; - } - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - if ( typeof key === "undefined" && this.length ) { - return jQuery.data( this[0] ); - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - var parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - } - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } else { - return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() { - jQuery.data( this, key, value ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); -jQuery.extend({ - queue: function( elem, type, data ) { - if ( !elem ) { - return; - } - - type = (type || "fx") + "queue"; - var q = jQuery.data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( !data ) { - return q || []; - } - - if ( !q || jQuery.isArray(data) ) { - q = jQuery.data( elem, type, jQuery.makeArray(data) ); - - } else { - q.push( data ); - } - - return q; - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), fn = queue.shift(); - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift("inprogress"); - } - - fn.call(elem, function() { - jQuery.dequeue(elem, type); - }); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function( i, elem ) { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; - type = type || "fx"; - - return this.queue( type, function() { - var elem = this; - setTimeout(function() { - jQuery.dequeue( elem, type ); - }, time ); - }); - }, - - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - } -}); -var rclass = /[\n\t]/g, - rspace = /\s+/, - rreturn = /\r/g, - rspecialurl = /href|src|style/, - rtype = /(button|input)/i, - rfocusable = /(button|input|object|select|textarea)/i, - rclickable = /^(a|area)$/i, - rradiocheck = /radio|checkbox/; - -jQuery.fn.extend({ - attr: function( name, value ) { - return access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name, fn ) { - return this.each(function(){ - jQuery.attr( this, name, "" ); - if ( this.nodeType === 1 ) { - this.removeAttribute( name ); - } - }); - }, - - addClass: function( value ) { - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - self.addClass( value.call(this, i, self.attr("class")) ); - }); - } - - if ( value && typeof value === "string" ) { - var classNames = (value || "").split( rspace ); - - for ( var i = 0, l = this.length; i < l; i++ ) { - var elem = this[i]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className ) { - elem.className = value; - - } else { - var className = " " + elem.className + " ", setClass = elem.className; - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { - if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { - setClass += " " + classNames[c]; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - self.removeClass( value.call(this, i, self.attr("class")) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - var classNames = (value || "").split(rspace); - - for ( var i = 0, l = this.length; i < l; i++ ) { - var elem = this[i]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - var className = (" " + elem.className + " ").replace(rclass, " "); - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[c] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function(i) { - var self = jQuery(this); - self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, i = 0, self = jQuery(this), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery.data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " "; - for ( var i = 0, l = this.length; i < l; i++ ) { - if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - if ( value === undefined ) { - var elem = this[0]; - - if ( elem ) { - if ( jQuery.nodeName( elem, "option" ) ) { - return (elem.attributes.value || {}).specified ? elem.value : elem.text; - } - - // We need to handle select boxes special - if ( jQuery.nodeName( elem, "select" ) ) { - var index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { - var option = options[ i ]; - - if ( option.selected ) { - // Get the specific value for the option - value = jQuery(option).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - } - - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { - return elem.getAttribute("value") === null ? "on" : elem.value; - } - - - // Everything else, we just grab the value - return (elem.value || "").replace(rreturn, ""); - - } - - return undefined; - } - - var isFunction = jQuery.isFunction(value); - - return this.each(function(i) { - var self = jQuery(this), val = value; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call(this, i, self.val()); - } - - // Typecast each time if the value is a Function and the appended - // value is therefore different each time. - if ( typeof val === "number" ) { - val += ""; - } - - if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { - this.checked = jQuery.inArray( self.val(), val ) >= 0; - - } else if ( jQuery.nodeName( this, "select" ) ) { - var values = jQuery.makeArray(val); - - jQuery( "option", this ).each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - this.selectedIndex = -1; - } - - } else { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - // don't set attributes on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery(elem)[name](value); - } - - var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), - // Whether we are setting (or getting) - set = value !== undefined; - - // Try to normalize/fix the name - name = notxml && jQuery.props[ name ] || name; - - // Only do all the following if this is a node (faster for style) - if ( elem.nodeType === 1 ) { - // These attributes require special treatment - var special = rspecialurl.test( name ); - - // Safari mis-reports the default selected property of an option - // Accessing the parent's selectedIndex property fixes it - if ( name === "selected" && !jQuery.support.optSelected ) { - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - - // If applicable, access the attribute via the DOM 0 way - if ( name in elem && notxml && !special ) { - if ( set ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } - - elem[ name ] = value; - } - - // browsers index elements by id/name on forms, give priority to attributes. - if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { - return elem.getAttributeNode( name ).nodeValue; - } - - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - if ( name === "tabIndex" ) { - var attributeNode = elem.getAttributeNode( "tabIndex" ); - - return attributeNode && attributeNode.specified ? - attributeNode.value : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - - return elem[ name ]; - } - - if ( !jQuery.support.style && notxml && name === "style" ) { - if ( set ) { - elem.style.cssText = "" + value; - } - - return elem.style.cssText; - } - - if ( set ) { - // convert the value to a string (all browsers do this but IE) see #1070 - elem.setAttribute( name, "" + value ); - } - - var attr = !jQuery.support.hrefNormalized && notxml && special ? - // Some attributes require a special call on IE - elem.getAttribute( name, 2 ) : - elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return attr === null ? undefined : attr; - } - - // elem is actually elem.style ... set the style - // Using attr for specific style information is now deprecated. Use style instead. - return jQuery.style( elem, name, value ); - } -}); -var rnamespaces = /\.(.*)$/, - fcleanup = function( nm ) { - return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { - return "\\" + ch; - }); - }; - -/* - * A number of helper functions used for managing events. - * Many of the ideas behind this code originated from - * Dean Edwards' addEvent library. - */ -jQuery.event = { - - // Bind an event to an element - // Original by Dean Edwards - add: function( elem, types, handler, data ) { - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // For whatever reason, IE has trouble passing the window object - // around, causing it to be cloned in the process - if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { - elem = window; - } - - var handleObjIn, handleObj; - - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the function being executed has a unique ID - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure - var elemData = jQuery.data( elem ); - - // If no elemData is found then we must be trying to bind to one of the - // banned noData elements - if ( !elemData ) { - return; - } - - var events = elemData.events = elemData.events || {}, - eventHandle = elemData.handle, eventHandle; - - if ( !eventHandle ) { - elemData.handle = eventHandle = function() { - // Handle the second event of a trigger and when - // an event is called after a page has unloaded - return typeof jQuery !== "undefined" && !jQuery.event.triggered ? - jQuery.event.handle.apply( eventHandle.elem, arguments ) : - undefined; - }; - } - - // Add elem as a property of the handle function - // This is to prevent a memory leak with non-native events in IE. - eventHandle.elem = elem; - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = types.split(" "); - - var type, i = 0, namespaces; - - while ( (type = types[ i++ ]) ) { - handleObj = handleObjIn ? - jQuery.extend({}, handleObjIn) : - { handler: handler, data: data }; - - // Namespaced event handlers - if ( type.indexOf(".") > -1 ) { - namespaces = type.split("."); - type = namespaces.shift(); - handleObj.namespace = namespaces.slice(0).sort().join("."); - - } else { - namespaces = []; - handleObj.namespace = ""; - } - - handleObj.type = type; - handleObj.guid = handler.guid; - - // Get the current list of functions bound to this event - var handlers = events[ type ], - special = jQuery.event.special[ type ] || {}; - - // Init the event handler queue - if ( !handlers ) { - handlers = events[ type ] = []; - - // Check for a special event handler - // Only use addEventListener/attachEvent if the special - // events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add the function to the element's handler list - handlers.push( handleObj ); - - // Keep track of which events have been used, for global triggering - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, pos ) { - // don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, - elemData = jQuery.data( elem ), - events = elemData && elemData.events; - - if ( !elemData || !events ) { - return; - } - - // types is actually an event object here - if ( types && types.type ) { - handler = types.handler; - types = types.type; - } - - // Unbind all events for the element - if ( !types || typeof types === "string" && types.charAt(0) === "." ) { - types = types || ""; - - for ( type in events ) { - jQuery.event.remove( elem, type + types ); - } - - return; - } - - // Handle multiple events separated by a space - // jQuery(...).unbind("mouseover mouseout", fn); - types = types.split(" "); - - while ( (type = types[ i++ ]) ) { - origType = type; - handleObj = null; - all = type.indexOf(".") < 0; - namespaces = []; - - if ( !all ) { - // Namespaced event handlers - namespaces = type.split("."); - type = namespaces.shift(); - - namespace = new RegExp("(^|\\.)" + - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)") - } - - eventType = events[ type ]; - - if ( !eventType ) { - continue; - } - - if ( !handler ) { - for ( var j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( all || namespace.test( handleObj.namespace ) ) { - jQuery.event.remove( elem, origType, handleObj.handler, j ); - eventType.splice( j--, 1 ); - } - } - - continue; - } - - special = jQuery.event.special[ type ] || {}; - - for ( var j = pos || 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( handler.guid === handleObj.guid ) { - // remove the given handler for the given type - if ( all || namespace.test( handleObj.namespace ) ) { - if ( pos == null ) { - eventType.splice( j--, 1 ); - } - - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - - if ( pos != null ) { - break; - } - } - } - - // remove generic event handler if no more handlers exist - if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - removeEvent( elem, type, elemData.handle ); - } - - ret = null; - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - var handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - delete elemData.events; - delete elemData.handle; - - if ( jQuery.isEmptyObject( elemData ) ) { - jQuery.removeData( elem ); - } - } - }, - - // bubbling is internal - trigger: function( event, data, elem /*, bubbling */ ) { - // Event object or event type - var type = event.type || event, - bubbling = arguments[3]; - - if ( !bubbling ) { - event = typeof event === "object" ? - // jQuery.Event object - event[expando] ? event : - // Object literal - jQuery.extend( jQuery.Event(type), event ) : - // Just the event type (string) - jQuery.Event(type); - - if ( type.indexOf("!") >= 0 ) { - event.type = type = type.slice(0, -1); - event.exclusive = true; - } - - // Handle a global trigger - if ( !elem ) { - // Don't bubble custom events when global (to avoid too much overhead) - event.stopPropagation(); - - // Only trigger if we've ever bound an event for it - if ( jQuery.event.global[ type ] ) { - jQuery.each( jQuery.cache, function() { - if ( this.events && this.events[type] ) { - jQuery.event.trigger( event, data, this.handle.elem ); - } - }); - } - } - - // Handle triggering a single element - - // don't do events on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - // Clean up in case it is reused - event.result = undefined; - event.target = elem; - - // Clone the incoming data, if any - data = jQuery.makeArray( data ); - data.unshift( event ); - } - - event.currentTarget = elem; - - // Trigger the event, it is assumed that "handle" is a function - var handle = jQuery.data( elem, "handle" ); - if ( handle ) { - handle.apply( elem, data ); - } - - var parent = elem.parentNode || elem.ownerDocument; - - // Trigger an inline bound script - try { - if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { - if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { - event.result = false; - } - } - - // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (e) {} - - if ( !event.isPropagationStopped() && parent ) { - jQuery.event.trigger( event, data, parent, true ); - - } else if ( !event.isDefaultPrevented() ) { - var target = event.target, old, - isClick = jQuery.nodeName(target, "a") && type === "click", - special = jQuery.event.special[ type ] || {}; - - if ( (!special._default || special._default.call( elem, event ) === false) && - !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { - - try { - if ( target[ type ] ) { - // Make sure that we don't accidentally re-trigger the onFOO events - old = target[ "on" + type ]; - - if ( old ) { - target[ "on" + type ] = null; - } - - jQuery.event.triggered = true; - target[ type ](); - } - - // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (e) {} - - if ( old ) { - target[ "on" + type ] = old; - } - - jQuery.event.triggered = false; - } - } - }, - - handle: function( event ) { - var all, handlers, namespaces, namespace, events; - - event = arguments[0] = jQuery.event.fix( event || window.event ); - event.currentTarget = this; - - // Namespaced event handlers - all = event.type.indexOf(".") < 0 && !event.exclusive; - - if ( !all ) { - namespaces = event.type.split("."); - event.type = namespaces.shift(); - namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - var events = jQuery.data(this, "events"), handlers = events[ event.type ]; - - if ( events && handlers ) { - // Clone the handlers to prevent manipulation - handlers = handlers.slice(0); - - for ( var j = 0, l = handlers.length; j < l; j++ ) { - var handleObj = handlers[ j ]; - - // Filter the functions by class - if ( all || namespace.test( handleObj.namespace ) ) { - // Pass in a reference to the handler function itself - // So that we can later remove it - event.handler = handleObj.handler; - event.data = handleObj.data; - event.handleObj = handleObj; - - var ret = handleObj.handler.apply( this, arguments ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - - if ( event.isImmediatePropagationStopped() ) { - break; - } - } - } - } - - return event.result; - }, - - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), - - fix: function( event ) { - if ( event[ expando ] ) { - return event; - } - - // store a copy of the original event object - // and "clone" to set read-only properties - var originalEvent = event; - event = jQuery.Event( originalEvent ); - - for ( var i = this.props.length, prop; i; ) { - prop = this.props[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary - if ( !event.target ) { - event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either - } - - // check if target is a textnode (safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && event.fromElement ) { - event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; - } - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && event.clientX != null ) { - var doc = document.documentElement, body = document.body; - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); - } - - // Add which for key events - if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) { - event.which = event.charCode || event.keyCode; - } - - // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) - if ( !event.metaKey && event.ctrlKey ) { - event.metaKey = event.ctrlKey; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && event.button !== undefined ) { - event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); - } - - return event; - }, - - // Deprecated, use jQuery.guid instead - guid: 1E8, - - // Deprecated, use jQuery.proxy instead - proxy: jQuery.proxy, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady, - teardown: jQuery.noop - }, - - live: { - add: function( handleObj ) { - jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) ); - }, - - remove: function( handleObj ) { - var remove = true, - type = handleObj.origType.replace(rnamespaces, ""); - - jQuery.each( jQuery.data(this, "events").live || [], function() { - if ( type === this.origType.replace(rnamespaces, "") ) { - remove = false; - return false; - } - }); - - if ( remove ) { - jQuery.event.remove( this, handleObj.origType, liveHandler ); - } - } - - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( this.setInterval ) { - this.onbeforeunload = eventHandle; - } - - return false; - }, - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - } -}; - -var removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - elem.removeEventListener( type, handle, false ); - } : - function( elem, type, handle ) { - elem.detachEvent( "on" + type, handle ); - }; - -jQuery.Event = function( src ) { - // Allow instantiation without the 'new' keyword - if ( !this.preventDefault ) { - return new jQuery.Event( src ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - // Event type - } else { - this.type = src; - } - - // timeStamp is buggy for some events on Firefox(#3843) - // So we won't rely on the native value - this.timeStamp = now(); - - // Mark it as fixed - this[ expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - } - // otherwise set the returnValue property of the original event to false (IE) - e.returnValue = false; - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Checks if an event happened on an element within another element -// Used in jQuery.event.special.mouseenter and mouseleave handlers -var withinElement = function( event ) { - // Check if mouse(over|out) are still within the same parent element - var parent = event.relatedTarget; - - // Firefox sometimes assigns relatedTarget a XUL element - // which we cannot access the parentNode property of - try { - // Traverse up the tree - while ( parent && parent !== this ) { - parent = parent.parentNode; - } - - if ( parent !== this ) { - // set the correct event type - event.type = event.data; - - // handle event if we actually just moused on to a non sub-element - jQuery.event.handle.apply( this, arguments ); - } - - // assuming we've left the element since we most likely mousedover a xul element - } catch(e) { } -}, - -// In case of event delegation, we only need to rename the event.type, -// liveHandler will take care of the rest. -delegate = function( event ) { - event.type = event.data; - jQuery.event.handle.apply( this, arguments ); -}; - -// Create mouseenter and mouseleave events -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - setup: function( data ) { - jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); - }, - teardown: function( data ) { - jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); - } - }; -}); - -// submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function( data, namespaces ) { - if ( this.nodeName.toLowerCase() !== "form" ) { - jQuery.event.add(this, "click.specialSubmit", function( e ) { - var elem = e.target, type = elem.type; - - if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { - return trigger( "submit", this, arguments ); - } - }); - - jQuery.event.add(this, "keypress.specialSubmit", function( e ) { - var elem = e.target, type = elem.type; - - if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { - return trigger( "submit", this, arguments ); - } - }); - - } else { - return false; - } - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialSubmit" ); - } - }; - -} - -// change delegation, happens here so we have bind. -if ( !jQuery.support.changeBubbles ) { - - var formElems = /textarea|input|select/i, - - changeFilters, - - getVal = function( elem ) { - var type = elem.type, val = elem.value; - - if ( type === "radio" || type === "checkbox" ) { - val = elem.checked; - - } else if ( type === "select-multiple" ) { - val = elem.selectedIndex > -1 ? - jQuery.map( elem.options, function( elem ) { - return elem.selected; - }).join("-") : - ""; - - } else if ( elem.nodeName.toLowerCase() === "select" ) { - val = elem.selectedIndex; - } - - return val; - }, - - testChange = function testChange( e ) { - var elem = e.target, data, val; - - if ( !formElems.test( elem.nodeName ) || elem.readOnly ) { - return; - } - - data = jQuery.data( elem, "_change_data" ); - val = getVal(elem); - - // the current data will be also retrieved by beforeactivate - if ( e.type !== "focusout" || elem.type !== "radio" ) { - jQuery.data( elem, "_change_data", val ); - } - - if ( data === undefined || val === data ) { - return; - } - - if ( data != null || val ) { - e.type = "change"; - return jQuery.event.trigger( e, arguments[1], elem ); - } - }; - - jQuery.event.special.change = { - filters: { - focusout: testChange, - - click: function( e ) { - var elem = e.target, type = elem.type; - - if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { - return testChange.call( this, e ); - } - }, - - // Change has to be called before submit - // Keydown will be called before keypress, which is used in submit-event delegation - keydown: function( e ) { - var elem = e.target, type = elem.type; - - if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || - (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || - type === "select-multiple" ) { - return testChange.call( this, e ); - } - }, - - // Beforeactivate happens also before the previous element is blurred - // with this event you can't trigger a change event, but you can store - // information/focus[in] is not needed anymore - beforeactivate: function( e ) { - var elem = e.target; - jQuery.data( elem, "_change_data", getVal(elem) ); - } - }, - - setup: function( data, namespaces ) { - if ( this.type === "file" ) { - return false; - } - - for ( var type in changeFilters ) { - jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); - } - - return formElems.test( this.nodeName ); - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialChange" ); - - return formElems.test( this.nodeName ); - } - }; - - changeFilters = jQuery.event.special.change.filters; -} - -function trigger( type, elem, args ) { - args[0].type = type; - return jQuery.event.handle.apply( elem, args ); -} - -// Create "bubbling" focus and blur events -if ( document.addEventListener ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - jQuery.event.special[ fix ] = { - setup: function() { - this.addEventListener( orig, handler, true ); - }, - teardown: function() { - this.removeEventListener( orig, handler, true ); - } - }; - - function handler( e ) { - e = jQuery.event.fix( e ); - e.type = fix; - return jQuery.event.handle.call( this, e ); - } - }); -} - -jQuery.each(["bind", "one"], function( i, name ) { - jQuery.fn[ name ] = function( type, data, fn ) { - // Handle object literals - if ( typeof type === "object" ) { - for ( var key in type ) { - this[ name ](key, data, type[key], fn); - } - return this; - } - - if ( jQuery.isFunction( data ) ) { - fn = data; - data = undefined; - } - - var handler = name === "one" ? jQuery.proxy( fn, function( event ) { - jQuery( this ).unbind( event, handler ); - return fn.apply( this, arguments ); - }) : fn; - - if ( type === "unload" && name !== "one" ) { - this.one( type, data, fn ); - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.add( this[i], type, handler, data ); - } - } - - return this; - }; -}); - -jQuery.fn.extend({ - unbind: function( type, fn ) { - // Handle object literals - if ( typeof type === "object" && !type.preventDefault ) { - for ( var key in type ) { - this.unbind(key, type[key]); - } - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.remove( this[i], type, fn ); - } - } - - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.live( types, data, fn, selector ); - }, - - undelegate: function( selector, types, fn ) { - if ( arguments.length === 0 ) { - return this.unbind( "live" ); - - } else { - return this.die( types, null, fn, selector ); - } - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - - triggerHandler: function( type, data ) { - if ( this[0] ) { - var event = jQuery.Event( type ); - event.preventDefault(); - event.stopPropagation(); - jQuery.event.trigger( event, data, this[0] ); - return event.result; - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, i = 1; - - // link all the functions, so any of them can unbind this click handler - while ( i < args.length ) { - jQuery.proxy( fn, args[ i++ ] ); - } - - return this.click( jQuery.proxy( fn, function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - })); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -var liveMap = { - focus: "focusin", - blur: "focusout", - mouseenter: "mouseover", - mouseleave: "mouseout" -}; - -jQuery.each(["live", "die"], function( i, name ) { - jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { - var type, i = 0, match, namespaces, preType, - selector = origSelector || this.selector, - context = origSelector ? this : jQuery( this.context ); - - if ( jQuery.isFunction( data ) ) { - fn = data; - data = undefined; - } - - types = (types || "").split(" "); - - while ( (type = types[ i++ ]) != null ) { - match = rnamespaces.exec( type ); - namespaces = ""; - - if ( match ) { - namespaces = match[0]; - type = type.replace( rnamespaces, "" ); - } - - if ( type === "hover" ) { - types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); - continue; - } - - preType = type; - - if ( type === "focus" || type === "blur" ) { - types.push( liveMap[ type ] + namespaces ); - type = type + namespaces; - - } else { - type = (liveMap[ type ] || type) + namespaces; - } - - if ( name === "live" ) { - // bind live handler - context.each(function(){ - jQuery.event.add( this, liveConvert( type, selector ), - { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); - }); - - } else { - // unbind live handler - context.unbind( liveConvert( type, selector ), fn ); - } - } - - return this; - } -}); - -function liveHandler( event ) { - var stop, elems = [], selectors = [], args = arguments, - related, match, handleObj, elem, j, i, l, data, - events = jQuery.data( this, "events" ); - - // Make sure we avoid non-left-click bubbling in Firefox (#3861) - if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) { - return; - } - - event.liveFired = this; - - var live = events.live.slice(0); - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { - selectors.push( handleObj.selector ); - - } else { - live.splice( j--, 1 ); - } - } - - match = jQuery( event.target ).closest( selectors, event.currentTarget ); - - for ( i = 0, l = match.length; i < l; i++ ) { - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( match[i].selector === handleObj.selector ) { - elem = match[i].elem; - related = null; - - // Those two events require additional checking - if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { - related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; - } - - if ( !related || related !== elem ) { - elems.push({ elem: elem, handleObj: handleObj }); - } - } - } - } - - for ( i = 0, l = elems.length; i < l; i++ ) { - match = elems[i]; - event.currentTarget = match.elem; - event.data = match.handleObj.data; - event.handleObj = match.handleObj; - - if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) { - stop = false; - break; - } - } - - return stop; -} - -function liveConvert( type, selector ) { - return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&"); -} - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( fn ) { - return fn ? this.bind( name, fn ) : this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } -}); - -// Prevent memory leaks in IE -// Window isn't included so as not to unbind existing unload events -// More info: -// - http://isaacschlueter.com/2006/10/msie-memory-leaks/ -if ( window.attachEvent && !window.addEventListener ) { - window.attachEvent("onunload", function() { - for ( var id in jQuery.cache ) { - if ( jQuery.cache[ id ].handle ) { - // Try/Catch is to handle iframes being unloaded, see #4280 - try { - jQuery.event.remove( jQuery.cache[ id ].handle.elem ); - } catch(e) {} - } - } - }); -} -/*! - * Sizzle CSS Selector Engine - v1.0 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparison -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function(){ - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function(selector, context, results, seed) { - results = results || []; - var origContext = context = context || document; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context), - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context ); - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set ); - } - } - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - var ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; - } - - if ( context ) { - var ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray(set); - } else { - prune = false; - } - - while ( parts.length ) { - var cur = parts.pop(), pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - } else if ( context && context.nodeType === 1 ) { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - } else { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function(results){ - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort(sortOrder); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[i-1] ) { - results.splice(i--, 1); - } - } - } - } - - return results; -}; - -Sizzle.matches = function(expr, set){ - return Sizzle(expr, null, null, set); -}; - -Sizzle.find = function(expr, context, isXML){ - var set, match; - - if ( !expr ) { - return []; - } - - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var type = Expr.order[i], match; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - var left = match[1]; - match.splice(1,1); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace(/\\/g, ""); - set = Expr.find[ type ]( match, context, isXML ); - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = context.getElementsByTagName("*"); - } - - return {set: set, expr: expr}; -}; - -Sizzle.filter = function(expr, set, inplace, not){ - var old = expr, result = [], curLoop = set, match, anyFound, - isXMLFilter = set && set[0] && isXML(set[0]); - - while ( expr && set.length ) { - for ( var type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - var filter = Expr.filter[ type ], found, item, left = match[1]; - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - var pass = not ^ !!found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - } else { - curLoop[i] = false; - } - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw "Syntax error, unrecognized expression: " + msg; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - match: { - ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - leftMatch: {}, - attrMap: { - "class": "className", - "for": "htmlFor" - }, - attrHandle: { - href: function(elem){ - return elem.getAttribute("href"); - } - }, - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !/\W/.test(part), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - ">": function(checkSet, part){ - var isPartStr = typeof part === "string"; - - if ( isPartStr && !/\W/.test(part) ) { - part = part.toLowerCase(); - - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - } else { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - "": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - var nodeCheck = part = part.toLowerCase(); - checkFn = dirNodeCheck; - } - - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); - }, - "~": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - var nodeCheck = part = part.toLowerCase(); - checkFn = dirNodeCheck; - } - - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); - } - }, - find: { - ID: function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? [m] : []; - } - }, - NAME: function(match, context){ - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], results = context.getElementsByName(match[1]); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - TAG: function(match, context){ - return context.getElementsByTagName(match[1]); - } - }, - preFilter: { - CLASS: function(match, curLoop, inplace, result, not, isXML){ - match = " " + match[1].replace(/\\/g, "") + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - ID: function(match){ - return match[1].replace(/\\/g, ""); - }, - TAG: function(match, curLoop){ - return match[1].toLowerCase(); - }, - CHILD: function(match){ - if ( match[1] === "nth" ) { - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - ATTR: function(match, curLoop, inplace, result, not, isXML){ - var name = match[1].replace(/\\/g, ""); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - PSEUDO: function(match, curLoop, inplace, result, not){ - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - if ( !inplace ) { - result.push.apply( result, ret ); - } - return false; - } - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - POS: function(match){ - match.unshift( true ); - return match; - } - }, - filters: { - enabled: function(elem){ - return elem.disabled === false && elem.type !== "hidden"; - }, - disabled: function(elem){ - return elem.disabled === true; - }, - checked: function(elem){ - return elem.checked === true; - }, - selected: function(elem){ - // Accessing this property makes selected-by-default - // options in Safari work properly - elem.parentNode.selectedIndex; - return elem.selected === true; - }, - parent: function(elem){ - return !!elem.firstChild; - }, - empty: function(elem){ - return !elem.firstChild; - }, - has: function(elem, i, match){ - return !!Sizzle( match[3], elem ).length; - }, - header: function(elem){ - return /h\d/i.test( elem.nodeName ); - }, - text: function(elem){ - return "text" === elem.type; - }, - radio: function(elem){ - return "radio" === elem.type; - }, - checkbox: function(elem){ - return "checkbox" === elem.type; - }, - file: function(elem){ - return "file" === elem.type; - }, - password: function(elem){ - return "password" === elem.type; - }, - submit: function(elem){ - return "submit" === elem.type; - }, - image: function(elem){ - return "image" === elem.type; - }, - reset: function(elem){ - return "reset" === elem.type; - }, - button: function(elem){ - return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; - }, - input: function(elem){ - return /input|select|textarea|button/i.test(elem.nodeName); - } - }, - setFilters: { - first: function(elem, i){ - return i === 0; - }, - last: function(elem, i, match, array){ - return i === array.length - 1; - }, - even: function(elem, i){ - return i % 2 === 0; - }, - odd: function(elem, i){ - return i % 2 === 1; - }, - lt: function(elem, i, match){ - return i < match[3] - 0; - }, - gt: function(elem, i, match){ - return i > match[3] - 0; - }, - nth: function(elem, i, match){ - return match[3] - 0 === i; - }, - eq: function(elem, i, match){ - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function(elem, match, i, array){ - var name = match[1], filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - } else if ( name === "not" ) { - var not = match[3]; - - for ( var i = 0, l = not.length; i < l; i++ ) { - if ( not[i] === elem ) { - return false; - } - } - - return true; - } else { - Sizzle.error( "Syntax error, unrecognized expression: " + name ); - } - }, - CHILD: function(elem, match){ - var type = match[1], node = elem; - switch (type) { - case 'only': - case 'first': - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - if ( type === "first" ) { - return true; - } - node = elem; - case 'last': - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - return true; - case 'nth': - var first = match[2], last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - var doneName = match[0], - parent = elem.parentNode; - - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { - var count = 0; - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - parent.sizcache = doneName; - } - - var diff = elem.nodeIndex - last; - if ( first === 0 ) { - return diff === 0; - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - ID: function(elem, match){ - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - TAG: function(elem, match){ - return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; - }, - CLASS: function(elem, match){ - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - ATTR: function(elem, match){ - var name = match[1], - result = Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - POS: function(elem, match, i, array){ - var name = match[2], filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){ - return "\\" + (num - 0 + 1); - })); -} - -var makeArray = function(array, results) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch(e){ - makeArray = function(array, results) { - var ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - } else { - if ( typeof array.length === "number" ) { - for ( var i = 0, l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - } else { - for ( var i = 0; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.compareDocumentPosition ? -1 : 1; - } - - var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( "sourceIndex" in document.documentElement ) { - sortOrder = function( a, b ) { - if ( !a.sourceIndex || !b.sourceIndex ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.sourceIndex ? -1 : 1; - } - - var ret = a.sourceIndex - b.sourceIndex; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( document.createRange ) { - sortOrder = function( a, b ) { - if ( !a.ownerDocument || !b.ownerDocument ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.ownerDocument ? -1 : 1; - } - - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); - aRange.setStart(a, 0); - aRange.setEnd(a, 0); - bRange.setStart(b, 0); - bRange.setEnd(b, 0); - var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} - -// Utility function for retrieving the text value of an array of DOM nodes -function getText( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += getText( elem.childNodes ); - } - } - - return ret; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date).getTime(); - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - var root = document.documentElement; - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; - } - }; - - Expr.filter.ID = function(elem, match){ - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - root = form = null; // release memory in IE -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function(match, context){ - var results = context.getElementsByTagName(match[1]); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - Expr.attrHandle.href = function(elem){ - return elem.getAttribute("href", 2); - }; - } - - div = null; // release memory in IE -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, div = document.createElement("div"); - div.innerHTML = "

        "; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function(query, context, extra, seed){ - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && context.nodeType === 9 && !isXML(context) ) { - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(e){} - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - div = null; // release memory in IE - })(); -} - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
        "; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function(match, context, isXML) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - div = null; // release memory in IE -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem.sizcache = doneName; - elem.sizset = i; - } - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -var contains = document.compareDocumentPosition ? function(a, b){ - return !!(a.compareDocumentPosition(b) & 16); -} : function(a, b){ - return a !== b && (a.contains ? a.contains(b) : true); -}; - -var isXML = function(elem){ - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function(selector, context){ - var tmpSet = [], later = "", match, - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = getText; -jQuery.isXMLDoc = isXML; -jQuery.contains = contains; - -return; - -window.Sizzle = Sizzle; - -})(); -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - slice = Array.prototype.slice; - -// Implement the identical functionality for filter and not -var winnow = function( elements, qualifier, keep ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return (elem === qualifier) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return (jQuery.inArray( elem, qualifier ) >= 0) === keep; - }); -}; - -jQuery.fn.extend({ - find: function( selector ) { - var ret = this.pushStack( "", "find", selector ), length = 0; - - for ( var i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( var n = length; n < ret.length; n++ ) { - for ( var r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && jQuery.filter( selector, this ).length > 0; - }, - - closest: function( selectors, context ) { - if ( jQuery.isArray( selectors ) ) { - var ret = [], cur = this[0], match, matches = {}, selector; - - if ( cur && selectors.length ) { - for ( var i = 0, l = selectors.length; i < l; i++ ) { - selector = selectors[i]; - - if ( !matches[selector] ) { - matches[selector] = jQuery.expr.match.POS.test( selector ) ? - jQuery( selector, context || this.context ) : - selector; - } - } - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( selector in matches ) { - match = matches[selector]; - - if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { - ret.push({ selector: selector, elem: cur }); - delete matches[selector]; - } - } - cur = cur.parentNode; - } - } - - return ret; - } - - var pos = jQuery.expr.match.POS.test( selectors ) ? - jQuery( selectors, context || this.context ) : null; - - return this.map(function( i, cur ) { - while ( cur && cur.ownerDocument && cur !== context ) { - if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) { - return cur; - } - cur = cur.parentNode; - } - return null; - }); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - if ( !elem || typeof elem === "string" ) { - return jQuery.inArray( this[0], - // If it receives a string, the selector is used - // If it receives nothing, the siblings are used - elem ? jQuery( elem ) : this.parent().children() ); - } - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context || this.context ) : - jQuery.makeArray( selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call(arguments).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], cur = elem[dir]; - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); -var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, - rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, - rtagName = /<([\w:]+)/, - rtbody = /"; - }, - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
        ", "
        " ], - thead: [ 1, "", "
        " ], - tr: [ 2, "", "
        " ], - td: [ 3, "", "
        " ], - col: [ 2, "", "
        " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }; - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and \ No newline at end of file diff --git a/book/bower_components/jquery/src/.jshintrc b/book/bower_components/jquery/src/.jshintrc deleted file mode 100644 index a157a55f..00000000 --- a/book/bower_components/jquery/src/.jshintrc +++ /dev/null @@ -1,27 +0,0 @@ -{ - "boss": true, - "curly": true, - "eqeqeq": true, - "eqnull": true, - "expr": true, - "immed": true, - "noarg": true, - "onevar": true, - "quotmark": "double", - "smarttabs": true, - "trailing": true, - "undef": true, - "unused": true, - - "evil": true, - "sub": true, - - "browser": true, - "wsh": true, - - "globals": { - "define": true, - "module": true, - "jQuery": true - } -} diff --git a/book/bower_components/jquery/src/ajax.js b/book/bower_components/jquery/src/ajax.js deleted file mode 100644 index 540a904b..00000000 --- a/book/bower_components/jquery/src/ajax.js +++ /dev/null @@ -1,855 +0,0 @@ -var - // Document location - ajaxLocParts, - ajaxLocation, - ajax_nonce = jQuery.now(), - - ajax_rquery = /\?/, - rhash = /#.*$/, - rts = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, - - // Keep a copy of the old load method - _load = jQuery.fn.load, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat("*"); - -// #8138, IE may throw an exception when accessing -// a field from window.location if document.domain has been set -try { - ajaxLocation = location.href; -} catch( e ) { - // Use the href attribute of an A element - // since IE will modify it given document.location - ajaxLocation = document.createElement( "a" ); - ajaxLocation.href = ""; - ajaxLocation = ajaxLocation.href; -} - -// Segment location into parts -ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || []; - - if ( jQuery.isFunction( func ) ) { - // For each dataType in the dataTypeExpression - while ( (dataType = dataTypes[i++]) ) { - // Prepend if requested - if ( dataType[0] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); - - // Otherwise append - } else { - (structure[ dataType ] = structure[ dataType ] || []).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - }); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var deep, key, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -jQuery.fn.load = function( url, params, callback ) { - if ( typeof url !== "string" && _load ) { - return _load.apply( this, arguments ); - } - - var selector, response, type, - self = this, - off = url.indexOf(" "); - - if ( off >= 0 ) { - selector = url.slice( off, url.length ); - url = url.slice( 0, off ); - } - - // If it's a function - if ( jQuery.isFunction( params ) ) { - - // We assume that it's the callback - callback = params; - params = undefined; - - // Otherwise, build a param string - } else if ( params && typeof params === "object" ) { - type = "POST"; - } - - // If we have elements to modify, make the request - if ( self.length > 0 ) { - jQuery.ajax({ - url: url, - - // if "type" variable is undefined, then "GET" method will be used - type: type, - dataType: "html", - data: params - }).done(function( responseText ) { - - // Save response for use in complete callback - response = arguments; - - self.html( selector ? - - // If a selector was specified, locate the right elements in a dummy div - // Exclude scripts to avoid IE 'Permission Denied' errors - jQuery("
        ").append( jQuery.parseHTML( responseText ) ).find( selector ) : - - // Otherwise use the full result - responseText ); - - }).complete( callback && function( jqXHR, status ) { - self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); - }); - } - - return this; -}; - -// Attach a bunch of functions for handling common AJAX events -jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){ - jQuery.fn[ type ] = function( fn ){ - return this.on( type, fn ); - }; -}); - -jQuery.extend({ - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: ajaxLocation, - type: "GET", - isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /xml/, - html: /html/, - json: /json/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": jQuery.parseJSON, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var // Cross-domain detection vars - parts, - // Loop variable - i, - // URL without anti-cache param - cacheURL, - // Response headers as string - responseHeadersString, - // timeout handle - timeoutTimer, - - // To know if global events are to be dispatched - fireGlobals, - - transport, - // Response headers - responseHeaders, - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - // Callbacks context - callbackContext = s.context || s, - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks("once memory"), - // Status-dependent callbacks - statusCode = s.statusCode || {}, - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - // The jqXHR state - state = 0, - // Default abort message - strAbort = "canceled", - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( state === 2 ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( (match = rheaders.exec( responseHeadersString )) ) { - responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; - } - } - match = responseHeaders[ key.toLowerCase() ]; - } - return match == null ? null : match; - }, - - // Raw string - getAllResponseHeaders: function() { - return state === 2 ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - var lname = name.toLowerCase(); - if ( !state ) { - name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( !state ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( state < 2 ) { - for ( code in map ) { - // Lazy-add the new callback in a way that preserves old ones - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } else { - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ).complete = completeDeferred.add; - jqXHR.success = jqXHR.done; - jqXHR.error = jqXHR.fail; - - // Remove hash character (#7531: and string promotion) - // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""]; - - // A cross-domain request is in order when we have a protocol:host:port mismatch - if ( s.crossDomain == null ) { - parts = rurl.exec( s.url.toLowerCase() ); - s.crossDomain = !!( parts && - ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || - ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== - ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) - ); - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( state === 2 ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - fireGlobals = s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger("ajaxStart"); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - cacheURL = s.url; - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // If data is available, append data to url - if ( s.data ) { - cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add anti-cache in url if needed - if ( s.cache === false ) { - s.url = rts.test( cacheURL ) ? - - // If there is already a '_' parameter, set its value - cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) : - - // Otherwise add one to the end - cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++; - } - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { - // Abort if not done already and return - return jqXHR.abort(); - } - - // aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - for ( i in { success: 1, error: 1, complete: 1 } ) { - jqXHR[ i ]( s[ i ] ); - } - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = setTimeout(function() { - jqXHR.abort("timeout"); - }, s.timeout ); - } - - try { - state = 1; - transport.send( requestHeaders, done ); - } catch ( e ) { - // Propagate exception as error if not done - if ( state < 2 ) { - done( -1, e ); - // Simply rethrow otherwise - } else { - throw e; - } - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Called once - if ( state === 2 ) { - return; - } - - // State is "done" now - state = 2; - - // Clear timeout if it exists - if ( timeoutTimer ) { - clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader("Last-Modified"); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader("etag"); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - // We extract error from statusText - // then normalize statusText and status for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger("ajaxStop"); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -}); - -jQuery.each( [ "get", "post" ], function( i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - // shift arguments if data argument was omitted - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - return jQuery.ajax({ - url: url, - type: method, - dataType: type, - data: data, - success: callback - }); - }; -}); - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - var firstDataType, ct, finalDataType, type, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s[ "throws" ] ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} diff --git a/book/bower_components/jquery/src/ajax/jsonp.js b/book/bower_components/jquery/src/ajax/jsonp.js deleted file mode 100644 index b8803df4..00000000 --- a/book/bower_components/jquery/src/ajax/jsonp.js +++ /dev/null @@ -1,80 +0,0 @@ -var oldCallbacks = [], - rjsonp = /(=)\?(?=&|$)|\?\?/; - -// Default jsonp settings -jQuery.ajaxSetup({ - jsonp: "callback", - jsonpCallback: function() { - var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) ); - this[ callback ] = true; - return callback; - } -}); - -// Detect, normalize options and install callbacks for jsonp requests -jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { - - var callbackName, overwritten, responseContainer, - jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? - "url" : - typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" - ); - - // Handle iff the expected data type is "jsonp" or we have a parameter to set - if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { - - // Get callback name, remembering preexisting value associated with it - callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? - s.jsonpCallback() : - s.jsonpCallback; - - // Insert callback into url or form data - if ( jsonProp ) { - s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); - } else if ( s.jsonp !== false ) { - s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; - } - - // Use data converter to retrieve json after script execution - s.converters["script json"] = function() { - if ( !responseContainer ) { - jQuery.error( callbackName + " was not called" ); - } - return responseContainer[ 0 ]; - }; - - // force json dataType - s.dataTypes[ 0 ] = "json"; - - // Install callback - overwritten = window[ callbackName ]; - window[ callbackName ] = function() { - responseContainer = arguments; - }; - - // Clean-up function (fires after converters) - jqXHR.always(function() { - // Restore preexisting value - window[ callbackName ] = overwritten; - - // Save back as free - if ( s[ callbackName ] ) { - // make sure that re-using the options doesn't screw things around - s.jsonpCallback = originalSettings.jsonpCallback; - - // save the callback name for future use - oldCallbacks.push( callbackName ); - } - - // Call if it was a function and we have a response - if ( responseContainer && jQuery.isFunction( overwritten ) ) { - overwritten( responseContainer[ 0 ] ); - } - - responseContainer = overwritten = undefined; - }); - - // Delegate to script - return "script"; - } -}); diff --git a/book/bower_components/jquery/src/ajax/script.js b/book/bower_components/jquery/src/ajax/script.js deleted file mode 100644 index ac14c44b..00000000 --- a/book/bower_components/jquery/src/ajax/script.js +++ /dev/null @@ -1,86 +0,0 @@ -// Install script dataType -jQuery.ajaxSetup({ - accepts: { - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /(?:java|ecma)script/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -}); - -// Handle cache's special case and global -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - s.global = false; - } -}); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function(s) { - - // This transport only deals with cross domain requests - if ( s.crossDomain ) { - - var script, - head = document.head || jQuery("head")[0] || document.documentElement; - - return { - - send: function( _, callback ) { - - script = document.createElement("script"); - - script.async = true; - - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } - - script.src = s.url; - - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function( _, isAbort ) { - - if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - - // Remove the script - if ( script.parentNode ) { - script.parentNode.removeChild( script ); - } - - // Dereference the script - script = null; - - // Callback if not abort - if ( !isAbort ) { - callback( 200, "success" ); - } - } - }; - - // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending - // Use native DOM manipulation to avoid our domManip AJAX trickery - head.insertBefore( script, head.firstChild ); - }, - - abort: function() { - if ( script ) { - script.onload( undefined, true ); - } - } - }; - } -}); diff --git a/book/bower_components/jquery/src/ajax/xhr.js b/book/bower_components/jquery/src/ajax/xhr.js deleted file mode 100644 index 3133dd43..00000000 --- a/book/bower_components/jquery/src/ajax/xhr.js +++ /dev/null @@ -1,207 +0,0 @@ -var xhrCallbacks, xhrSupported, - xhrId = 0, - // #5280: Internet Explorer will keep connections alive if we don't abort on unload - xhrOnUnloadAbort = window.ActiveXObject && function() { - // Abort all pending requests - var key; - for ( key in xhrCallbacks ) { - xhrCallbacks[ key ]( undefined, true ); - } - }; - -// Functions to create xhrs -function createStandardXHR() { - try { - return new window.XMLHttpRequest(); - } catch( e ) {} -} - -function createActiveXHR() { - try { - return new window.ActiveXObject("Microsoft.XMLHTTP"); - } catch( e ) {} -} - -// Create the request object -// (This is still attached to ajaxSettings for backward compatibility) -jQuery.ajaxSettings.xhr = window.ActiveXObject ? - /* Microsoft failed to properly - * implement the XMLHttpRequest in IE7 (can't request local files), - * so we use the ActiveXObject when it is available - * Additionally XMLHttpRequest can be disabled in IE7/IE8 so - * we need a fallback. - */ - function() { - return !this.isLocal && createStandardXHR() || createActiveXHR(); - } : - // For all other browsers, use the standard XMLHttpRequest object - createStandardXHR; - -// Determine support properties -xhrSupported = jQuery.ajaxSettings.xhr(); -jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -xhrSupported = jQuery.support.ajax = !!xhrSupported; - -// Create transport if the browser can provide an xhr -if ( xhrSupported ) { - - jQuery.ajaxTransport(function( s ) { - // Cross domain only allowed if supported through XMLHttpRequest - if ( !s.crossDomain || jQuery.support.cors ) { - - var callback; - - return { - send: function( headers, complete ) { - - // Get a new xhr - var handle, i, - xhr = s.xhr(); - - // Open the socket - // Passing null username, generates a login popup on Opera (#2865) - if ( s.username ) { - xhr.open( s.type, s.url, s.async, s.username, s.password ); - } else { - xhr.open( s.type, s.url, s.async ); - } - - // Apply custom fields if provided - if ( s.xhrFields ) { - for ( i in s.xhrFields ) { - xhr[ i ] = s.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( s.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( s.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !s.crossDomain && !headers["X-Requested-With"] ) { - headers["X-Requested-With"] = "XMLHttpRequest"; - } - - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - } catch( err ) {} - - // Do send the request - // This may raise an exception which is actually - // handled in jQuery.ajax (so no try/catch here) - xhr.send( ( s.hasContent && s.data ) || null ); - - // Listener - callback = function( _, isAbort ) { - var status, responseHeaders, statusText, responses; - - // Firefox throws exceptions when accessing properties - // of an xhr when a network error occurred - // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) - try { - - // Was never called and is aborted or complete - if ( callback && ( isAbort || xhr.readyState === 4 ) ) { - - // Only called once - callback = undefined; - - // Do not keep as active anymore - if ( handle ) { - xhr.onreadystatechange = jQuery.noop; - if ( xhrOnUnloadAbort ) { - delete xhrCallbacks[ handle ]; - } - } - - // If it's an abort - if ( isAbort ) { - // Abort it manually if needed - if ( xhr.readyState !== 4 ) { - xhr.abort(); - } - } else { - responses = {}; - status = xhr.status; - responseHeaders = xhr.getAllResponseHeaders(); - - // When requesting binary data, IE6-9 will throw an exception - // on any attempt to access responseText (#11426) - if ( typeof xhr.responseText === "string" ) { - responses.text = xhr.responseText; - } - - // Firefox throws an exception when accessing - // statusText for faulty cross-domain requests - try { - statusText = xhr.statusText; - } catch( e ) { - // We normalize with Webkit giving an empty statusText - statusText = ""; - } - - // Filter status for non standard behaviors - - // If the request is local and we have data: assume a success - // (success with no data won't get notified, that's the best we - // can do given current implementations) - if ( !status && s.isLocal && !s.crossDomain ) { - status = responses.text ? 200 : 404; - // IE - #1450: sometimes returns 1223 when it should be 204 - } else if ( status === 1223 ) { - status = 204; - } - } - } - } catch( firefoxAccessException ) { - if ( !isAbort ) { - complete( -1, firefoxAccessException ); - } - } - - // Call complete if needed - if ( responses ) { - complete( status, statusText, responses, responseHeaders ); - } - }; - - if ( !s.async ) { - // if we're in sync mode we fire the callback - callback(); - } else if ( xhr.readyState === 4 ) { - // (IE6 & IE7) if it's in cache and has been - // retrieved directly we need to fire the callback - setTimeout( callback ); - } else { - handle = ++xhrId; - if ( xhrOnUnloadAbort ) { - // Create the active xhrs callbacks list if needed - // and attach the unload handler - if ( !xhrCallbacks ) { - xhrCallbacks = {}; - jQuery( window ).unload( xhrOnUnloadAbort ); - } - // Add to list of active xhrs callbacks - xhrCallbacks[ handle ] = callback; - } - xhr.onreadystatechange = callback; - } - }, - - abort: function() { - if ( callback ) { - callback( undefined, true ); - } - } - }; - } - }); -} diff --git a/book/bower_components/jquery/src/attributes.js b/book/bower_components/jquery/src/attributes.js deleted file mode 100644 index ce2a4f80..00000000 --- a/book/bower_components/jquery/src/attributes.js +++ /dev/null @@ -1,659 +0,0 @@ -var nodeHook, boolHook, - rclass = /[\t\r\n\f]/g, - rreturn = /\r/g, - rfocusable = /^(?:input|select|textarea|button|object)$/i, - rclickable = /^(?:a|area)$/i, - ruseDefault = /^(?:checked|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - getSetInput = jQuery.support.input; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call( this, j, this.className ) ); - }); - } - - if ( proceed ) { - // The disjunction here is for better compressibility (see removeClass) - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - " " - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - elem.className = jQuery.trim( cur ); - - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = arguments.length === 0 || typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call( this, j, this.className ) ); - }); - } - if ( proceed ) { - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - "" - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - elem.className = value ? jQuery.trim( cur ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value; - - if ( typeof stateVal === "boolean" && type === "string" ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - classNames = value.match( core_rnotwhite ) || []; - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( type === core_strundefined || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // If the element has a class name or if we're passed "false", - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var ret, hooks, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // Use proper attribute retrieval(#6932, #12072) - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // oldIE doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) { - optionSet = true; - } - } - - // force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attr: function( elem, name, value ) { - var hooks, ret, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === core_strundefined ) { - return jQuery.prop( elem, name, value ); - } - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - - } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var name, propName, - i = 0, - attrNames = value && value.match( core_rnotwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( (name = attrNames[i++]) ) { - propName = jQuery.propFix[ name ] || name; - - // Boolean attributes get special treatment (#10870) - if ( jQuery.expr.match.bool.test( name ) ) { - // Set corresponding property to false - if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - elem[ propName ] = false; - // Support: IE<9 - // Also clear defaultChecked/defaultSelected (if appropriate) - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = - elem[ propName ] = false; - } - - // See #9699 for explanation of this approach (setting first, then removal) - } else { - jQuery.attr( elem, name, "" ); - } - - elem.removeAttribute( getSetAttribute ? name : propName ); - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to default in case type is set after value during creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? - ret : - ( elem[ name ] = value ); - - } else { - return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? - ret : - elem[ name ]; - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - return tabindex ? - parseInt( tabindex, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - -1; - } - } - } -}); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - // IE<8 needs the *property* name - elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); - - // Use defaultChecked and defaultSelected for oldIE - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; - } - - return name; - } -}; -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { - var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; - - jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? - function( elem, name, isXML ) { - var fn = jQuery.expr.attrHandle[ name ], - ret = isXML ? - undefined : - /* jshint eqeqeq: false */ - (jQuery.expr.attrHandle[ name ] = undefined) != - getter( elem, name, isXML ) ? - - name.toLowerCase() : - null; - jQuery.expr.attrHandle[ name ] = fn; - return ret; - } : - function( elem, name, isXML ) { - return isXML ? - undefined : - elem[ jQuery.camelCase( "default-" + name ) ] ? - name.toLowerCase() : - null; - }; -}); - -// fix oldIE attroperties -if ( !getSetInput || !getSetAttribute ) { - jQuery.attrHooks.value = { - set: function( elem, value, name ) { - if ( jQuery.nodeName( elem, "input" ) ) { - // Does not return so that setAttribute is also used - elem.defaultValue = value; - } else { - // Use nodeHook if defined (#1954); otherwise setAttribute is fine - return nodeHook && nodeHook.set( elem, value, name ); - } - } - }; -} - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = { - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - elem.setAttributeNode( - (ret = elem.ownerDocument.createAttribute( name )) - ); - } - - ret.value = value += ""; - - // Break association with cloned elements by also using setAttribute (#9646) - return name === "value" || value === elem.getAttribute( name ) ? - value : - undefined; - } - }; - jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords = - // Some attributes are constructed with empty-string values when not defined - function( elem, name, isXML ) { - var ret; - return isXML ? - undefined : - (ret = elem.getAttributeNode( name )) && ret.value !== "" ? - ret.value : - null; - }; - jQuery.valHooks.button = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return ret && ret.specified ? - ret.value : - undefined; - }, - set: nodeHook.set - }; - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - set: function( elem, value, name ) { - nodeHook.set( elem, value === "" ? false : value, name ); - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }; - }); -} - - -// Some attributes require a special call on IE -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !jQuery.support.hrefNormalized ) { - // href/src property should get the full normalized URL (#10299/#12915) - jQuery.each([ "href", "src" ], function( i, name ) { - jQuery.propHooks[ name ] = { - get: function( elem ) { - return elem.getAttribute( name, 4 ); - } - }; - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Note: IE uppercases css property names, but if we were to .toLowerCase() - // .cssText, that would destroy case senstitivity in URL's, like in "background" - return elem.style.cssText || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }; -} - -jQuery.each([ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -}); - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }; - if ( !jQuery.support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - // Support: Webkit - // "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - }; - } -}); diff --git a/book/bower_components/jquery/src/callbacks.js b/book/bower_components/jquery/src/callbacks.js deleted file mode 100644 index f3a643bd..00000000 --- a/book/bower_components/jquery/src/callbacks.js +++ /dev/null @@ -1,197 +0,0 @@ -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - firingLength = 0; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( list && ( !fired || stack ) ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; diff --git a/book/bower_components/jquery/src/core.js b/book/bower_components/jquery/src/core.js deleted file mode 100644 index 209fbc86..00000000 --- a/book/bower_components/jquery/src/core.js +++ /dev/null @@ -1,981 +0,0 @@ -var - // The deferred used on DOM ready - readyList, - - // A central reference to the root jQuery(document) - rootjQuery, - - // Support: IE<10 - // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined` - core_strundefined = typeof undefined, - - // Use the correct document accordingly with window argument (sandbox) - location = window.location, - document = window.document, - docElem = document.documentElement, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // [[Class]] -> type pairs - class2type = {}, - - // List of deleted data cache ids, so we can reuse them - core_deletedIds = [], - - core_version = "@VERSION", - - // Save a reference to some core methods - core_concat = core_deletedIds.concat, - core_push = core_deletedIds.push, - core_slice = core_deletedIds.slice, - core_indexOf = core_deletedIds.indexOf, - core_toString = class2type.toString, - core_hasOwn = class2type.hasOwnProperty, - core_trim = core_version.trim, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, - - // Used for splitting on whitespace - core_rnotwhite = /\S+/g, - - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // The ready event handler - completed = function( event ) { - - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } - }, - // Clean-up method for dom ready events - detach = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: core_version, - - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - /* jshint eqeqeq: false */ - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; - }, - - isPlainObject: function( obj ) { - var key; - - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Support: IE<9 - // Handle iteration over inherited properties before own properties. - if ( jQuery.support.ownLast ) { - for ( key in obj ) { - return core_hasOwn.call( obj, key ); - } - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - if ( scripts ) { - jQuery( scripts ).remove(); - } - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: function( data ) { - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - if ( data === null ) { - return data; - } - - if ( typeof data === "string" ) { - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - if ( data ) { - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - } - } - } - - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - core_push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return core_concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations. - // Note: this method belongs to the css module but it's needed here for the support module. - // If support gets modularized, this method should be moved back to the css module. - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); - - if ( jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); diff --git a/book/bower_components/jquery/src/css.js b/book/bower_components/jquery/src/css.js deleted file mode 100644 index 2e8c22e7..00000000 --- a/book/bower_components/jquery/src/css.js +++ /dev/null @@ -1,661 +0,0 @@ -var iframe, getStyles, curCSS, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity\s*=\s*([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -function showHide( elements, show ) { - var display, elem, hidden, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - values[ index ] = jQuery._data( elem, "olddisplay" ); - display = elem.style.display; - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); - } - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - var len, styles, - map = {}, - i = 0; - - if ( jQuery.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each(function() { - if ( isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var num, val, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - } -}); - -// NOTE: we've included the "window" in window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - getStyles = function( elem ) { - return window.getComputedStyle( elem, null ); - }; - - curCSS = function( elem, name, _computed ) { - var width, minWidth, maxWidth, - computed = _computed || getStyles( elem ), - - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, - style = elem.style; - - if ( computed ) { - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; - }; -} else if ( document.documentElement.currentStyle ) { - getStyles = function( elem ) { - return elem.currentStyle; - }; - - curCSS = function( elem, name, _computed ) { - var left, rs, rsLeft, - computed = _computed || getStyles( elem ), - ret = computed ? computed[ name ] : undefined, - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - - // Remember the original values - left = style.left; - rs = elem.runtimeStyle; - rsLeft = rs && rs.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - rs.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - rs.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); - } - - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } else { - // at this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - styles = getStyles( elem ), - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, styles ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles - ) - ) + "px"; -} - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - // Use the already-created iframe if possible - iframe = ( iframe || - jQuery(" - - - -
          - -
          - -
          - - - - - - - - - - - - - - - -
          -
          Term
          This is the first definition in compact format.
          -
          Term
          This is the second definition in compact format.
          -
          - - - - Scrolling text (non-standard) - - diff --git a/book/bower_components/jquery/test/data/selector/sizzle_cache.html b/book/bower_components/jquery/test/data/selector/sizzle_cache.html deleted file mode 100644 index 1055c75a..00000000 --- a/book/bower_components/jquery/test/data/selector/sizzle_cache.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - jQuery selector - sizzle cache - - - - - - - - - diff --git a/book/bower_components/jquery/test/data/statusText.php b/book/bower_components/jquery/test/data/statusText.php deleted file mode 100644 index daf58ce3..00000000 --- a/book/bower_components/jquery/test/data/statusText.php +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/book/bower_components/jquery/test/data/support/bodyBackground.html b/book/bower_components/jquery/test/data/support/bodyBackground.html deleted file mode 100644 index 8991007c..00000000 --- a/book/bower_components/jquery/test/data/support/bodyBackground.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - -
          - -
          - - - diff --git a/book/bower_components/jquery/test/data/support/boxSizing.html b/book/bower_components/jquery/test/data/support/boxSizing.html deleted file mode 100644 index 63c4c90b..00000000 --- a/book/bower_components/jquery/test/data/support/boxSizing.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - diff --git a/book/bower_components/jquery/test/data/support/csp.js b/book/bower_components/jquery/test/data/support/csp.js deleted file mode 100644 index 8bce34fd..00000000 --- a/book/bower_components/jquery/test/data/support/csp.js +++ /dev/null @@ -1,3 +0,0 @@ -jQuery(function() { - parent.iframeCallback( jQuery.support ); -}); diff --git a/book/bower_components/jquery/test/data/support/csp.php b/book/bower_components/jquery/test/data/support/csp.php deleted file mode 100644 index f72aa076..00000000 --- a/book/bower_components/jquery/test/data/support/csp.php +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - CSP Test Page - - - - -

          CSP Test Page

          - - diff --git a/book/bower_components/jquery/test/data/support/shrinkWrapBlocks.html b/book/bower_components/jquery/test/data/support/shrinkWrapBlocks.html deleted file mode 100644 index a2097cb2..00000000 --- a/book/bower_components/jquery/test/data/support/shrinkWrapBlocks.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - -
          - -
          - - - diff --git a/book/bower_components/jquery/test/data/support/testElementCrash.html b/book/bower_components/jquery/test/data/support/testElementCrash.html deleted file mode 100644 index 16de48ce..00000000 --- a/book/bower_components/jquery/test/data/support/testElementCrash.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - diff --git a/book/bower_components/jquery/test/data/test.html b/book/bower_components/jquery/test/data/test.html deleted file mode 100644 index eec028e9..00000000 --- a/book/bower_components/jquery/test/data/test.html +++ /dev/null @@ -1,7 +0,0 @@ -html text
          - - -blabla diff --git a/book/bower_components/jquery/test/data/test.js b/book/bower_components/jquery/test/data/test.js deleted file mode 100644 index fb339529..00000000 --- a/book/bower_components/jquery/test/data/test.js +++ /dev/null @@ -1,3 +0,0 @@ -this.testBar = "bar"; -jQuery("#ap").html("bar"); -ok( true, "test.js executed"); diff --git a/book/bower_components/jquery/test/data/test.php b/book/bower_components/jquery/test/data/test.php deleted file mode 100644 index 3d08f325..00000000 --- a/book/bower_components/jquery/test/data/test.php +++ /dev/null @@ -1,7 +0,0 @@ -html text
          - - -blabla \ No newline at end of file diff --git a/book/bower_components/jquery/test/data/test2.html b/book/bower_components/jquery/test/data/test2.html deleted file mode 100644 index 1df6151a..00000000 --- a/book/bower_components/jquery/test/data/test2.html +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/book/bower_components/jquery/test/data/test3.html b/book/bower_components/jquery/test/data/test3.html deleted file mode 100644 index 909d4174..00000000 --- a/book/bower_components/jquery/test/data/test3.html +++ /dev/null @@ -1,3 +0,0 @@ -
          This is a user
          -
          This is a user
          -
          This is a teacher
          diff --git a/book/bower_components/jquery/test/data/testinit.js b/book/bower_components/jquery/test/data/testinit.js deleted file mode 100644 index 0351f026..00000000 --- a/book/bower_components/jquery/test/data/testinit.js +++ /dev/null @@ -1,264 +0,0 @@ -/*jshint multistr:true, quotmark:false */ - -var amdDefined, fireNative, - originaljQuery = this.jQuery || "jQuery", - original$ = this.$ || "$", - // see RFC 2606 - externalHost = "example.com"; - -this.hasPHP = true; -this.isLocal = window.location.protocol === "file:"; - -// For testing .noConflict() -this.jQuery = originaljQuery; -this.$ = original$; - -/** - * Set up a mock AMD define function for testing AMD registration. - */ -function define( name, dependencies, callback ) { - amdDefined = callback(); -} - -define.amd = {}; - -/** - * Returns an array of elements with the given IDs - * @example q("main", "foo", "bar") - * @result [
          , , ] - */ -this.q = function() { - var r = [], - i = 0; - - for ( ; i < arguments.length; i++ ) { - r.push( document.getElementById( arguments[i] ) ); - } - return r; -}; - -/** - * Asserts that a select matches the given IDs - * @param {String} a - Assertion name - * @param {String} b - Sizzle selector - * @param {String} c - Array of ids to construct what is expected - * @example t("Check for something", "//[a]", ["foo", "baar"]); - * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar' - */ -this.t = function( a, b, c ) { - var f = jQuery(b).get(), - s = "", - i = 0; - - for ( ; i < f.length; i++ ) { - s += ( s && "," ) + '"' + f[ i ].id + '"'; - } - - deepEqual(f, q.apply( q, c ), a + " (" + b + ")"); -}; - -this.createDashboardXML = function() { - var string = ' \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - '; - - return jQuery.parseXML(string); -}; - -this.createWithFriesXML = function() { - var string = ' \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - 1 \ - \ - \ - \ - \ - foo \ - \ - \ - \ - \ - \ - \ - '; - - return jQuery.parseXML( string.replace( /\{\{\s*externalHost\s*\}\}/g, externalHost ) ); -}; - -this.createXMLFragment = function() { - var xml, frag; - if ( window.ActiveXObject ) { - xml = new ActiveXObject("msxml2.domdocument"); - } else { - xml = document.implementation.createDocument( "", "", null ); - } - - if ( xml ) { - frag = xml.createElement("data"); - } - - return frag; -}; - -fireNative = document.createEvent ? - function( node, type ) { - var event = document.createEvent('HTMLEvents'); - event.initEvent( type, true, true ); - node.dispatchEvent( event ); - } : - function( node, type ) { - var event = document.createEventObject(); - node.fireEvent( 'on' + type, event ); - }; - -/** - * Add random number to url to stop caching - * - * @example url("data/test.html") - * @result "data/test.html?10538358428943" - * - * @example url("data/test.php?foo=bar") - * @result "data/test.php?foo=bar&10538358345554" - */ -function url( value ) { - return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random() * 100000, 10); -} - -// Ajax testing helper -this.ajaxTest = function( title, expect, options ) { - var requestOptions; - if ( jQuery.isFunction( options ) ) { - options = options(); - } - options = options || []; - requestOptions = options.requests || options.request || options; - if ( !jQuery.isArray( requestOptions ) ) { - requestOptions = [ requestOptions ]; - } - asyncTest( title, expect, function() { - if ( options.setup ) { - options.setup(); - } - - var completed = false, - remaining = requestOptions.length, - complete = function() { - if ( !completed && --remaining === 0 ) { - completed = true; - delete ajaxTest.abort; - if ( options.teardown ) { - options.teardown(); - } - start(); - } - }, - requests = jQuery.map( requestOptions, function( options ) { - var request = ( options.create || jQuery.ajax )( options ), - callIfDefined = function( deferType, optionType ) { - var handler = options[ deferType ] || !!options[ optionType ]; - return function( _, status ) { - if ( !completed ) { - if ( !handler ) { - ok( false, "unexpected " + status ); - } else if ( jQuery.isFunction( handler ) ) { - handler.apply( this, arguments ); - } - } - }; - }; - - if ( options.afterSend ) { - options.afterSend( request ); - } - - return request - .done( callIfDefined( "done", "success" ) ) - .fail( callIfDefined( "fail", "error" ) ) - .always( complete ); - }); - - ajaxTest.abort = function( reason ) { - if ( !completed ) { - completed = true; - delete ajaxTest.abort; - ok( false, "aborted " + reason ); - jQuery.each( requests, function( i, request ) { - request.abort(); - }); - } - }; - }); -}; - - -this.testIframe = function( fileName, name, fn ) { - - test(name, function() { - // pause execution for now - stop(); - - // load fixture in iframe - var iframe = loadFixture(), - win = iframe.contentWindow, - interval = setInterval( function() { - if ( win && win.jQuery && win.jQuery.isReady ) { - clearInterval( interval ); - // continue - start(); - // call actual tests passing the correct jQuery instance to use - fn.call( this, win.jQuery, win, win.document ); - document.body.removeChild( iframe ); - iframe = null; - } - }, 15 ); - }); - - function loadFixture() { - var src = url("./data/" + fileName + ".html"), - iframe = jQuery(" -
          -
          -

          See this blog entry for more information.

          -

          - Here are some links in a normal paragraph: Google, - Google Groups (Link). - This link has class="blog": - diveintomark - -

          -
          -

          Everything inside the red border is inside a div with id="foo".

          -

          This is a normal link: Yahoo

          -

          This link has class="blog": Simon Willison's Weblog

          - -
          -
          -
          -
          - -

          Try them out:

          -
            -
              -
              - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - test element -
              - Float test. - -
              - - -
              -
              - -
              - - - - -
              - -
              - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
              -
              -
              - -
              -
              hi there
              -
              -
              -
              -
              -
              -
              -
              -
              - -
              -
                -
              1. Rice
              2. -
              3. Beans
              4. -
              5. Blinis
              6. -
              7. Tofu
              8. -
              - -
              I'm hungry. I should...
              - ...Eat lots of food... | - ...Eat a little food... | - ...Eat no food... - ...Eat a burger... - ...Eat some funyuns... - ...Eat some funyuns... - - - - - - -
              - -
              - - -
              - -
              - 1 - 2 - - - - - - - - -
              -
              -
              -
              fadeIn
              fadeIn
              -
              fadeOut
              fadeOut
              - -
              show
              show
              -
              hide
              hide
              -
              hide
              hide
              - -
              togglein
              togglein
              -
              toggleout
              toggleout
              -
              toggleout
              toggleout
              - -
              slideUp
              slideUp
              -
              slideDown
              slideDown
              -
              slideUp
              slideUp
              - -
              slideToggleIn
              slideToggleIn
              -
              slideToggleOut
              slideToggleOut
              - -
              fadeToggleIn
              fadeToggleIn
              -
              fadeToggleOut
              fadeToggleOut
              - -
              fadeTo
              fadeTo
              -
              - -
              - -
              -
              -
              - - - - - - diff --git a/book/bower_components/jquery/test/jquery.js b/book/bower_components/jquery/test/jquery.js deleted file mode 100644 index 93d1095c..00000000 --- a/book/bower_components/jquery/test/jquery.js +++ /dev/null @@ -1,5 +0,0 @@ -// Use the right jQuery source in iframe tests -document.write( " - - - -

              jQuery Local File Test

              -

              - Introduction -

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

              - Results -

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

              - Logs: -

              -
                -
              - - diff --git a/book/bower_components/jquery/test/networkerror.html b/book/bower_components/jquery/test/networkerror.html deleted file mode 100644 index edbaabab..00000000 --- a/book/bower_components/jquery/test/networkerror.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - jQuery Network Error Test for Firefox - - - - - - -

              - jQuery Network Error Test for Firefox -

              -
              - This is a test page for - - #8135 - - which was reported in Firefox when accessing properties - of an XMLHttpRequest object after a network error occurred. -
              -
              Take the following steps:
              -
                -
              1. - make sure you accessed this page through a web server, -
              2. -
              3. - stop the web server, -
              4. -
              5. - open the console, -
              6. -
              7. - click this - - , -
              8. -
              9. - wait for both requests to fail. -
              10. -
              -
              - Test passes if you get two log lines: -
                -
              • - the first starting with "abort", -
              • -
              • - the second starting with "complete", -
              • -
              -
              -
              - Test fails if the browser notifies an exception. -
              - - diff --git a/book/bower_components/jquery/test/readywait.html b/book/bower_components/jquery/test/readywait.html deleted file mode 100644 index 7a736bef..00000000 --- a/book/bower_components/jquery/test/readywait.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - jQuery.holdReady Test - - - - - - - - - - -

              - jQuery.holdReady Test -

              -

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

              -

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

              -

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

              -

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

              -

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

              -
              - - diff --git a/book/bower_components/jquery/test/unit/ajax.js b/book/bower_components/jquery/test/unit/ajax.js deleted file mode 100644 index 21ecdd2f..00000000 --- a/book/bower_components/jquery/test/unit/ajax.js +++ /dev/null @@ -1,2016 +0,0 @@ -module( "ajax", { - setup: function() { - var jsonpCallback = this.jsonpCallback = jQuery.ajaxSettings.jsonpCallback; - jQuery.ajaxSettings.jsonpCallback = function() { - var callback = jsonpCallback.apply( this, arguments ); - Globals.register( callback ); - return callback; - }; - }, - teardown: function() { - jQuery( document ).off( "ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError ajaxSuccess" ); - moduleTeardown.apply( this, arguments ); - } -}); - -(function() { - - if ( !jQuery.ajax || ( isLocal && !hasPHP ) ) { - return; - } - - function addGlobalEvents( expected ) { - return function() { - expected = expected || ""; - jQuery( document ).on( "ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError ajaxSuccess", function( e ) { - ok( expected.indexOf(e.type) !== -1, e.type ); - }); - }; - } - -//----------- jQuery.ajax() - - ajaxTest( "jQuery.ajax() - success callbacks", 8, { - setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"), - url: url("data/name.html"), - beforeSend: function() { - ok( true, "beforeSend" ); - }, - success: function() { - ok( true, "success" ); - }, - complete: function() { - ok( true, "complete"); - } - }); - - ajaxTest( "jQuery.ajax() - success callbacks - (url, options) syntax", 8, { - setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"), - create: function( options ) { - return jQuery.ajax( url("data/name.html"), options ); - }, - beforeSend: function() { - ok( true, "beforeSend" ); - }, - success: function() { - ok( true, "success" ); - }, - complete: function() { - ok( true, "complete" ); - } - }); - - ajaxTest( "jQuery.ajax() - success callbacks (late binding)", 8, { - setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"), - url: url("data/name.html"), - beforeSend: function() { - ok( true, "beforeSend" ); - }, - success: true, - afterSend: function( request ) { - request.complete(function() { - ok( true, "complete" ); - }).success(function() { - ok( true, "success" ); - }).error(function() { - ok( false, "error" ); - }); - } - }); - - ajaxTest( "jQuery.ajax() - success callbacks (oncomplete binding)", 8, { - setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess"), - url: url("data/name.html"), - beforeSend: function() { - ok( true, "beforeSend" ); - }, - success: true, - complete: function( xhr ) { - xhr.complete(function() { - ok( true, "complete" ); - }).success(function() { - ok( true, "success" ); - }).error(function() { - ok( false, "error" ); - }); - } - }); - - ajaxTest( "jQuery.ajax() - error callbacks", 8, { - setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError"), - url: url("data/name.php?wait=5"), - beforeSend: function() { - ok( true, "beforeSend" ); - }, - afterSend: function( request ) { - request.abort(); - }, - error: function() { - ok( true, "error" ); - }, - complete: function() { - ok( true, "complete" ); - } - }); - - ajaxTest( "jQuery.ajax() - textStatus and errorThrown values", 4, [ - { - url: url("data/name.php?wait=5"), - error: function( _, textStatus, errorThrown ) { - strictEqual( textStatus, "abort", "textStatus is 'abort' for abort" ); - strictEqual( errorThrown, "abort", "errorThrown is 'abort' for abort" ); - }, - afterSend: function( request ) { - request.abort(); - } - }, - { - url: url("data/name.php?wait=5"), - error: function( _, textStatus, errorThrown ) { - strictEqual( textStatus, "mystatus", "textStatus is 'mystatus' for abort('mystatus')" ); - strictEqual( errorThrown, "mystatus", "errorThrown is 'mystatus' for abort('mystatus')" ); - }, - afterSend: function( request ) { - request.abort("mystatus"); - } - } - ]); - - ajaxTest( "jQuery.ajax() - responseText on error", 1, { - url: url("data/errorWithText.php"), - error: function( xhr ) { - strictEqual( xhr.responseText, "plain text message", "Test jqXHR.responseText is filled for HTTP errors" ); - } - }); - - asyncTest( "jQuery.ajax() - retry with jQuery.ajax( this )", 2, function() { - var previousUrl, - firstTime = true; - jQuery.ajax({ - url: url("data/errorWithText.php"), - error: function() { - if ( firstTime ) { - firstTime = false; - jQuery.ajax( this ); - } else { - ok ( true, "Test retrying with jQuery.ajax(this) works" ); - jQuery.ajax({ - url: url("data/errorWithText.php"), - data: { - "x": 1 - }, - beforeSend: function() { - if ( !previousUrl ) { - previousUrl = this.url; - } else { - strictEqual( this.url, previousUrl, "url parameters are not re-appended" ); - start(); - return false; - } - }, - error: function() { - jQuery.ajax( this ); - } - }); - } - } - }); - }); - - ajaxTest( "jQuery.ajax() - headers", 4, { - setup: function() { - jQuery( document ).ajaxSend(function( evt, xhr ) { - xhr.setRequestHeader( "ajax-send", "test" ); - }); - }, - url: url("data/headers.php?keys=siMPle_SometHing-elsE_OthEr_ajax-send"), - headers: { - "siMPle": "value", - "SometHing-elsE": "other value", - "OthEr": "something else" - }, - success: function( data, _, xhr ) { - var i, emptyHeader, - requestHeaders = jQuery.extend( this.headers, { - "ajax-send": "test" - }), - tmp = []; - for ( i in requestHeaders ) { - tmp.push( i, ": ", requestHeaders[ i ], "\n" ); - } - tmp = tmp.join(""); - - strictEqual( data, tmp, "Headers were sent" ); - strictEqual( xhr.getResponseHeader("Sample-Header"), "Hello World", "Sample header received" ); - - emptyHeader = xhr.getResponseHeader("Empty-Header"); - if ( emptyHeader === null ) { - ok( true, "Firefox doesn't support empty headers" ); - } else { - strictEqual( emptyHeader, "", "Empty header received" ); - } - strictEqual( xhr.getResponseHeader("Sample-Header2"), "Hello World 2", "Second sample header received" ); - } - }); - - ajaxTest( "jQuery.ajax() - Accept header", 1, { - url: url("data/headers.php?keys=accept"), - headers: { - Accept: "very wrong accept value" - }, - beforeSend: function( xhr ) { - xhr.setRequestHeader("Accept", "*/*"); - }, - success: function( data ) { - strictEqual( data, "accept: */*\n", "Test Accept header is set to last value provided" ); - } - }); - - ajaxTest( "jQuery.ajax() - contentType", 2, [ - { - url: url("data/headers.php?keys=content-type"), - contentType: "test", - success: function( data ) { - strictEqual( data, "content-type: test\n", "Test content-type is sent when options.contentType is set" ); - } - }, - { - url: url("data/headers.php?keys=content-type"), - contentType: false, - success: function( data ) { - strictEqual( data, "content-type: \n", "Test content-type is not sent when options.contentType===false" ); - } - } - ]); - - ajaxTest( "jQuery.ajax() - protocol-less urls", 1, { - url: "//somedomain.com", - beforeSend: function( xhr, settings ) { - equal( settings.url, location.protocol + "//somedomain.com", "Make sure that the protocol is added." ); - return false; - }, - error: true - }); - - ajaxTest( "jQuery.ajax() - hash", 3, [ - { - url: "data/name.html#foo", - beforeSend: function( xhr, settings ) { - equal( settings.url, "data/name.html", "Make sure that the URL is trimmed." ); - return false; - }, - error: true - }, - { - url: "data/name.html?abc#foo", - beforeSend: function( xhr, settings ) { - equal( settings.url, "data/name.html?abc", "Make sure that the URL is trimmed." ); - return false; - }, - error: true - }, - { - url: "data/name.html?abc#foo", - data: { - "test": 123 - }, - beforeSend: function( xhr, settings ) { - equal( settings.url, "data/name.html?abc&test=123", "Make sure that the URL is trimmed." ); - return false; - }, - error: true - } - ]); - - ajaxTest( "jQuery.ajax() - cross-domain detection", 7, function() { - function request( url, title, crossDomainOrOptions ) { - return jQuery.extend( { - dataType: "jsonp", - url: url, - beforeSend: function( _, s ) { - ok( crossDomainOrOptions === false ? !s.crossDomain : s.crossDomain, title ); - return false; - }, - error: true - }, crossDomainOrOptions ); - } - - var loc = document.location, - samePort = loc.port || ( loc.protocol === "http:" ? 80 : 443 ), - otherPort = loc.port === 666 ? 667 : 666, - otherProtocol = loc.protocol === "http:" ? "https:" : "http:"; - - return [ - request( - loc.protocol + "//" + loc.host + ":" + samePort, - "Test matching ports are not detected as cross-domain", - false - ), - request( - otherProtocol + "//" + loc.host, - "Test different protocols are detected as cross-domain" - ), - request( - "app:/path", - "Adobe AIR app:/ URL detected as cross-domain" - ), - request( - loc.protocol + "//example.invalid:" + ( loc.port || 80 ), - "Test different hostnames are detected as cross-domain" - ), - request( - loc.protocol + "//" + loc.hostname + ":" + otherPort, - "Test different ports are detected as cross-domain" - ), - request( - "about:blank", - "Test about:blank is detected as cross-domain" - ), - request( - loc.protocol + "//" + loc.host, - "Test forced crossDomain is detected as cross-domain", - { - crossDomain: true - } - ) - ]; - }); - - ajaxTest( "jQuery.ajax() - abort", 9, { - setup: addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxError ajaxComplete"), - url: url("data/name.php?wait=5"), - beforeSend: function() { - ok( true, "beforeSend" ); - }, - afterSend: function( xhr ) { - strictEqual( xhr.readyState, 1, "XHR readyState indicates successful dispatch" ); - xhr.abort(); - strictEqual( xhr.readyState, 0, "XHR readyState indicates successful abortion" ); - }, - error: true, - complete: function() { - ok( true, "complete" ); - } - }); - - ajaxTest( "jQuery.ajax() - events with context", 12, function() { - - var context = document.createElement("div"); - - function event( e ) { - equal( this, context, e.type ); - } - - function callback( msg ) { - return function() { - equal( this, context, "context is preserved on callback " + msg ); - }; - } - - return { - setup: function() { - jQuery( context ).appendTo("#foo") - .ajaxSend( event ) - .ajaxComplete( event ) - .ajaxError( event ) - .ajaxSuccess( event ); - }, - requests: [{ - url: url("data/name.html"), - context: context, - beforeSend: callback("beforeSend"), - success: callback("success"), - complete: callback("complete") - }, { - url: url("data/404.html"), - context: context, - beforeSend: callback("beforeSend"), - error: callback("error"), - complete: callback("complete") - }] - }; - }); - - ajaxTest( "jQuery.ajax() - events without context", 3, function() { - function nocallback( msg ) { - return function() { - equal( typeof this.url, "string", "context is settings on callback " + msg ); - }; - } - return { - url: url("data/404.html"), - beforeSend: nocallback("beforeSend"), - error: nocallback("error"), - complete: nocallback("complete") - }; - }); - - ajaxTest( "jQuery.ajax() - context modification", 1, { - url: url("data/name.html"), - context: {}, - beforeSend: function() { - this.test = "foo"; - }, - afterSend: function() { - strictEqual( this.context.test, "foo", "Make sure the original object is maintained." ); - }, - success: true - }); - - ajaxTest( "jQuery.ajax() - context modification through ajaxSetup", 3, function() { - var obj = {}; - return { - setup: function() { - jQuery.ajaxSetup({ - context: obj - }); - strictEqual( jQuery.ajaxSettings.context, obj, "Make sure the context is properly set in ajaxSettings." ); - }, - requests: [{ - url: url("data/name.html"), - success: function() { - strictEqual( this, obj, "Make sure the original object is maintained." ); - } - }, { - url: url("data/name.html"), - context: {}, - success: function() { - ok( this !== obj, "Make sure overriding context is possible." ); - } - }] - }; - }); - - ajaxTest( "jQuery.ajax() - disabled globals", 3, { - setup: addGlobalEvents(""), - global: false, - url: url("data/name.html"), - beforeSend: function() { - ok( true, "beforeSend" ); - }, - success: function() { - ok( true, "success" ); - }, - complete: function() { - ok( true, "complete" ); - } - }); - - ajaxTest( "jQuery.ajax() - xml: non-namespace elements inside namespaced elements", 3, { - url: url("data/with_fries.xml"), - dataType: "xml", - success: function( resp ) { - equal( jQuery( "properties", resp ).length, 1, "properties in responseXML" ); - equal( jQuery( "jsconf", resp ).length, 1, "jsconf in responseXML" ); - equal( jQuery( "thing", resp ).length, 2, "things in responseXML" ); - } - }); - - ajaxTest( "jQuery.ajax() - xml: non-namespace elements inside namespaced elements (over JSONP)", 3, { - url: url("data/with_fries_over_jsonp.php"), - dataType: "jsonp xml", - success: function( resp ) { - equal( jQuery( "properties", resp ).length, 1, "properties in responseXML" ); - equal( jQuery( "jsconf", resp ).length, 1, "jsconf in responseXML" ); - equal( jQuery( "thing", resp ).length, 2, "things in responseXML" ); - } - }); - - ajaxTest( "jQuery.ajax() - HEAD requests", 2, [ - { - url: url("data/name.html"), - type: "HEAD", - success: function( data, status, xhr ) { - ok( /Date/i.test( xhr.getAllResponseHeaders() ), "No Date in HEAD response" ); - } - }, - { - url: url("data/name.html"), - data: { - "whip_it": "good" - }, - type: "HEAD", - success: function( data, status, xhr ) { - ok( /Date/i.test( xhr.getAllResponseHeaders() ), "No Date in HEAD response with data" ); - } - } - ]); - - ajaxTest( "jQuery.ajax() - beforeSend", 1, { - url: url("data/name.html"), - beforeSend: function() { - this.check = true; - }, - success: function() { - ok( this.check, "check beforeSend was executed" ); - } - }); - - ajaxTest( "jQuery.ajax() - beforeSend, cancel request manually", 2, { - create: function() { - return jQuery.ajax({ - url: url("data/name.html"), - beforeSend: function( xhr ) { - ok( true, "beforeSend got called, canceling" ); - xhr.abort(); - }, - success: function() { - ok( false, "request didn't get canceled" ); - }, - complete: function() { - ok( false, "request didn't get canceled" ); - }, - error: function() { - ok( false, "request didn't get canceled" ); - } - }); - }, - fail: function( _, reason ) { - strictEqual( reason, "canceled", "canceled request must fail with 'canceled' status text" ); - } - }); - - ajaxTest( "jQuery.ajax() - dataType html", 5, { - setup: function() { - Globals.register("testFoo"); - Globals.register("testBar"); - }, - dataType: "html", - url: url("data/test.html"), - success: function( data ) { - ok( data.match( /^html text/ ), "Check content for datatype html" ); - jQuery("#ap").html( data ); - strictEqual( window["testFoo"], "foo", "Check if script was evaluated for datatype html" ); - strictEqual( window["testBar"], "bar", "Check if script src was evaluated for datatype html" ); - } - }); - - ajaxTest( "jQuery.ajax() - synchronous request", 1, { - url: url("data/json_obj.js"), - dataType: "text", - async: false, - success: true, - afterSend: function( xhr ) { - ok( /^\{ "data"/.test( xhr.responseText ), "check returned text" ); - } - }); - - ajaxTest( "jQuery.ajax() - synchronous request with callbacks", 2, { - url: url("data/json_obj.js"), - async: false, - dataType: "text", - success: true, - afterSend: function( xhr ) { - var result; - xhr.done(function( data ) { - ok( true, "success callback executed" ); - result = data; - }); - ok( /^\{ "data"/.test( result ), "check returned text" ); - } - }); - - asyncTest( "jQuery.ajax(), jQuery.get[Script|JSON](), jQuery.post(), pass-through request object", 8, function() { - var target = "data/name.html", - successCount = 0, - errorCount = 0, - errorEx = "", - success = function() { - successCount++; - }; - jQuery( document ).on( "ajaxError.passthru", function( e, xml ) { - errorCount++; - errorEx += ": " + xml.status; - }); - jQuery( document ).one( "ajaxStop", function() { - equal( successCount, 5, "Check all ajax calls successful" ); - equal( errorCount, 0, "Check no ajax errors (status" + errorEx + ")" ); - jQuery( document ).off("ajaxError.passthru"); - start(); - }); - Globals.register("testBar"); - - ok( jQuery.get( url(target), success ), "get" ); - ok( jQuery.post( url(target), success ), "post" ); - ok( jQuery.getScript( url("data/test.js"), success ), "script" ); - ok( jQuery.getJSON( url("data/json_obj.js"), success ), "json" ); - ok( jQuery.ajax({ - url: url( target ), - success: success - }), "generic" ); - }); - - ajaxTest( "jQuery.ajax() - cache", 12, function() { - - var re = /_=(.*?)(&|$)/g; - - function request( url, title ) { - return { - url: url, - cache: false, - beforeSend: function() { - var parameter, tmp; - while(( tmp = re.exec( this.url ) )) { - strictEqual( parameter, undefined, title + ": only one 'no-cache' parameter" ); - parameter = tmp[ 1 ]; - notStrictEqual( parameter, "tobereplaced555", title + ": parameter (if it was there) was replaced" ); - } - return false; - }, - error: true - }; - } - - return [ - request( - "data/text.php", - "no parameter" - ), - request( - "data/text.php?pizza=true", - "1 parameter" - ), - request( - "data/text.php?_=tobereplaced555", - "_= parameter" - ), - request( - "data/text.php?pizza=true&_=tobereplaced555", - "1 parameter and _=" - ), - request( - "data/text.php?_=tobereplaced555&tv=false", - "_= and 1 parameter" - ), - request( - "data/text.php?name=David&_=tobereplaced555&washere=true", - "2 parameters surrounding _=" - ) - ]; - }); - - jQuery.each( [ " - Same Domain", " - Cross Domain" ], function( crossDomain, label ) { - - ajaxTest( "jQuery.ajax() - JSONP - Query String (?n)" + label, 4, [ - { - url: "data/jsonp.php?callback=?", - dataType: "jsonp", - crossDomain: crossDomain, - success: function( data ) { - ok( data.data, "JSON results returned (GET, url callback)" ); - } - }, - { - url: "data/jsonp.php?callback=??", - dataType: "jsonp", - crossDomain: crossDomain, - success: function( data ) { - ok( data.data, "JSON results returned (GET, url context-free callback)" ); - } - }, - { - url: "data/jsonp.php/??", - dataType: "jsonp", - crossDomain: crossDomain, - success: function( data ) { - ok( data.data, "JSON results returned (GET, REST-like)" ); - } - }, - { - url: "data/jsonp.php/???json=1", - dataType: "jsonp", - crossDomain: crossDomain, - success: function( data ) { - strictEqual( jQuery.type( data ), "array", "JSON results returned (GET, REST-like with param)" ); - } - } - ]); - - ajaxTest( "jQuery.ajax() - JSONP - Explicit callback param" + label, 9, { - setup: function() { - Globals.register("functionToCleanUp"); - Globals.register("XXX"); - Globals.register("jsonpResults"); - window["jsonpResults"] = function( data ) { - ok( data["data"], "JSON results returned (GET, custom callback function)" ); - }; - }, - requests: [{ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - jsonp: "callback", - success: function( data ) { - ok( data["data"], "JSON results returned (GET, data obj callback)" ); - } - }, { - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - jsonpCallback: "jsonpResults", - success: function( data ) { - ok( data.data, "JSON results returned (GET, custom callback name)" ); - } - }, { - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - jsonpCallback: "functionToCleanUp", - success: function( data ) { - ok( data["data"], "JSON results returned (GET, custom callback name to be cleaned up)" ); - strictEqual( window["functionToCleanUp"], undefined, "Callback was removed (GET, custom callback name to be cleaned up)" ); - var xhr; - jQuery.ajax({ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - jsonpCallback: "functionToCleanUp", - beforeSend: function( jqXHR ) { - xhr = jqXHR; - return false; - } - }); - xhr.fail(function() { - ok( true, "Ajax error JSON (GET, custom callback name to be cleaned up)" ); - strictEqual( window["functionToCleanUp"], undefined, "Callback was removed after early abort (GET, custom callback name to be cleaned up)" ); - }); - } - }, { - url: "data/jsonp.php?callback=XXX", - dataType: "jsonp", - jsonp: false, - jsonpCallback: "XXX", - crossDomain: crossDomain, - beforeSend: function() { - ok( /^data\/jsonp.php\?callback=XXX&_=\d+$/.test( this.url ), "The URL wasn't messed with (GET, custom callback name with no url manipulation)" ); - }, - success: function( data ) { - ok( data["data"], "JSON results returned (GET, custom callback name with no url manipulation)" ); - } - }] - }); - - ajaxTest( "jQuery.ajax() - JSONP - Callback in data" + label, 2, [ - { - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - data: "callback=?", - success: function( data ) { - ok( data.data, "JSON results returned (GET, data callback)" ); - } - }, - { - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - data: "callback=??", - success: function( data ) { - ok( data.data, "JSON results returned (GET, data context-free callback)" ); - } - } - ]); - - - ajaxTest( "jQuery.ajax() - JSONP - POST" + label, 3, [ - { - type: "POST", - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - success: function( data ) { - ok( data["data"], "JSON results returned (POST, no callback)" ); - } - }, - { - type: "POST", - url: "data/jsonp.php", - data: "callback=?", - dataType: "jsonp", - crossDomain: crossDomain, - success: function( data ) { - ok( data["data"], "JSON results returned (POST, data callback)" ); - } - }, - { - type: "POST", - url: "data/jsonp.php", - jsonp: "callback", - dataType: "jsonp", - crossDomain: crossDomain, - success: function( data ) { - ok( data["data"], "JSON results returned (POST, data obj callback)" ); - } - } - ]); - - ajaxTest( "jQuery.ajax() - JSONP" + label, 3, [ - { - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - success: function( data ) { - ok( data.data, "JSON results returned (GET, no callback)" ); - } - }, - { - create: function( options ) { - var request = jQuery.ajax( options ), - promise = request.then(function( data ) { - ok( data.data, "first request: JSON results returned (GET, no callback)" ); - request = jQuery.ajax( this ).done(function( data ) { - ok( data.data, "this re-used: JSON results returned (GET, no callback)" ); - }); - promise.abort = request.abort; - return request; - }); - promise.abort = request.abort; - return promise; - }, - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - success: true - } - ]); - - }); - - ajaxTest( "jQuery.ajax() - script, Remote", 2, { - setup: function() { - Globals.register("testBar"); - }, - url: window.location.href.replace( /[^\/]*$/, "" ) + "data/test.js", - dataType: "script", - success: function() { - strictEqual( window["testBar"], "bar", "Script results returned (GET, no callback)" ); - } - }); - - ajaxTest( "jQuery.ajax() - script, Remote with POST", 3, { - setup: function() { - Globals.register("testBar"); - }, - url: window.location.href.replace( /[^\/]*$/, "" ) + "data/test.js", - type: "POST", - dataType: "script", - success: function( data, status ) { - strictEqual( window["testBar"], "bar", "Script results returned (POST, no callback)" ); - strictEqual( status, "success", "Script results returned (POST, no callback)" ); - } - }); - - ajaxTest( "jQuery.ajax() - script, Remote with scheme-less URL", 2, { - setup: function() { - Globals.register("testBar"); - }, - url: window.location.href.replace( /[^\/]*$/, "" ).replace( /^.*?\/\//, "//" ) + "data/test.js", - dataType: "script", - success: function() { - strictEqual( window["testBar"], "bar", "Script results returned (GET, no callback)" ); - } - }); - - ajaxTest( "jQuery.ajax() - malformed JSON", 2, { - url: "data/badjson.js", - dataType: "json", - error: function( xhr, msg, detailedMsg ) { - strictEqual( msg, "parsererror", "A parse error occurred." ); - ok( /(invalid|error|exception)/i.test( detailedMsg ), "Detailed parsererror message provided" ); - } - }); - - ajaxTest( "jQuery.ajax() - script by content-type", 2, [ - { - url: "data/script.php", - data: { - "header": "script" - }, - success: true - }, - { - url: "data/script.php", - data: { - "header": "ecma" - }, - success: true - } - ]); - - ajaxTest( "jQuery.ajax() - JSON by content-type", 5, { - url: "data/json.php", - data: { - "header": "json", - "json": "array" - }, - success: function( json ) { - ok( json.length >= 2, "Check length" ); - strictEqual( json[ 0 ]["name"], "John", "Check JSON: first, name" ); - strictEqual( json[ 0 ]["age"], 21, "Check JSON: first, age" ); - strictEqual( json[ 1 ]["name"], "Peter", "Check JSON: second, name" ); - strictEqual( json[ 1 ]["age"], 25, "Check JSON: second, age" ); - } - }); - - ajaxTest( "jQuery.ajax() - JSON by content-type disabled with options", 6, { - url: url("data/json.php"), - data: { - "header": "json", - "json": "array" - }, - contents: { - "json": false - }, - success: function( text ) { - strictEqual( typeof text, "string", "json wasn't auto-determined" ); - var json = jQuery.parseJSON( text ); - ok( json.length >= 2, "Check length"); - strictEqual( json[ 0 ]["name"], "John", "Check JSON: first, name" ); - strictEqual( json[ 0 ]["age"], 21, "Check JSON: first, age" ); - strictEqual( json[ 1 ]["name"], "Peter", "Check JSON: second, name" ); - strictEqual( json[ 1 ]["age"], 25, "Check JSON: second, age" ); - } - }); - - ajaxTest( "jQuery.ajax() - simple get", 1, { - type: "GET", - url: url("data/name.php?name=foo"), - success: function( msg ) { - strictEqual( msg, "bar", "Check for GET" ); - } - }); - - ajaxTest( "jQuery.ajax() - simple post", 1, { - type: "POST", - url: url("data/name.php"), - data: "name=peter", - success: function( msg ) { - strictEqual( msg, "pan", "Check for POST" ); - } - }); - - ajaxTest( "jQuery.ajax() - data option - empty bodies for non-GET requests", 1, { - url: "data/echoData.php", - data: undefined, - type: "post", - success: function( result ) { - strictEqual( result, "" ); - } - }); - - var ifModifiedNow = new Date(); - - jQuery.each( - /* jQuery.each arguments start */ - { - " (cache)": true, - " (no cache)": false - }, - function( label, cache ) { - var isOpera = !!window.opera; - - asyncTest( "jQuery.ajax() - If-Modified-Since support" + label, 3, function() { - var url = "data/if_modified_since.php?ts=" + ifModifiedNow++; - - jQuery.ajax({ - url: url, - ifModified: true, - cache: cache, - success: function( data, status ) { - strictEqual( status, "success" ); - - jQuery.ajax({ - url: url, - ifModified: true, - cache: cache, - success: function( data, status ) { - if ( data === "FAIL" ) { - ok( isOpera, "Opera is incapable of doing .setRequestHeader('If-Modified-Since')." ); - ok( isOpera, "Opera is incapable of doing .setRequestHeader('If-Modified-Since')." ); - } else { - strictEqual( status, "notmodified" ); - ok( data == null, "response body should be empty" ); - } - start(); - }, - error: function() { - // Do this because opera simply refuses to implement 304 handling :( - // A feature-driven way of detecting this would be appreciated - // See: http://gist.github.com/599419 - ok( isOpera, "error" ); - ok( isOpera, "error" ); - start(); - } - }); - }, - error: function() { - strictEqual( false, "error" ); - // Do this because opera simply refuses to implement 304 handling :( - // A feature-driven way of detecting this would be appreciated - // See: http://gist.github.com/599419 - ok( isOpera, "error" ); - start(); - } - }); - }); - - asyncTest( "jQuery.ajax() - Etag support" + label, 3, function() { - var url = "data/etag.php?ts=" + ifModifiedNow++; - - jQuery.ajax({ - url: url, - ifModified: true, - cache: cache, - success: function( data, status ) { - strictEqual( status, "success" ); - - jQuery.ajax({ - url: url, - ifModified: true, - cache: cache, - success: function( data, status ) { - if ( data === "FAIL" ) { - ok( isOpera, "Opera is incapable of doing .setRequestHeader('If-None-Match')." ); - ok( isOpera, "Opera is incapable of doing .setRequestHeader('If-None-Match')." ); - } else { - strictEqual( status, "notmodified" ); - ok( data == null, "response body should be empty" ); - } - start(); - }, - error: function() { - // Do this because opera simply refuses to implement 304 handling :( - // A feature-driven way of detecting this would be appreciated - // See: http://gist.github.com/599419 - ok( isOpera, "error" ); - ok( isOpera, "error" ); - start(); - } - }); - }, - error: function() { - // Do this because opera simply refuses to implement 304 handling :( - // A feature-driven way of detecting this would be appreciated - // See: http://gist.github.com/599419 - ok( isOpera, "error" ); - start(); - } - }); - }); - } - /* jQuery.each arguments end */ - ); - - ajaxTest( "jQuery.ajax() - failing cross-domain (non-existing)", 1, { - // see RFC 2606 - url: "http://example.invalid", - error: function( xhr, _, e ) { - ok( true, "file not found: " + xhr.status + " => " + e ); - } - }); - - ajaxTest( "jQuery.ajax() - failing cross-domain", 1, { - url: "http://" + externalHost, - error: function( xhr, _, e ) { - ok( true, "access denied: " + xhr.status + " => " + e ); - } - }); - - ajaxTest( "jQuery.ajax() - atom+xml", 1, { - url: url("data/atom+xml.php"), - success: function() { - ok( true, "success" ); - } - }); - - asyncTest( "jQuery.ajax() - statusText", 3, function() { - jQuery.ajax( url("data/statusText.php?status=200&text=Hello") ).done(function( _, statusText, jqXHR ) { - strictEqual( statusText, "success", "callback status text ok for success" ); - ok( jqXHR.statusText === "Hello" || jqXHR.statusText === "OK", "jqXHR status text ok for success (" + jqXHR.statusText + ")" ); - jQuery.ajax( url("data/statusText.php?status=404&text=World") ).fail(function( jqXHR, statusText ) { - strictEqual( statusText, "error", "callback status text ok for error" ); - // ok( jqXHR.statusText === "World" || jQuery.browser.safari && jqXHR.statusText === "Not Found", "jqXHR status text ok for error (" + jqXHR.statusText + ")" ); - start(); - }); - }); - }); - - asyncTest( "jQuery.ajax() - statusCode", 20, function() { - - var count = 12; - - function countComplete() { - if ( ! --count ) { - start(); - } - } - - function createStatusCodes( name, isSuccess ) { - name = "Test " + name + " " + ( isSuccess ? "success" : "error" ); - return { - 200: function() { - ok( isSuccess, name ); - }, - 404: function() { - ok( !isSuccess, name ); - } - }; - } - - jQuery.each( - /* jQuery.each arguments start */ - { - "data/name.html": true, - "data/someFileThatDoesNotExist.html": false - }, - function( uri, isSuccess ) { - - jQuery.ajax( url(uri), { - statusCode: createStatusCodes( "in options", isSuccess ), - complete: countComplete - }); - - jQuery.ajax( url(uri), { - complete: countComplete - }).statusCode( createStatusCodes("immediately with method", isSuccess) ); - - jQuery.ajax( url(uri), { - complete: function( jqXHR ) { - jqXHR.statusCode( createStatusCodes("on complete", isSuccess) ); - countComplete(); - } - }); - - jQuery.ajax( url(uri), { - complete: function( jqXHR ) { - setTimeout(function() { - jqXHR.statusCode( createStatusCodes("very late binding", isSuccess) ); - countComplete(); - }, 100 ); - } - }); - - jQuery.ajax( url(uri), { - statusCode: createStatusCodes( "all (options)", isSuccess ), - complete: function( jqXHR ) { - jqXHR.statusCode( createStatusCodes("all (on complete)", isSuccess) ); - setTimeout(function() { - jqXHR.statusCode( createStatusCodes("all (very late binding)", isSuccess) ); - countComplete(); - }, 100 ); - } - }).statusCode( createStatusCodes("all (immediately with method)", isSuccess) ); - - var testString = ""; - - jQuery.ajax( url(uri), { - success: function( a, b, jqXHR ) { - ok( isSuccess, "success" ); - var statusCode = {}; - statusCode[ jqXHR.status ] = function() { - testString += "B"; - }; - jqXHR.statusCode( statusCode ); - testString += "A"; - }, - error: function( jqXHR ) { - ok( !isSuccess, "error" ); - var statusCode = {}; - statusCode[ jqXHR.status ] = function() { - testString += "B"; - }; - jqXHR.statusCode( statusCode ); - testString += "A"; - }, - complete: function() { - strictEqual( - testString, - "AB", - "Test statusCode callbacks are ordered like " + ( isSuccess ? "success" : "error" ) + " callbacks" - ); - countComplete(); - } - }); - - } - /* jQuery.each arguments end*/ - ); - }); - - ajaxTest( "jQuery.ajax() - transitive conversions", 8, [ - { - url: url("data/json.php"), - converters: { - "json myJson": function( data ) { - ok( true, "converter called" ); - return data; - } - }, - dataType: "myJson", - success: function() { - ok( true, "Transitive conversion worked" ); - strictEqual( this.dataTypes[ 0 ], "text", "response was retrieved as text" ); - strictEqual( this.dataTypes[ 1 ], "myjson", "request expected myjson dataType" ); - } - }, - { - url: url("data/json.php"), - converters: { - "json myJson": function( data ) { - ok( true, "converter called (*)" ); - return data; - } - }, - contents: false, /* headers are wrong so we ignore them */ - dataType: "* myJson", - success: function() { - ok( true, "Transitive conversion worked (*)" ); - strictEqual( this.dataTypes[ 0 ], "text", "response was retrieved as text (*)" ); - strictEqual( this.dataTypes[ 1 ], "myjson", "request expected myjson dataType (*)" ); - } - } - ]); - - ajaxTest( "jQuery.ajax() - overrideMimeType", 2, [ - { - url: url("data/json.php"), - beforeSend: function( xhr ) { - xhr.overrideMimeType( "application/json" ); - }, - success: function( json ) { - ok( json.data, "Mimetype overridden using beforeSend" ); - } - }, - { - url: url("data/json.php"), - mimeType: "application/json", - success: function( json ) { - ok( json.data, "Mimetype overridden using mimeType option" ); - } - } - ]); - - ajaxTest( "jQuery.ajax() - empty json gets to error callback instead of success callback.", 1, { - url: url("data/echoData.php"), - error: function( _, __, error ) { - equal( typeof error === "object", true, "Didn't get back error object for empty json response" ); - }, - dataType: "json" - }); - - ajaxTest( "#2688 - jQuery.ajax() - beforeSend, cancel request", 2, { - create: function() { - return jQuery.ajax({ - url: url("data/name.html"), - beforeSend: function() { - ok( true, "beforeSend got called, canceling" ); - return false; - }, - success: function() { - ok( false, "request didn't get canceled" ); - }, - complete: function() { - ok( false, "request didn't get canceled" ); - }, - error: function() { - ok( false, "request didn't get canceled" ); - } - }); - }, - fail: function( _, reason ) { - strictEqual( reason, "canceled", "canceled request must fail with 'canceled' status text" ); - } - }); - - ajaxTest( "#2806 - jQuery.ajax() - data option - evaluate function values", 1, { - url: "data/echoQuery.php", - data: { - key: function() { - return "value"; - } - }, - success: function( result ) { - strictEqual( result, "key=value" ); - } - }); - - test( "#7531 - jQuery.ajax() - Location object as url", 1, function () { - var xhr, - success = false; - try { - xhr = jQuery.ajax({ - url: window.location - }); - success = true; - xhr.abort(); - } catch (e) { - - } - ok( success, "document.location did not generate exception" ); - }); - - jQuery.each( [ " - Same Domain", " - Cross Domain" ], function( crossDomain, label ) { - ajaxTest( "#7578 - jQuery.ajax() - JSONP - default for cache option" + label, 1, { - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - beforeSend: function() { - strictEqual( this.cache, false, "cache must be false on JSON request" ); - return false; - }, - error: true - }); - }); - - ajaxTest( "#8107 - jQuery.ajax() - multiple method signatures introduced in 1.5", 4, [ - { - create: function() { - return jQuery.ajax(); - }, - done: function() { - ok( true, "With no arguments" ); - } - }, - { - create: function() { - return jQuery.ajax("data/name.html"); - }, - done: function() { - ok( true, "With only string URL argument" ); - } - }, - { - create: function() { - return jQuery.ajax( "data/name.html", {}); - }, - done: function() { - ok( true, "With string URL param and map" ); - } - }, - { - create: function( options ) { - return jQuery.ajax( options ); - }, - url: "data/name.html", - success: function() { - ok( true, "With only map" ); - } - } - ]); - - jQuery.each( [ " - Same Domain", " - Cross Domain" ], function( crossDomain, label ) { - ajaxTest( "#8205 - jQuery.ajax() - JSONP - re-use callbacks name" + label, 2, { - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - beforeSend: function( jqXHR, s ) { - s.callback = s.jsonpCallback; - }, - success: function() { - var previous = this; - strictEqual( previous.jsonpCallback, undefined, "jsonpCallback option is set back to default in callbacks" ); - jQuery.ajax({ - url: "data/jsonp.php", - dataType: "jsonp", - crossDomain: crossDomain, - beforeSend: function() { - strictEqual( this.jsonpCallback, previous.callback, "JSONP callback name is re-used" ); - return false; - } - }); - } - }); - }); - - test( "#9887 - jQuery.ajax() - Context with circular references (#9887)", 2, function () { - var success = false, - context = {}; - context.field = context; - try { - jQuery.ajax( "non-existing", { - context: context, - beforeSend: function() { - ok( this === context, "context was not deep extended" ); - return false; - } - }); - success = true; - } catch ( e ) { - console.log( e ); - } - ok( success, "context with circular reference did not generate an exception" ); - }); - - jQuery.each( [ "as argument", "in settings object" ], function( inSetting, title ) { - - function request( url, test ) { - return { - create: function() { - return jQuery.ajax( inSetting ? { url: url } : url ); - }, - done: function() { - ok( true, ( test || url ) + " " + title ); - } - }; - } - - ajaxTest( "#10093 - jQuery.ajax() - falsy url " + title, 4, [ - request( "", "empty string" ), - request( false ), - request( null ), - request( undefined ) - ]); - - }); - - ajaxTest( "#11151 - jQuery.ajax() - parse error body", 2, { - url: url("data/errorWithJSON.php"), - dataFilter: function( string ) { - ok( false, "dataFilter called" ); - return string; - }, - error: function( jqXHR ) { - strictEqual( jqXHR.responseText, "{ \"code\": 40, \"message\": \"Bad Request\" }", "Error body properly set" ); - deepEqual( jqXHR.responseJSON, { code: 40, message: "Bad Request" }, "Error body properly parsed" ); - } - }); - - ajaxTest( "#11426 - jQuery.ajax() - loading binary data shouldn't throw an exception in IE", 1, { - url: url("data/1x1.jpg"), - success: function( data ) { - ok( data === undefined || /JFIF/.test( data ), "success callback reached" ); - } - }); - - test( "#11743 - jQuery.ajax() - script, throws exception", 1, function() { - raises(function() { - jQuery.ajax({ - url: "data/badjson.js", - dataType: "script", - throws: true, - // TODO find a way to test this asynchronously, too - async: false, - // Global events get confused by the exception - global: false, - success: function() { - ok( false, "Success." ); - }, - error: function() { - ok( false, "Error." ); - } - }); - }, "exception bubbled" ); - }); - - jQuery.each( [ "method", "type" ], function( _, globalOption ) { - - function request( option ) { - var options = { - url: url("data/echoData.php"), - data: "hello", - success: function( msg ) { - strictEqual( msg, "hello", "Check for POST (no override)" ); - } - }; - if ( option ) { - options[ option ] = "GET"; - options.success = function( msg ) { - strictEqual( msg, "", "Check for no POST (overriding with " + option + ")" ); - }; - } - return options; - } - - ajaxTest( "#12004 - jQuery.ajax() - method is an alias of type - " + globalOption + " set globally", 3, { - setup: function() { - var options = {}; - options[ globalOption ] = "POST"; - jQuery.ajaxSetup( options ); - }, - requests: [ - request("type"), - request("method"), - request() - ] - }); - - }); - - ajaxTest( "#13276 - jQuery.ajax() - compatibility between XML documents from ajax requests and parsed string", 1, { - url: "data/dashboard.xml", - dataType: "xml", - success: function( ajaxXML ) { - var parsedXML = jQuery( jQuery.parseXML("blibli") ).find("tab"); - ajaxXML = jQuery( ajaxXML ); - try { - ajaxXML.find("infowindowtab").append( parsedXML ); - } catch( e ) { - strictEqual( e, undefined, "error" ); - return; - } - strictEqual( ajaxXML.find("tab").length, 3, "Parsed node was added properly" ); - } - }); - - ajaxTest( "#13292 - jQuery.ajax() - converter is bypassed for 204 requests", 3, { - url: "data/nocontent.php", - dataType: "testing", - converters: { - "* testing": function() { - throw "converter was called"; - } - }, - success: function( data, status, jqXHR ) { - strictEqual( jqXHR.status, 204, "status code is 204" ); - strictEqual( status, "nocontent", "status text is 'nocontent'" ); - strictEqual( data, undefined, "data is undefined" ); - }, - error: function( _, status, error ) { - ok( false, "error" ); - strictEqual( status, "parsererror", "Parser Error" ); - strictEqual( error, "converter was called", "Converter was called" ); - } - }); - - ajaxTest( "#13388 - jQuery.ajax() - responseXML", 3, { - url: url("data/with_fries.xml"), - dataType: "xml", - success: function( resp, _, jqXHR ) { - notStrictEqual( resp, undefined, "XML document exists" ); - ok( "responseXML" in jqXHR, "jqXHR.responseXML exists" ); - strictEqual( resp, jqXHR.responseXML, "jqXHR.responseXML is set correctly" ); - } - }); - - ajaxTest( "#13922 - jQuery.ajax() - converter is bypassed for HEAD requests", 3, { - url: "data/json.php", - method: "HEAD", - data: { - header: "yes" - }, - converters: { - "text json": function() { - throw "converter was called"; - } - }, - success: function( data, status ) { - ok( true, "success" ); - strictEqual( status, "nocontent", "data is undefined" ); - strictEqual( data, undefined, "data is undefined" ); - }, - error: function( _, status, error ) { - ok( false, "error" ); - strictEqual( status, "parsererror", "Parser Error" ); - strictEqual( error, "converter was called", "Converter was called" ); - } - } ); - -//----------- jQuery.ajaxPrefilter() - - ajaxTest( "jQuery.ajaxPrefilter() - abort", 1, { - setup: function() { - jQuery.ajaxPrefilter(function( options, _, jqXHR ) { - if ( options.abortInPrefilter ) { - jqXHR.abort(); - } - }); - }, - abortInPrefilter: true, - error: function() { - ok( false, "error callback called" ); - }, - fail: function( _, reason ) { - strictEqual( reason, "canceled", "Request aborted by the prefilter must fail with 'canceled' status text" ); - } - }); - -//----------- jQuery.ajaxSetup() - - asyncTest( "jQuery.ajaxSetup()", 1, function() { - jQuery.ajaxSetup({ - url: url("data/name.php?name=foo"), - success: function( msg ) { - strictEqual( msg, "bar", "Check for GET" ); - start(); - } - }); - jQuery.ajax(); - }); - - asyncTest( "jQuery.ajaxSetup({ timeout: Number }) - with global timeout", 2, function() { - var passed = 0, - pass = function() { - ok( passed++ < 2, "Error callback executed" ); - if ( passed === 2 ) { - jQuery( document ).off("ajaxError.setupTest"); - start(); - } - }, - fail = function( a, b ) { - ok( false, "Check for timeout failed " + a + " " + b ); - start(); - }; - - jQuery( document ).on( "ajaxError.setupTest", pass ); - - jQuery.ajaxSetup({ - timeout: 1000 - }); - - jQuery.ajax({ - type: "GET", - url: url("data/name.php?wait=5"), - error: pass, - success: fail - }); - }); - - asyncTest( "jQuery.ajaxSetup({ timeout: Number }) with localtimeout", 1, function() { - jQuery.ajaxSetup({ - timeout: 50 - }); - jQuery.ajax({ - type: "GET", - timeout: 15000, - url: url("data/name.php?wait=1"), - error: function() { - ok( false, "Check for local timeout failed" ); - start(); - }, - success: function() { - ok( true, "Check for local timeout" ); - start(); - } - }); - }); - -//----------- jQuery.domManip() - - test( "#11264 - jQuery.domManip() - no side effect because of ajaxSetup or global events", 1, function() { - jQuery.ajaxSetup({ - type: "POST" - }); - - jQuery( document ).on( "ajaxStart ajaxStop", function() { - ok( false, "Global event triggered" ); - }); - - jQuery("#qunit-fixture").append(""); - - jQuery( document ).off("ajaxStart ajaxStop"); - }); - - asyncTest( "#11402 - jQuery.domManip() - script in comments are properly evaluated", 2, function() { - jQuery("#qunit-fixture").load( "data/cleanScript.html", start ); - }); - -//----------- jQuery.get() - - asyncTest( "jQuery.get( String, Hash, Function ) - parse xml and use text() on nodes", 2, function() { - jQuery.get( url("data/dashboard.xml"), function( xml ) { - var content = []; - jQuery( "tab", xml ).each(function() { - content.push( jQuery( this ).text() ); - }); - strictEqual( content[ 0 ], "blabla", "Check first tab" ); - strictEqual( content[ 1 ], "blublu", "Check second tab" ); - start(); - }); - }); - - asyncTest( "#8277 - jQuery.get( String, Function ) - data in ajaxSettings", 1, function() { - jQuery.ajaxSetup({ - data: "helloworld" - }); - jQuery.get( url("data/echoQuery.php"), function( data ) { - ok( /helloworld$/.test( data ), "Data from ajaxSettings was used" ); - start(); - }); - }); - -//----------- jQuery.getJSON() - - asyncTest( "jQuery.getJSON( String, Hash, Function ) - JSON array", 5, function() { - jQuery.getJSON( - url("data/json.php"), - { - "json": "array" - }, - function( json ) { - ok( json.length >= 2, "Check length" ); - strictEqual( json[ 0 ]["name"], "John", "Check JSON: first, name" ); - strictEqual( json[ 0 ]["age"], 21, "Check JSON: first, age" ); - strictEqual( json[ 1 ]["name"], "Peter", "Check JSON: second, name" ); - strictEqual( json[ 1 ]["age"], 25, "Check JSON: second, age" ); - start(); - } - ); - }); - - asyncTest( "jQuery.getJSON( String, Function ) - JSON object", 2, function() { - jQuery.getJSON( url("data/json.php"), function( json ) { - if ( json && json["data"] ) { - strictEqual( json["data"]["lang"], "en", "Check JSON: lang" ); - strictEqual( json["data"].length, 25, "Check JSON: length" ); - start(); - } - }); - }); - - asyncTest( "jQuery.getJSON() - Using Native JSON", 2, function() { - var restore = "JSON" in window, - old = window.JSON; - if ( !restore ) { - Globals.register("JSON"); - } - window.JSON = { - parse: function() { - ok( true, "Verifying that parse method was run" ); - window.JSON = old; - return true; - } - }; - jQuery.getJSON( url("data/json.php"), function( json ) { - strictEqual( json, true, "Verifying return value" ); - start(); - }); - }); - - asyncTest( "jQuery.getJSON( String, Function ) - JSON object with absolute url to local content", 2, function() { - jQuery.getJSON( url( window.location.href.replace( /[^\/]*$/, "" ) + "data/json.php" ), function( json ) { - strictEqual( json.data.lang, "en", "Check JSON: lang" ); - strictEqual( json.data.length, 25, "Check JSON: length" ); - start(); - }); - }); - -//----------- jQuery.getScript() - - asyncTest( "jQuery.getScript( String, Function ) - with callback", 2, function() { - Globals.register("testBar"); - jQuery.getScript( url("data/test.js"), function() { - strictEqual( window["testBar"], "bar", "Check if script was evaluated" ); - start(); - }); - }); - - asyncTest( "jQuery.getScript( String, Function ) - no callback", 1, function() { - Globals.register("testBar"); - jQuery.getScript( url("data/test.js") ).done( start ); - }); - - asyncTest( "#8082 - jQuery.getScript( String, Function ) - source as responseText", 2, function() { - Globals.register("testBar"); - jQuery.getScript( url("data/test.js"), function( data, _, jqXHR ) { - strictEqual( data, jqXHR.responseText, "Same-domain script requests returns the source of the script" ); - start(); - }); - }); - -//----------- jQuery.fn.load() - - // check if load can be called with only url - asyncTest( "jQuery.fn.load( String )", 2, function() { - jQuery.ajaxSetup({ - beforeSend: function() { - strictEqual( this.type, "GET", "no data means GET request" ); - } - }); - jQuery("#first").load( "data/name.html", start ); - }); - - asyncTest( "jQuery.fn.load() - 404 error callbacks", 6, function() { - addGlobalEvents("ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError")(); - jQuery( document ).ajaxStop( start ); - jQuery("
              ").load( "data/404.html", function() { - ok( true, "complete" ); - }); - }); - - // check if load can be called with url and null data - asyncTest( "jQuery.fn.load( String, null )", 2, function() { - jQuery.ajaxSetup({ - beforeSend: function() { - strictEqual( this.type, "GET", "no data means GET request" ); - } - }); - jQuery("#first").load( "data/name.html", null, start ); - }); - - // check if load can be called with url and undefined data - asyncTest( "jQuery.fn.load( String, undefined )", 2, function() { - jQuery.ajaxSetup({ - beforeSend: function() { - strictEqual( this.type, "GET", "no data means GET request" ); - } - }); - jQuery("#first").load( "data/name.html", undefined, start ); - }); - - // check if load can be called with only url - asyncTest( "jQuery.fn.load( URL_SELECTOR )", 1, function() { - jQuery("#first").load( "data/test3.html div.user", function() { - strictEqual( jQuery( this ).children("div").length, 2, "Verify that specific elements were injected" ); - start(); - }); - }); - - asyncTest( "jQuery.fn.load( String, Function ) - simple: inject text into DOM", 2, function() { - jQuery("#first").load( url("data/name.html"), function() { - ok( /^ERROR/.test(jQuery("#first").text()), "Check if content was injected into the DOM" ); - start(); - }); - }); - - asyncTest( "jQuery.fn.load( String, Function ) - check scripts", 7, function() { - var verifyEvaluation = function() { - strictEqual( window["testBar"], "bar", "Check if script src was evaluated after load" ); - strictEqual( jQuery("#ap").html(), "bar", "Check if script evaluation has modified DOM"); - start(); - }; - - Globals.register("testFoo"); - Globals.register("testBar"); - - jQuery("#first").load( url("data/test.html"), function() { - ok( jQuery("#first").html().match( /^html text/ ), "Check content after loading html" ); - strictEqual( jQuery("#foo").html(), "foo", "Check if script evaluation has modified DOM" ); - strictEqual( window["testFoo"], "foo", "Check if script was evaluated after load" ); - setTimeout( verifyEvaluation, 600 ); - }); - }); - - asyncTest( "jQuery.fn.load( String, Function ) - check file with only a script tag", 3, function() { - Globals.register("testFoo"); - - jQuery("#first").load( url("data/test2.html"), function() { - strictEqual( jQuery("#foo").html(), "foo", "Check if script evaluation has modified DOM"); - strictEqual( window["testFoo"], "foo", "Check if script was evaluated after load" ); - start(); - }); - }); - - asyncTest( "jQuery.fn.load( String, Function ) - dataFilter in ajaxSettings", 2, function() { - jQuery.ajaxSetup({ - dataFilter: function() { - return "Hello World"; - } - }); - jQuery("
              ").load( url("data/name.html"), function( responseText ) { - strictEqual( jQuery( this ).html(), "Hello World", "Test div was filled with filtered data" ); - strictEqual( responseText, "Hello World", "Test callback receives filtered data" ); - start(); - }); - }); - - asyncTest( "jQuery.fn.load( String, Object, Function )", 2, function() { - jQuery("
              ").load( url("data/params_html.php"), { - "foo": 3, - "bar": "ok" - }, function() { - var $post = jQuery( this ).find("#post"); - strictEqual( $post.find("#foo").text(), "3", "Check if a hash of data is passed correctly" ); - strictEqual( $post.find("#bar").text(), "ok", "Check if a hash of data is passed correctly" ); - start(); - }); - }); - - asyncTest( "jQuery.fn.load( String, String, Function )", 2, function() { - jQuery("
              ").load( url("data/params_html.php"), "foo=3&bar=ok", function() { - var $get = jQuery( this ).find("#get"); - strictEqual( $get.find("#foo").text(), "3", "Check if a string of data is passed correctly" ); - strictEqual( $get.find("#bar").text(), "ok", "Check if a of data is passed correctly" ); - start(); - }); - }); - - asyncTest( "jQuery.fn.load() - callbacks get the correct parameters", 8, function() { - var completeArgs = {}; - - jQuery.ajaxSetup({ - success: function( _, status, jqXHR ) { - completeArgs[ this.url ] = [ jqXHR.responseText, status, jqXHR ]; - }, - error: function( jqXHR, status ) { - completeArgs[ this.url ] = [ jqXHR.responseText, status, jqXHR ]; - } - }); - - jQuery.when.apply( - jQuery, - jQuery.map([ - { - type: "success", - url: "data/echoQuery.php?arg=pop" - }, - { - type: "error", - url: "data/404.php" - } - ], - function( options ) { - return jQuery.Deferred(function( defer ) { - jQuery("#foo").load( options.url, function() { - var args = arguments; - strictEqual( completeArgs[ options.url ].length, args.length, "same number of arguments (" + options.type + ")" ); - jQuery.each( completeArgs[ options.url ], function( i, value ) { - strictEqual( args[ i ], value, "argument #" + i + " is the same (" + options.type + ")" ); - }); - defer.resolve(); - }); - }); - }) - ).always( start ); - }); - - asyncTest( "#2046 - jQuery.fn.load( String, Function ) with ajaxSetup on dataType json", 1, function() { - jQuery.ajaxSetup({ - dataType: "json" - }); - jQuery( document ).ajaxComplete(function( e, xml, s ) { - strictEqual( s.dataType, "html", "Verify the load() dataType was html" ); - jQuery( document ).off("ajaxComplete"); - start(); - }); - jQuery("#first").load("data/test3.html"); - }); - - asyncTest( "#10524 - jQuery.fn.load() - data specified in ajaxSettings is merged in", 1, function() { - var data = { - "baz": 1 - }; - jQuery.ajaxSetup({ - data: { - "foo": "bar" - } - }); - jQuery("#foo").load( "data/echoQuery.php", data ); - jQuery( document ).ajaxComplete(function( event, jqXHR, options ) { - ok( ~options.data.indexOf("foo=bar"), "Data from ajaxSettings was used" ); - start(); - }); - }); - -//----------- jQuery.post() - - asyncTest( "jQuery.post() - data", 3, function() { - jQuery.when( - jQuery.post( - url("data/name.php"), - { - xml: "5-2", - length: 3 - }, - function( xml ) { - jQuery( "math", xml ).each(function() { - strictEqual( jQuery( "calculation", this ).text(), "5-2", "Check for XML" ); - strictEqual( jQuery( "result", this ).text(), "3", "Check for XML" ); - }); - } - ), - jQuery.ajax({ - url: url("data/echoData.php"), - type: "POST", - data: { - "test": { - "length": 7, - "foo": "bar" - } - }, - success: function( data ) { - strictEqual( data, "test%5Blength%5D=7&test%5Bfoo%5D=bar", "Check if a sub-object with a length param is serialized correctly" ); - } - }) - ).always( start ); - }); - - asyncTest( "jQuery.post( String, Hash, Function ) - simple with xml", 4, function() { - jQuery.when( - jQuery.post( - url("data/name.php"), - { - "xml": "5-2" - }, - function( xml ) { - jQuery( "math", xml ).each(function() { - strictEqual( jQuery( "calculation", this ).text(), "5-2", "Check for XML" ); - strictEqual( jQuery( "result", this ).text(), "3", "Check for XML" ); - }); - } - ), - jQuery.post( url("data/name.php?xml=5-2"), {}, function( xml ) { - jQuery( "math", xml ).each(function() { - strictEqual( jQuery( "calculation", this ).text(), "5-2", "Check for XML" ); - strictEqual( jQuery( "result", this ).text(), "3", "Check for XML" ); - }); - }) - ).always( start ); - }); - -//----------- jQuery.active - - test( "jQuery.active", 1, function() { - ok( jQuery.active === 0, "ajax active counter should be zero: " + jQuery.active ); - }); - -})(); diff --git a/book/bower_components/jquery/test/unit/attributes.js b/book/bower_components/jquery/test/unit/attributes.js deleted file mode 100644 index aa9d3b48..00000000 --- a/book/bower_components/jquery/test/unit/attributes.js +++ /dev/null @@ -1,1388 +0,0 @@ -module( "attributes", { - teardown: moduleTeardown -}); - -function bareObj( value ) { - return value; -} - -function functionReturningObj( value ) { - return function() { - return value; - }; -} - -/* - ======== local reference ======= - bareObj and functionReturningObj can be used to test passing functions to setters - See testVal below for an example - - bareObj( value ); - This function returns whatever value is passed in - - functionReturningObj( value ); - Returns a function that returns the value -*/ - -test( "jQuery.propFix integrity test", function() { - expect( 1 ); - - // This must be maintained and equal jQuery.attrFix when appropriate - // Ensure that accidental or erroneous property - // overwrites don't occur - // This is simply for better code coverage and future proofing. - var props = { - "tabindex": "tabIndex", - "readonly": "readOnly", - "for": "htmlFor", - "class": "className", - "maxlength": "maxLength", - "cellspacing": "cellSpacing", - "cellpadding": "cellPadding", - "rowspan": "rowSpan", - "colspan": "colSpan", - "usemap": "useMap", - "frameborder": "frameBorder", - "contenteditable": "contentEditable" - }; - - if ( !jQuery.support.enctype ) { - props.enctype = "encoding"; - } - - deepEqual( props, jQuery.propFix, "jQuery.propFix passes integrity check" ); -}); - -test( "attr(String)", function() { - expect( 50 ); - - var extras, body, $body, - select, optgroup, option, $img, styleElem, - $button, $form, $a; - - equal( jQuery("#text1").attr("type"), "text", "Check for type attribute" ); - equal( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" ); - equal( jQuery("#check1").attr("type"), "checkbox", "Check for type attribute" ); - equal( jQuery("#simon1").attr("rel"), "bookmark", "Check for rel attribute" ); - equal( jQuery("#google").attr("title"), "Google!", "Check for title attribute" ); - equal( jQuery("#mark").attr("hreflang"), "en", "Check for hreflang attribute" ); - equal( jQuery("#en").attr("lang"), "en", "Check for lang attribute" ); - equal( jQuery("#simon").attr("class"), "blog link", "Check for class attribute" ); - equal( jQuery("#name").attr("name"), "name", "Check for name attribute" ); - equal( jQuery("#text1").attr("name"), "action", "Check for name attribute" ); - ok( jQuery("#form").attr("action").indexOf("formaction") >= 0, "Check for action attribute" ); - equal( jQuery("#text1").attr("value", "t").attr("value"), "t", "Check setting the value attribute" ); - equal( jQuery("#text1").attr("value", "").attr("value"), "", "Check setting the value attribute to empty string" ); - equal( jQuery("
              ").attr("value"), "t", "Check setting custom attr named 'value' on a div" ); - equal( jQuery("#form").attr("blah", "blah").attr("blah"), "blah", "Set non-existent attribute on a form" ); - equal( jQuery("#foo").attr("height"), undefined, "Non existent height attribute should return undefined" ); - - // [7472] & [3113] (form contains an input with name="action" or name="id") - extras = jQuery("").appendTo("#testForm"); - equal( jQuery("#form").attr("action","newformaction").attr("action"), "newformaction", "Check that action attribute was changed" ); - equal( jQuery("#testForm").attr("target"), undefined, "Retrieving target does not equal the input with name=target" ); - equal( jQuery("#testForm").attr("target", "newTarget").attr("target"), "newTarget", "Set target successfully on a form" ); - equal( jQuery("#testForm").removeAttr("id").attr("id"), undefined, "Retrieving id does not equal the input with name=id after id is removed [#7472]" ); - // Bug #3685 (form contains input with name="name") - equal( jQuery("#testForm").attr("name"), undefined, "Retrieving name does not retrieve input with name=name" ); - extras.remove(); - - equal( jQuery("#text1").attr("maxlength"), "30", "Check for maxlength attribute" ); - equal( jQuery("#text1").attr("maxLength"), "30", "Check for maxLength attribute" ); - equal( jQuery("#area1").attr("maxLength"), "30", "Check for maxLength attribute" ); - - // using innerHTML in IE causes href attribute to be serialized to the full path - jQuery("").attr({ - "id": "tAnchor5", - "href": "#5" - }).appendTo("#qunit-fixture"); - equal( jQuery("#tAnchor5").attr("href"), "#5", "Check for non-absolute href (an anchor)" ); - jQuery("").appendTo("#qunit-fixture"); - equal( jQuery("#tAnchor5").prop("href"), jQuery("#tAnchor6").prop("href"), "Check for absolute href prop on an anchor" ); - - $("").appendTo("#qunit-fixture"); - equal( jQuery("#tAnchor5").prop("href"), jQuery("#scriptSrc").prop("src"), "Check for absolute src prop on a script" ); - - // list attribute is readonly by default in browsers that support it - jQuery("#list-test").attr( "list", "datalist" ); - equal( jQuery("#list-test").attr("list"), "datalist", "Check setting list attribute" ); - - // Related to [5574] and [5683] - body = document.body; - $body = jQuery( body ); - - strictEqual( $body.attr("foo"), undefined, "Make sure that a non existent attribute returns undefined" ); - - body.setAttribute( "foo", "baz" ); - equal( $body.attr("foo"), "baz", "Make sure the dom attribute is retrieved when no expando is found" ); - - $body.attr( "foo","cool" ); - equal( $body.attr("foo"), "cool", "Make sure that setting works well when both expando and dom attribute are available" ); - - body.removeAttribute("foo"); // Cleanup - - select = document.createElement("select"); - optgroup = document.createElement("optgroup"); - option = document.createElement("option"); - - optgroup.appendChild( option ); - select.appendChild( optgroup ); - - equal( jQuery( option ).prop("selected"), true, "Make sure that a single option is selected, even when in an optgroup." ); - - $img = jQuery("").appendTo("body"); - equal( $img.attr("width"), "215", "Retrieve width attribute an an element with display:none." ); - equal( $img.attr("height"), "53", "Retrieve height attribute an an element with display:none." ); - - // Check for style support - styleElem = jQuery("
              ").appendTo("#qunit-fixture").css({ - background: "url(UPPERlower.gif)" - }); - ok( !!~styleElem.attr("style").indexOf("UPPERlower.gif"), "Check style attribute getter" ); - ok( !!~styleElem.attr("style", "position:absolute;").attr("style").indexOf("absolute"), "Check style setter" ); - - // Check value on button element (#1954) - $button = jQuery("").insertAfter("#button"); - strictEqual( $button.attr("value"), undefined, "Absence of value attribute on a button" ); - equal( $button.attr( "value", "foobar" ).attr("value"), "foobar", "Value attribute on a button does not return innerHTML" ); - equal( $button.attr("value", "baz").html(), "text", "Setting the value attribute does not change innerHTML" ); - - // Attributes with a colon on a table element (#1591) - equal( jQuery("#table").attr("test:attrib"), undefined, "Retrieving a non-existent attribute on a table with a colon does not throw an error." ); - equal( jQuery("#table").attr( "test:attrib", "foobar" ).attr("test:attrib"), "foobar", "Setting an attribute on a table with a colon does not throw an error." ); - - $form = jQuery("
              ").appendTo("#qunit-fixture"); - equal( $form.attr("class"), "something", "Retrieve the class attribute on a form." ); - - $a = jQuery("
              Click").appendTo("#qunit-fixture"); - equal( $a.attr("onclick"), "something()", "Retrieve ^on attribute without anonymous function wrapper." ); - - ok( jQuery("
              ").attr("doesntexist") === undefined, "Make sure undefined is returned when no attribute is found." ); - ok( jQuery("
              ").attr("title") === undefined, "Make sure undefined is returned when no attribute is found." ); - equal( jQuery("
              ").attr( "title", "something" ).attr("title"), "something", "Set the title attribute." ); - ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." ); - equal( jQuery("
              ").attr("value"), undefined, "An unset value on a div returns undefined." ); - strictEqual( jQuery("").attr("value"), undefined, "An unset value on a select returns undefined." ); - - $form = jQuery("#form").attr( "enctype", "multipart/form-data" ); - equal( $form.prop("enctype"), "multipart/form-data", "Set the enctype of a form (encoding in IE6/7 #6743)" ); - -}); - -test( "attr(String) on cloned elements, #9646", function() { - expect( 4 ); - - var div, - input = jQuery(""); - - input.attr("name"); - - strictEqual( input.clone( true ).attr( "name", "test" )[ 0 ].name, "test", "Name attribute should be changed on cloned element" ); - - div = jQuery("
              "); - div.attr("id"); - - strictEqual( div.clone( true ).attr( "id", "test" )[ 0 ].id, "test", "Id attribute should be changed on cloned element" ); - - input = jQuery(""); - input.attr("value"); - - strictEqual( input.clone( true ).attr( "value", "test" )[ 0 ].value, "test", "Value attribute should be changed on cloned element" ); - - strictEqual( input.clone( true ).attr( "value", 42 )[ 0 ].value, "42", "Value attribute should be changed on cloned element" ); -}); - -test( "attr(String) in XML Files", function() { - expect( 3 ); - var xml = createDashboardXML(); - equal( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" ); - equal( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" ); - equal( jQuery( "location", xml ).attr("checked"), "different", "Check that hooks are not attached in XML document" ); -}); - -test( "attr(String, Function)", function() { - expect( 2 ); - - equal( - jQuery("#text1").attr( "value", function() { - return this.id; - }).attr("value"), - "text1", - "Set value from id" - ); - - equal( - jQuery("#text1").attr( "title", function(i) { - return i; - }).attr("title"), - "0", - "Set value with an index" - ); -}); - -test( "attr(Hash)", function() { - expect( 3 ); - var pass = true; - jQuery("div").attr({ - "foo": "baz", - "zoo": "ping" - }).each(function() { - if ( this.getAttribute("foo") !== "baz" && this.getAttribute("zoo") !== "ping" ) { - pass = false; - } - }); - - ok( pass, "Set Multiple Attributes" ); - - equal( - jQuery("#text1").attr({ - "value": function() { - return this["id"]; - }}).attr("value"), - "text1", - "Set attribute to computed value #1" - ); - - equal( - jQuery("#text1").attr({ - "title": function(i) { - return i; - } - }).attr("title"), - "0", - "Set attribute to computed value #2" - ); -}); - -test( "attr(String, Object)", function() { - expect( 71 ); - - var $input, $text, $details, - attributeNode, commentNode, textNode, obj, - table, td, j, type, - check, thrown, button, $radio, $radios, $svg, - div = jQuery("div").attr("foo", "bar"), - i = 0, - fail = false; - - for ( ; i < div.length; i++ ) { - if ( div[ i ].getAttribute("foo") !== "bar" ) { - fail = i; - break; - } - } - - equal( fail, false, "Set Attribute, the #" + fail + " element didn't get the attribute 'foo'" ); - - ok( - jQuery("#foo").attr({ - "width": null - }), - "Try to set an attribute to nothing" - ); - - jQuery("#name").attr( "name", "something" ); - equal( jQuery("#name").attr("name"), "something", "Set name attribute" ); - jQuery("#name").attr( "name", null ); - equal( jQuery("#name").attr("name"), undefined, "Remove name attribute" ); - - $input = jQuery( "", { - name: "something", - id: "specified" - }); - equal( $input.attr("name"), "something", "Check element creation gets/sets the name attribute." ); - equal( $input.attr("id"), "specified", "Check element creation gets/sets the id attribute." ); - - // As of fixing #11115, we only guarantee boolean property update for checked and selected - $input = jQuery("").attr( "checked", true ); - equal( $input.prop("checked"), true, "Setting checked updates property (verified by .prop)" ); - equal( $input[0].checked, true, "Setting checked updates property (verified by native property)" ); - $input = jQuery(""); - $select1.val( valueObj( 4 ) ); - equal( $select1.val(), "4", "Should be possible to set the val() to a newly created option" ); - - // using contents will get comments regular, text, and comment nodes - j = jQuery("#nonnodes").contents(); - j.val( valueObj( "asdf" ) ); - equal( j.val(), "asdf", "Check node,textnode,comment with val()" ); - j.removeAttr("value"); -}; - -test( "val(String/Number)", function() { - testVal( bareObj ); -}); - -test( "val(Function)", function() { - testVal( functionReturningObj ); -}); - -test( "val(Array of Numbers) (Bug #7123)", function() { - expect( 4 ); - jQuery("#form").append(""); - var elements = jQuery("input[name=arrayTest]").val([ 1, 2 ]); - ok( elements[ 0 ].checked, "First element was checked" ); - ok( elements[ 1 ].checked, "Second element was checked" ); - ok( !elements[ 2 ].checked, "Third element was unchecked" ); - ok( !elements[ 3 ].checked, "Fourth element remained unchecked" ); - - elements.remove(); -}); - -test( "val(Function) with incoming value", function() { - expect( 10 ); - - QUnit.reset(); - var oldVal = jQuery("#text1").val(); - - jQuery("#text1").val(function( i, val ) { - equal( val, oldVal, "Make sure the incoming value is correct." ); - return "test"; - }); - - equal( document.getElementById("text1").value, "test", "Check for modified (via val(String)) value of input element" ); - - oldVal = jQuery("#text1").val(); - - jQuery("#text1").val(function( i, val ) { - equal( val, oldVal, "Make sure the incoming value is correct." ); - return 67; - }); - - equal( document.getElementById("text1").value, "67", "Check for modified (via val(Number)) value of input element" ); - - oldVal = jQuery("#select1").val(); - - jQuery("#select1").val(function( i, val ) { - equal( val, oldVal, "Make sure the incoming value is correct." ); - return "3"; - }); - - equal( jQuery("#select1").val(), "3", "Check for modified (via val(String)) value of select element" ); - - oldVal = jQuery("#select1").val(); - - jQuery("#select1").val(function( i, val ) { - equal( val, oldVal, "Make sure the incoming value is correct." ); - return 2; - }); - - equal( jQuery("#select1").val(), "2", "Check for modified (via val(Number)) value of select element" ); - - jQuery("#select1").append(""); - - oldVal = jQuery("#select1").val(); - - jQuery("#select1").val(function( i, val ) { - equal( val, oldVal, "Make sure the incoming value is correct." ); - return 4; - }); - - equal( jQuery("#select1").val(), "4", "Should be possible to set the val() to a newly created option" ); -}); - -// testing if a form.reset() breaks a subsequent call to a select element's .val() (in IE only) -test( "val(select) after form.reset() (Bug #2551)", function() { - expect( 3 ); - - jQuery("
              ").appendTo("#qunit-fixture"); - - jQuery("#kkk").val("gf"); - - document["kk"].reset(); - - equal( jQuery("#kkk")[ 0 ].value, "cf", "Check value of select after form reset." ); - equal( jQuery("#kkk").val(), "cf", "Check value of select after form reset." ); - - // re-verify the multi-select is not broken (after form.reset) by our fix for single-select - deepEqual( jQuery("#select3").val(), ["1", "2"], "Call val() on a multiple='multiple' select" ); - - jQuery("#kk").remove(); -}); - -var testAddClass = function( valueObj ) { - expect( 9 ); - - var pass, j, i, - div = jQuery("#qunit-fixture div"); - - div.addClass( valueObj("test") ); - pass = true; - for ( i = 0; i < div.length; i++ ) { - if ( !~div.get( i ).className.indexOf("test") ) { - pass = false; - } - } - ok( pass, "Add Class" ); - - // using contents will get regular, text, and comment nodes - j = jQuery("#nonnodes").contents(); - j.addClass( valueObj("asdf") ); - ok( j.hasClass("asdf"), "Check node,textnode,comment for addClass" ); - - div = jQuery("
              "); - - div.addClass( valueObj("test") ); - equal( div.attr("class"), "test", "Make sure there's no extra whitespace." ); - - div.attr( "class", " foo" ); - div.addClass( valueObj("test") ); - equal( div.attr("class"), "foo test", "Make sure there's no extra whitespace." ); - - div.attr( "class", "foo" ); - div.addClass( valueObj("bar baz") ); - equal( div.attr("class"), "foo bar baz", "Make sure there isn't too much trimming." ); - - div.removeClass(); - div.addClass( valueObj("foo") ).addClass( valueObj("foo") ); - equal( div.attr("class"), "foo", "Do not add the same class twice in separate calls." ); - - div.addClass( valueObj("fo") ); - equal( div.attr("class"), "foo fo", "Adding a similar class does not get interrupted." ); - div.removeClass().addClass("wrap2"); - ok( div.addClass("wrap").hasClass("wrap"), "Can add similarly named classes"); - - div.removeClass(); - div.addClass( valueObj("bar bar") ); - equal( div.attr("class"), "bar", "Do not add the same class twice in the same call." ); -}; - -test( "addClass(String)", function() { - testAddClass( bareObj ); -}); - -test( "addClass(Function)", function() { - testAddClass( functionReturningObj ); -}); - -test( "addClass(Function) with incoming value", function() { - expect( 52 ); - var pass, i, - div = jQuery("#qunit-fixture div"), - old = div.map(function() { - return jQuery(this).attr("class") || ""; - }); - - div.addClass(function( i, val ) { - if ( this.id !== "_firebugConsole" ) { - equal( val, old[ i ], "Make sure the incoming value is correct." ); - return "test"; - } - }); - - pass = true; - for ( i = 0; i < div.length; i++ ) { - if ( div.get(i).className.indexOf("test") === -1 ) { - pass = false; - } - } - ok( pass, "Add Class" ); -}); - -var testRemoveClass = function(valueObj) { - expect( 8 ); - - var $set = jQuery("#qunit-fixture div"), - div = document.createElement("div"); - - $set.addClass("test").removeClass( valueObj("test") ); - - ok( !$set.is(".test"), "Remove Class" ); - - $set.addClass("test").addClass("foo").addClass("bar"); - $set.removeClass( valueObj("test") ).removeClass( valueObj("bar") ).removeClass( valueObj("foo") ); - - ok( !$set.is(".test,.bar,.foo"), "Remove multiple classes" ); - - // Make sure that a null value doesn't cause problems - $set.eq( 0 ).addClass("expected").removeClass( valueObj( null ) ); - ok( $set.eq( 0 ).is(".expected"), "Null value passed to removeClass" ); - - $set.eq( 0 ).addClass("expected").removeClass( valueObj("") ); - ok( $set.eq( 0 ).is(".expected"), "Empty string passed to removeClass" ); - - // using contents will get regular, text, and comment nodes - $set = jQuery("#nonnodes").contents(); - $set.removeClass( valueObj("asdf") ); - ok( !$set.hasClass("asdf"), "Check node,textnode,comment for removeClass" ); - - - jQuery( div ).removeClass( valueObj("foo") ); - strictEqual( jQuery( div ).attr("class"), undefined, "removeClass doesn't create a class attribute" ); - - div.className = " test foo "; - - jQuery( div ).removeClass( valueObj("foo") ); - equal( div.className, "test", "Make sure remaining className is trimmed." ); - - div.className = " test "; - - jQuery( div ).removeClass( valueObj("test") ); - equal( div.className, "", "Make sure there is nothing left after everything is removed." ); -}; - -test( "removeClass(String) - simple", function() { - testRemoveClass( bareObj ); -}); - -test( "removeClass(Function) - simple", function() { - testRemoveClass( functionReturningObj ); -}); - -test( "removeClass(Function) with incoming value", function() { - expect( 52 ); - - var $divs = jQuery("#qunit-fixture div").addClass("test"), old = $divs.map(function() { - return jQuery( this ).attr("class"); - }); - - $divs.removeClass(function( i, val ) { - if ( this.id !== "_firebugConsole" ) { - equal( val, old[ i ], "Make sure the incoming value is correct." ); - return "test"; - } - }); - - ok( !$divs.is(".test"), "Remove Class" ); -}); - -test( "removeClass() removes duplicates", function() { - expect( 1 ); - - var $div = jQuery( jQuery.parseHTML("
              ") ); - - $div.removeClass("x"); - - ok( !$div.hasClass("x"), "Element with multiple same classes does not escape the wrath of removeClass()" ); -}); - -test("removeClass(undefined) is a no-op", function() { - expect( 1 ); - - var $div = jQuery("
              "); - $div.removeClass( undefined ); - - ok( $div.hasClass("base") && $div.hasClass("second"), "Element still has classes after removeClass(undefined)" ); -}); - -var testToggleClass = function(valueObj) { - expect( 17 ); - - var e = jQuery("#firstp"); - ok( !e.is(".test"), "Assert class not present" ); - e.toggleClass( valueObj("test") ); - ok( e.is(".test"), "Assert class present" ); - e.toggleClass( valueObj("test") ); - ok( !e.is(".test"), "Assert class not present" ); - - // class name with a boolean - e.toggleClass( valueObj("test"), false ); - ok( !e.is(".test"), "Assert class not present" ); - e.toggleClass( valueObj("test"), true ); - ok( e.is(".test"), "Assert class present" ); - e.toggleClass( valueObj("test"), false ); - ok( !e.is(".test"), "Assert class not present" ); - - // multiple class names - e.addClass("testA testB"); - ok( e.is(".testA.testB"), "Assert 2 different classes present" ); - e.toggleClass( valueObj("testB testC") ); - ok( (e.is(".testA.testC") && !e.is(".testB")), "Assert 1 class added, 1 class removed, and 1 class kept" ); - e.toggleClass( valueObj("testA testC") ); - ok( (!e.is(".testA") && !e.is(".testB") && !e.is(".testC")), "Assert no class present" ); - - // toggleClass storage - e.toggleClass( true ); - ok( e[ 0 ].className === "", "Assert class is empty (data was empty)" ); - e.addClass("testD testE"); - ok( e.is(".testD.testE"), "Assert class present" ); - e.toggleClass(); - ok( !e.is(".testD.testE"), "Assert class not present" ); - ok( jQuery._data(e[ 0 ], "__className__") === "testD testE", "Assert data was stored" ); - e.toggleClass(); - ok( e.is(".testD.testE"), "Assert class present (restored from data)" ); - e.toggleClass( false ); - ok( !e.is(".testD.testE"), "Assert class not present" ); - e.toggleClass( true ); - ok( e.is(".testD.testE"), "Assert class present (restored from data)" ); - e.toggleClass(); - e.toggleClass( false ); - e.toggleClass(); - ok( e.is(".testD.testE"), "Assert class present (restored from data)" ); - - // Cleanup - e.removeClass("testD"); - QUnit.expectJqData( e[ 0 ], "__className__" ); -}; - -test( "toggleClass(String|boolean|undefined[, boolean])", function() { - testToggleClass( bareObj ); -}); - -test( "toggleClass(Function[, boolean])", function() { - testToggleClass( functionReturningObj ); -}); - -test( "toggleClass(Function[, boolean]) with incoming value", function() { - expect( 14 ); - - var e = jQuery("#firstp"), - old = e.attr("class") || ""; - - ok( !e.is(".test"), "Assert class not present" ); - - e.toggleClass(function( i, val ) { - equal( old, val, "Make sure the incoming value is correct." ); - return "test"; - }); - ok( e.is(".test"), "Assert class present" ); - - old = e.attr("class"); - - e.toggleClass(function( i, val ) { - equal( old, val, "Make sure the incoming value is correct." ); - return "test"; - }); - ok( !e.is(".test"), "Assert class not present" ); - - old = e.attr("class") || ""; - - // class name with a boolean - e.toggleClass(function( i, val, state ) { - equal( old, val, "Make sure the incoming value is correct." ); - equal( state, false, "Make sure that the state is passed in." ); - return "test"; - }, false ); - ok( !e.is(".test"), "Assert class not present" ); - - old = e.attr("class") || ""; - - e.toggleClass(function( i, val, state ) { - equal( old, val, "Make sure the incoming value is correct." ); - equal( state, true, "Make sure that the state is passed in." ); - return "test"; - }, true ); - ok( e.is(".test"), "Assert class present" ); - - old = e.attr("class"); - - e.toggleClass(function( i, val, state ) { - equal( old, val, "Make sure the incoming value is correct." ); - equal( state, false, "Make sure that the state is passed in." ); - return "test"; - }, false ); - ok( !e.is(".test"), "Assert class not present" ); -}); - -test( "addClass, removeClass, hasClass", function() { - expect( 17 ); - - var jq = jQuery("

              Hi

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

              "); - - ok( jq.hasClass("class1"), "Check hasClass with line feed" ); - ok( jq.is(".class1"), "Check is with line feed" ); - ok( jq.hasClass("class2"), "Check hasClass with tab" ); - ok( jq.is(".class2"), "Check is with tab" ); - ok( jq.hasClass("cla.ss3"), "Check hasClass with dot" ); - ok( jq.hasClass("class4"), "Check hasClass with carriage return" ); - ok( jq.is(".class4"), "Check is with carriage return" ); - - jq.removeClass("class2"); - ok( jq.hasClass("class2") === false, "Check the class has been properly removed" ); - jq.removeClass("cla"); - ok( jq.hasClass("cla.ss3"), "Check the dotted class has not been removed" ); - jq.removeClass("cla.ss3"); - ok( jq.hasClass("cla.ss3") === false, "Check the dotted class has been removed" ); - jq.removeClass("class4"); - ok( jq.hasClass("class4") === false, "Check the class has been properly removed" ); -}); - -test( "contents().hasClass() returns correct values", function() { - expect( 2 ); - - var $div = jQuery("
              text
              "), - $contents = $div.contents(); - - ok( $contents.hasClass("foo"), "Found 'foo' in $contents" ); - ok( !$contents.hasClass("undefined"), "Did not find 'undefined' in $contents (correctly)" ); -}); - -test( "hasClass correctly interprets non-space separators (#13835)", function() { - expect( 4 ); - - var - map = { - tab: " ", - "line-feed": " ", - "form-feed": " ", - "carriage-return": " " - }, - classes = jQuery.map( map, function( separator, label ) { - return " " + separator + label + separator + " "; - }), - $div = jQuery( "
              " ); - - jQuery.each( map, function( label ) { - ok( $div.hasClass( label ), label.replace( "-", " " ) ); - }); -}); - -test( "coords returns correct values in IE6/IE7, see #10828", function() { - expect( 1 ); - - var area, - map = jQuery(""); - - area = map.html("a").find("area"); - equal( area.attr("coords"), "0,0,0,0", "did not retrieve coords correctly" ); -}); diff --git a/book/bower_components/jquery/test/unit/callbacks.js b/book/bower_components/jquery/test/unit/callbacks.js deleted file mode 100644 index 843c9584..00000000 --- a/book/bower_components/jquery/test/unit/callbacks.js +++ /dev/null @@ -1,342 +0,0 @@ -module( "callbacks", { - teardown: moduleTeardown -}); - -(function() { - -var output, - addToOutput = function( string ) { - return function() { - output += string; - }; - }, - outputA = addToOutput("A"), - outputB = addToOutput("B"), - outputC = addToOutput("C"), - tests = { - "": "XABC X XABCABCC X XBB X XABA X XX", - "once": "XABC X X X X X XABA X XX", - "memory": "XABC XABC XABCABCCC XA XBB XB XABA XC XX", - "unique": "XABC X XABCA X XBB X XAB X X", - "stopOnFalse": "XABC X XABCABCC X XBB X XA X XX", - "once memory": "XABC XABC X XA X XA XABA XC XX", - "once unique": "XABC X X X X X XAB X X", - "once stopOnFalse": "XABC X X X X X XA X XX", - "memory unique": "XABC XA XABCA XA XBB XB XAB XC X", - "memory stopOnFalse": "XABC XABC XABCABCCC XA XBB XB XA X XX", - "unique stopOnFalse": "XABC X XABCA X XBB X XA X X" - }, - filters = { - "no filter": undefined, - "filter": function( fn ) { - return function() { - return fn.apply( this, arguments ); - }; - } - }; - - function showFlags( flags ) { - if ( typeof flags === "string" ) { - return "'" + flags + "'"; - } - var output = [], key; - for ( key in flags ) { - output.push( "'" + key + "': " + flags[ key ] ); - } - return "{ " + output.join( ", " ) + " }"; - } - -jQuery.each( tests, function( strFlags, resultString ) { - - var objectFlags = {}; - - jQuery.each( strFlags.split( " " ), function() { - if ( this.length ) { - objectFlags[ this ] = true; - } - }); - - jQuery.each( filters, function( filterLabel ) { - - jQuery.each({ - "string": strFlags, - "object": objectFlags - }, function( flagsTypes, flags ) { - - test( "jQuery.Callbacks( " + showFlags( flags ) + " ) - " + filterLabel, function() { - - expect( 21 ); - - // Give qunit a little breathing room - stop(); - setTimeout( start, 0 ); - - var cblist, - results = resultString.split( /\s+/ ); - - // Basic binding and firing - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add(function( str ) { - output += str; - }); - cblist.fire("A"); - strictEqual( output, "XA", "Basic binding and firing" ); - strictEqual( cblist.fired(), true, ".fired() detects firing" ); - output = "X"; - cblist.disable(); - cblist.add(function( str ) { - output += str; - }); - strictEqual( output, "X", "Adding a callback after disabling" ); - cblist.fire("A"); - strictEqual( output, "X", "Firing after disabling" ); - - // #13517 - Emptying while firing - cblist = jQuery.Callbacks( flags ); - cblist.add( cblist.empty ); - cblist.add( function() { - ok( false, "not emptied" ); - } ); - cblist.fire(); - - // Disabling while firing - cblist = jQuery.Callbacks( flags ); - cblist.add( cblist.disable ); - cblist.add( function() { - ok( false, "not disabled" ); - } ); - cblist.fire(); - - // Basic binding and firing (context, arguments) - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add(function() { - equal( this, window, "Basic binding and firing (context)" ); - output += Array.prototype.join.call( arguments, "" ); - }); - cblist.fireWith( window, [ "A", "B" ] ); - strictEqual( output, "XAB", "Basic binding and firing (arguments)" ); - - // fireWith with no arguments - output = ""; - cblist = jQuery.Callbacks( flags ); - cblist.add(function() { - equal( this, window, "fireWith with no arguments (context is window)" ); - strictEqual( arguments.length, 0, "fireWith with no arguments (no arguments)" ); - }); - cblist.fireWith(); - - // Basic binding, removing and firing - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add( outputA, outputB, outputC ); - cblist.remove( outputB, outputC ); - cblist.fire(); - strictEqual( output, "XA", "Basic binding, removing and firing" ); - - // Empty - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add( outputA ); - cblist.add( outputB ); - cblist.add( outputC ); - cblist.empty(); - cblist.fire(); - strictEqual( output, "X", "Empty" ); - - // Locking - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add(function( str ) { - output += str; - }); - cblist.lock(); - cblist.add(function( str ) { - output += str; - }); - cblist.fire("A"); - cblist.add(function( str ) { - output += str; - }); - strictEqual( output, "X", "Lock early" ); - - // Ordering - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add(function() { - cblist.add( outputC ); - outputA(); - }, outputB ); - cblist.fire(); - strictEqual( output, results.shift(), "Proper ordering" ); - - // Add and fire again - output = "X"; - cblist.add(function() { - cblist.add( outputC ); - outputA(); - }, outputB ); - strictEqual( output, results.shift(), "Add after fire" ); - - output = "X"; - cblist.fire(); - strictEqual( output, results.shift(), "Fire again" ); - - // Multiple fire - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add(function( str ) { - output += str; - }); - cblist.fire("A"); - strictEqual( output, "XA", "Multiple fire (first fire)" ); - output = "X"; - cblist.add(function( str ) { - output += str; - }); - strictEqual( output, results.shift(), "Multiple fire (first new callback)" ); - output = "X"; - cblist.fire("B"); - strictEqual( output, results.shift(), "Multiple fire (second fire)" ); - output = "X"; - cblist.add(function( str ) { - output += str; - }); - strictEqual( output, results.shift(), "Multiple fire (second new callback)" ); - - // Return false - output = "X"; - cblist = jQuery.Callbacks( flags ); - cblist.add( outputA, function() { return false; }, outputB ); - cblist.add( outputA ); - cblist.fire(); - strictEqual( output, results.shift(), "Callback returning false" ); - - // Add another callback (to control lists with memory do not fire anymore) - output = "X"; - cblist.add( outputC ); - strictEqual( output, results.shift(), "Adding a callback after one returned false" ); - - // Callbacks are not iterated - output = ""; - function handler() { - output += "X"; - } - handler.method = function() { - output += "!"; - }; - cblist = jQuery.Callbacks( flags ); - cblist.add( handler ); - cblist.add( handler ); - cblist.fire(); - strictEqual( output, results.shift(), "No callback iteration" ); - }); - }); - }); -}); - -})(); - -test( "jQuery.Callbacks( options ) - options are copied", function() { - - expect( 1 ); - - var options = { - "unique": true - }, - cb = jQuery.Callbacks( options ), - count = 0, - fn = function() { - ok( !( count++ ), "called once" ); - }; - options["unique"] = false; - cb.add( fn, fn ); - cb.fire(); -}); - -test( "jQuery.Callbacks.fireWith - arguments are copied", function() { - - expect( 1 ); - - var cb = jQuery.Callbacks("memory"), - args = ["hello"]; - - cb.fireWith( null, args ); - args[ 0 ] = "world"; - - cb.add(function( hello ) { - strictEqual( hello, "hello", "arguments are copied internally" ); - }); -}); - -test( "jQuery.Callbacks.remove - should remove all instances", function() { - - expect( 1 ); - - var cb = jQuery.Callbacks(); - - function fn() { - ok( false, "function wasn't removed" ); - } - - cb.add( fn, fn, function() { - ok( true, "end of test" ); - }).remove( fn ).fire(); -}); - -test( "jQuery.Callbacks.has", function() { - - expect( 13 ); - - var cb = jQuery.Callbacks(); - function getA() { - return "A"; - } - function getB() { - return "B"; - } - function getC() { - return "C"; - } - cb.add(getA, getB, getC); - strictEqual( cb.has(), true, "No arguments to .has() returns whether callback function(s) are attached or not" ); - strictEqual( cb.has(getA), true, "Check if a specific callback function is in the Callbacks list" ); - - cb.remove(getB); - strictEqual( cb.has(getB), false, "Remove a specific callback function and make sure its no longer there" ); - strictEqual( cb.has(getA), true, "Remove a specific callback function and make sure other callback function is still there" ); - - cb.empty(); - strictEqual( cb.has(), false, "Empty list and make sure there are no callback function(s)" ); - strictEqual( cb.has(getA), false, "Check for a specific function in an empty() list" ); - - cb.add(getA, getB, function(){ - strictEqual( cb.has(), true, "Check if list has callback function(s) from within a callback function" ); - strictEqual( cb.has(getA), true, "Check if list has a specific callback from within a callback function" ); - }).fire(); - - strictEqual( cb.has(), true, "Callbacks list has callback function(s) after firing" ); - - cb.disable(); - strictEqual( cb.has(), false, "disabled() list has no callback functions (returns false)" ); - strictEqual( cb.has(getA), false, "Check for a specific function in a disabled() list" ); - - cb = jQuery.Callbacks("unique"); - cb.add(getA); - cb.add(getA); - strictEqual( cb.has(), true, "Check if unique list has callback function(s) attached" ); - cb.lock(); - strictEqual( cb.has(), false, "locked() list is empty and returns false" ); - - -}); - -test( "jQuery.Callbacks() - adding a string doesn't cause a stack overflow", function() { - - expect( 1 ); - - jQuery.Callbacks().add( "hello world" ); - - ok( true, "no stack overflow" ); -}); diff --git a/book/bower_components/jquery/test/unit/core.js b/book/bower_components/jquery/test/unit/core.js deleted file mode 100644 index 20e1178d..00000000 --- a/book/bower_components/jquery/test/unit/core.js +++ /dev/null @@ -1,1360 +0,0 @@ -module("core", { teardown: moduleTeardown }); - -test("Unit Testing Environment", function () { - expect(2); - ok( hasPHP, "Running in an environment with PHP support. The AJAX tests only run if the environment supports PHP!" ); - ok( !isLocal, "Unit tests are not ran from file:// (especially in Chrome. If you must test from file:// with Chrome, run it with the --allow-file-access-from-files flag!)" ); -}); - -test("Basic requirements", function() { - expect(7); - ok( Array.prototype.push, "Array.push()" ); - ok( Function.prototype.apply, "Function.apply()" ); - ok( document.getElementById, "getElementById" ); - ok( document.getElementsByTagName, "getElementsByTagName" ); - ok( RegExp, "RegExp" ); - ok( jQuery, "jQuery" ); - ok( $, "$" ); -}); - -testIframeWithCallback( "Conditional compilation compatibility (#13274)", "core/cc_on.html", function( cc_on, errors, $ ) { - expect( 3 ); - ok( true, "JScript conditional compilation " + ( cc_on ? "supported" : "not supported" ) ); - deepEqual( errors, [], "No errors" ); - ok( $(), "jQuery executes" ); -}); - -test("jQuery()", function() { - - var elem, i, - obj = jQuery("div"), - code = jQuery(""), - img = jQuery(""), - div = jQuery("

              "), - exec = false, - lng = "", - expected = 22, - attrObj = { - "text": "test", - "class": "test2", - "id": "test3" - }; - - // The $(html, props) signature can stealth-call any $.fn method, check for a - // few here but beware of modular builds where these methods may be excluded. - if ( jQuery.fn.click ) { - expected++; - attrObj["click"] = function() { ok( exec, "Click executed." ); }; - } - if ( jQuery.fn.width ) { - expected++; - attrObj["width"] = 10; - } - if ( jQuery.fn.offset ) { - expected++; - attrObj["offset"] = { "top": 1, "left": 1 }; - } - if ( jQuery.fn.css ) { - expected += 2; - attrObj["css"] = { "paddingLeft": 1, "paddingRight": 1 }; - } - if ( jQuery.fn.attr ) { - expected++; - attrObj.attr = { "desired": "very" }; - } - - expect( expected ); - - // Basic constructor's behavior - equal( jQuery().length, 0, "jQuery() === jQuery([])" ); - equal( jQuery(undefined).length, 0, "jQuery(undefined) === jQuery([])" ); - equal( jQuery(null).length, 0, "jQuery(null) === jQuery([])" ); - equal( jQuery("").length, 0, "jQuery('') === jQuery([])" ); - equal( jQuery("#").length, 0, "jQuery('#') === jQuery([])" ); - - equal( jQuery(obj).selector, "div", "jQuery(jQueryObj) == jQueryObj" ); - - // can actually yield more than one, when iframes are included, the window is an array as well - equal( jQuery(window).length, 1, "Correct number of elements generated for jQuery(window)" ); - -/* - // disabled since this test was doing nothing. i tried to fix it but i'm not sure - // what the expected behavior should even be. FF returns "\n" for the text node - // make sure this is handled - var crlfContainer = jQuery('

              \r\n

              '); - var x = crlfContainer.contents().get(0).nodeValue; - equal( x, what???, "Check for \\r and \\n in jQuery()" ); -*/ - - /* // Disabled until we add this functionality in - var pass = true; - try { - jQuery("
              Testing
              ").appendTo(document.getElementById("iframe").contentDocument.body); - } catch(e){ - pass = false; - } - ok( pass, "jQuery('<tag>') needs optional document parameter to ease cross-frame DOM wrangling, see #968" );*/ - - equal( code.length, 1, "Correct number of elements generated for code" ); - equal( code.parent().length, 0, "Make sure that the generated HTML has no parent." ); - - equal( img.length, 1, "Correct number of elements generated for img" ); - equal( img.parent().length, 0, "Make sure that the generated HTML has no parent." ); - - equal( div.length, 4, "Correct number of elements generated for div hr code b" ); - equal( div.parent().length, 0, "Make sure that the generated HTML has no parent." ); - - equal( jQuery([1,2,3]).get(1), 2, "Test passing an array to the factory" ); - - equal( jQuery(document.body).get(0), jQuery("body").get(0), "Test passing an html node to the factory" ); - - elem = jQuery(" hello")[0]; - equal( elem.nodeName.toLowerCase(), "em", "leading space" ); - - elem = jQuery("\n\nworld")[0]; - equal( elem.nodeName.toLowerCase(), "em", "leading newlines" ); - - elem = jQuery("
              ", attrObj ); - - if ( jQuery.fn.width ) { - equal( elem[0].style.width, "10px", "jQuery() quick setter width"); - } - - if ( jQuery.fn.offset ) { - equal( elem[0].style.top, "1px", "jQuery() quick setter offset"); - } - - if ( jQuery.fn.css ) { - equal( elem[0].style.paddingLeft, "1px", "jQuery quick setter css"); - equal( elem[0].style.paddingRight, "1px", "jQuery quick setter css"); - } - - if ( jQuery.fn.attr ) { - equal( elem[0].getAttribute("desired"), "very", "jQuery quick setter attr"); - } - - equal( elem[0].childNodes.length, 1, "jQuery quick setter text"); - equal( elem[0].firstChild.nodeValue, "test", "jQuery quick setter text"); - equal( elem[0].className, "test2", "jQuery() quick setter class"); - equal( elem[0].id, "test3", "jQuery() quick setter id"); - - exec = true; - elem.trigger("click"); - - // manually clean up detached elements - elem.remove(); - - for ( i = 0; i < 3; ++i ) { - elem = jQuery(""); - } - equal( elem[0].defaultValue, "TEST", "Ensure cached nodes are cloned properly (Bug #6655)" ); - - // manually clean up detached elements - elem.remove(); - - for ( i = 0; i < 128; i++ ) { - lng += "12345678"; - } -}); - -test("jQuery(selector, context)", function() { - expect(3); - deepEqual( jQuery("div p", "#qunit-fixture").get(), q("sndp", "en", "sap"), "Basic selector with string as context" ); - deepEqual( jQuery("div p", q("qunit-fixture")[0]).get(), q("sndp", "en", "sap"), "Basic selector with element as context" ); - deepEqual( jQuery("div p", jQuery("#qunit-fixture")).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" ); -}); - -test( "selector state", function() { - expect( 18 ); - - var test; - - test = jQuery( undefined ); - equal( test.selector, "", "Empty jQuery Selector" ); - equal( test.context, undefined, "Empty jQuery Context" ); - - test = jQuery( document ); - equal( test.selector, "", "Document Selector" ); - equal( test.context, document, "Document Context" ); - - test = jQuery( document.body ); - equal( test.selector, "", "Body Selector" ); - equal( test.context, document.body, "Body Context" ); - - test = jQuery("#qunit-fixture"); - equal( test.selector, "#qunit-fixture", "#qunit-fixture Selector" ); - equal( test.context, document, "#qunit-fixture Context" ); - - test = jQuery("#notfoundnono"); - equal( test.selector, "#notfoundnono", "#notfoundnono Selector" ); - equal( test.context, document, "#notfoundnono Context" ); - - test = jQuery( "#qunit-fixture", document ); - equal( test.selector, "#qunit-fixture", "#qunit-fixture Selector" ); - equal( test.context, document, "#qunit-fixture Context" ); - - test = jQuery( "#qunit-fixture", document.body ); - equal( test.selector, "#qunit-fixture", "#qunit-fixture Selector" ); - equal( test.context, document.body, "#qunit-fixture Context" ); - - // Test cloning - test = jQuery( test ); - equal( test.selector, "#qunit-fixture", "#qunit-fixture Selector" ); - equal( test.context, document.body, "#qunit-fixture Context" ); - - test = jQuery( document.body ).find("#qunit-fixture"); - equal( test.selector, "#qunit-fixture", "#qunit-fixture find Selector" ); - equal( test.context, document.body, "#qunit-fixture find Context" ); -}); - -test( "globalEval", function() { - expect( 3 ); - Globals.register("globalEvalTest"); - - jQuery.globalEval("globalEvalTest = 1;"); - equal( window.globalEvalTest, 1, "Test variable assignments are global" ); - - jQuery.globalEval("var globalEvalTest = 2;"); - equal( window.globalEvalTest, 2, "Test variable declarations are global" ); - - jQuery.globalEval("this.globalEvalTest = 3;"); - equal( window.globalEvalTest, 3, "Test context (this) is the window object" ); -}); - -test("noConflict", function() { - expect(7); - - var $$ = jQuery; - - strictEqual( jQuery, jQuery.noConflict(), "noConflict returned the jQuery object" ); - strictEqual( window["jQuery"], $$, "Make sure jQuery wasn't touched." ); - strictEqual( window["$"], original$, "Make sure $ was reverted." ); - - jQuery = $ = $$; - - strictEqual( jQuery.noConflict(true), $$, "noConflict returned the jQuery object" ); - strictEqual( window["jQuery"], originaljQuery, "Make sure jQuery was reverted." ); - strictEqual( window["$"], original$, "Make sure $ was reverted." ); - ok( $$().pushStack([]), "Make sure that jQuery still works." ); - - window["jQuery"] = jQuery = $$; -}); - -test("trim", function() { - expect(13); - - var nbsp = String.fromCharCode(160); - - equal( jQuery.trim("hello "), "hello", "trailing space" ); - equal( jQuery.trim(" hello"), "hello", "leading space" ); - equal( jQuery.trim(" hello "), "hello", "space on both sides" ); - equal( jQuery.trim(" " + nbsp + "hello " + nbsp + " "), "hello", " " ); - - equal( jQuery.trim(), "", "Nothing in." ); - equal( jQuery.trim( undefined ), "", "Undefined" ); - equal( jQuery.trim( null ), "", "Null" ); - equal( jQuery.trim( 5 ), "5", "Number" ); - equal( jQuery.trim( false ), "false", "Boolean" ); - - equal( jQuery.trim(" "), "", "space should be trimmed" ); - equal( jQuery.trim("ipad\xA0"), "ipad", "nbsp should be trimmed" ); - equal( jQuery.trim("\uFEFF"), "", "zwsp should be trimmed" ); - equal( jQuery.trim("\uFEFF \xA0! | \uFEFF"), "! |", "leading/trailing should be trimmed" ); -}); - -test("type", function() { - expect( 28 ); - - equal( jQuery.type(null), "null", "null" ); - equal( jQuery.type(undefined), "undefined", "undefined" ); - equal( jQuery.type(true), "boolean", "Boolean" ); - equal( jQuery.type(false), "boolean", "Boolean" ); - equal( jQuery.type(Boolean(true)), "boolean", "Boolean" ); - equal( jQuery.type(0), "number", "Number" ); - equal( jQuery.type(1), "number", "Number" ); - equal( jQuery.type(Number(1)), "number", "Number" ); - equal( jQuery.type(""), "string", "String" ); - equal( jQuery.type("a"), "string", "String" ); - equal( jQuery.type(String("a")), "string", "String" ); - equal( jQuery.type({}), "object", "Object" ); - equal( jQuery.type(/foo/), "regexp", "RegExp" ); - equal( jQuery.type(new RegExp("asdf")), "regexp", "RegExp" ); - equal( jQuery.type([1]), "array", "Array" ); - equal( jQuery.type(new Date()), "date", "Date" ); - equal( jQuery.type(new Function("return;")), "function", "Function" ); - equal( jQuery.type(function(){}), "function", "Function" ); - equal( jQuery.type(new Error()), "error", "Error" ); - equal( jQuery.type(window), "object", "Window" ); - equal( jQuery.type(document), "object", "Document" ); - equal( jQuery.type(document.body), "object", "Element" ); - equal( jQuery.type(document.createTextNode("foo")), "object", "TextNode" ); - equal( jQuery.type(document.getElementsByTagName("*")), "object", "NodeList" ); - - // Avoid Lint complaints - var MyString = String, - MyNumber = Number, - MyBoolean = Boolean, - MyObject = Object; - equal( jQuery.type(new MyBoolean(true)), "boolean", "Boolean" ); - equal( jQuery.type(new MyNumber(1)), "number", "Number" ); - equal( jQuery.type(new MyString("a")), "string", "String" ); - equal( jQuery.type(new MyObject()), "object", "Object" ); -}); - -asyncTest("isPlainObject", function() { - expect(16); - - var pass, iframe, doc, - fn = function() {}; - - // The use case that we want to match - ok( jQuery.isPlainObject({}), "{}" ); - - // Not objects shouldn't be matched - ok( !jQuery.isPlainObject(""), "string" ); - ok( !jQuery.isPlainObject(0) && !jQuery.isPlainObject(1), "number" ); - ok( !jQuery.isPlainObject(true) && !jQuery.isPlainObject(false), "boolean" ); - ok( !jQuery.isPlainObject(null), "null" ); - ok( !jQuery.isPlainObject(undefined), "undefined" ); - - // Arrays shouldn't be matched - ok( !jQuery.isPlainObject([]), "array" ); - - // Instantiated objects shouldn't be matched - ok( !jQuery.isPlainObject(new Date()), "new Date" ); - - // Functions shouldn't be matched - ok( !jQuery.isPlainObject(fn), "fn" ); - - // Again, instantiated objects shouldn't be matched - ok( !jQuery.isPlainObject(new fn()), "new fn (no methods)" ); - - // Makes the function a little more realistic - // (and harder to detect, incidentally) - fn.prototype["someMethod"] = function(){}; - - // Again, instantiated objects shouldn't be matched - ok( !jQuery.isPlainObject(new fn()), "new fn" ); - - // Make it even harder to detect in IE < 9 - fn = function() { - this.a = "a"; - }; - fn.prototype = { - b: "b" - }; - - ok( !jQuery.isPlainObject(new fn()), "fn (inherited and own properties)"); - - // DOM Element - ok( !jQuery.isPlainObject( document.createElement("div") ), "DOM Element" ); - - // Window - ok( !jQuery.isPlainObject( window ), "window" ); - - pass = false; - try { - jQuery.isPlainObject( window.location ); - pass = true; - } catch ( e ) {} - ok( pass, "Does not throw exceptions on host objects" ); - - // Objects from other windows should be matched - window.iframeCallback = function( otherObject, detail ) { - window.iframeCallback = undefined; - iframe.parentNode.removeChild( iframe ); - ok( jQuery.isPlainObject(new otherObject()), "new otherObject" + ( detail ? " - " + detail : "" ) ); - start(); - }; - - try { - iframe = jQuery("#qunit-fixture")[0].appendChild( document.createElement("iframe") ); - doc = iframe.contentDocument || iframe.contentWindow.document; - doc.open(); - doc.write(""); - doc.close(); - } catch(e) { - window.iframeDone( Object, "iframes not supported" ); - } -}); - -test("isFunction", function() { - expect(19); - - var mystr, myarr, myfunction, fn, obj, nodes, first, input, a; - - // Make sure that false values return false - ok( !jQuery.isFunction(), "No Value" ); - ok( !jQuery.isFunction( null ), "null Value" ); - ok( !jQuery.isFunction( undefined ), "undefined Value" ); - ok( !jQuery.isFunction( "" ), "Empty String Value" ); - ok( !jQuery.isFunction( 0 ), "0 Value" ); - - // Check built-ins - // Safari uses "(Internal Function)" - ok( jQuery.isFunction(String), "String Function("+String+")" ); - ok( jQuery.isFunction(Array), "Array Function("+Array+")" ); - ok( jQuery.isFunction(Object), "Object Function("+Object+")" ); - ok( jQuery.isFunction(Function), "Function Function("+Function+")" ); - - // When stringified, this could be misinterpreted - mystr = "function"; - ok( !jQuery.isFunction(mystr), "Function String" ); - - // When stringified, this could be misinterpreted - myarr = [ "function" ]; - ok( !jQuery.isFunction(myarr), "Function Array" ); - - // When stringified, this could be misinterpreted - myfunction = { "function": "test" }; - ok( !jQuery.isFunction(myfunction), "Function Object" ); - - // Make sure normal functions still work - fn = function(){}; - ok( jQuery.isFunction(fn), "Normal Function" ); - - obj = document.createElement("object"); - - // Firefox says this is a function - ok( !jQuery.isFunction(obj), "Object Element" ); - - // IE says this is an object - // Since 1.3, this isn't supported (#2968) - //ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" ); - - nodes = document.body.childNodes; - - // Safari says this is a function - ok( !jQuery.isFunction(nodes), "childNodes Property" ); - - first = document.body.firstChild; - - // Normal elements are reported ok everywhere - ok( !jQuery.isFunction(first), "A normal DOM Element" ); - - input = document.createElement("input"); - input.type = "text"; - document.body.appendChild( input ); - - // IE says this is an object - // Since 1.3, this isn't supported (#2968) - //ok( jQuery.isFunction(input.focus), "A default function property" ); - - document.body.removeChild( input ); - - a = document.createElement("a"); - a.href = "some-function"; - document.body.appendChild( a ); - - // This serializes with the word 'function' in it - ok( !jQuery.isFunction(a), "Anchor Element" ); - - document.body.removeChild( a ); - - // Recursive function calls have lengths and array-like properties - function callme(callback){ - function fn(response){ - callback(response); - } - - ok( jQuery.isFunction(fn), "Recursive Function Call" ); - - fn({ some: "data" }); - } - - callme(function(){ - callme(function(){}); - }); -}); - -test( "isNumeric", function() { - expect( 36 ); - - var t = jQuery.isNumeric, - Traditionalists = /** @constructor */ function(n) { - this.value = n; - this.toString = function(){ - return String(this.value); - }; - }, - answer = new Traditionalists( "42" ), - rong = new Traditionalists( "Devo" ); - - ok( t("-10"), "Negative integer string"); - ok( t("0"), "Zero string"); - ok( t("5"), "Positive integer string"); - ok( t(-16), "Negative integer number"); - ok( t(0), "Zero integer number"); - ok( t(32), "Positive integer number"); - ok( t("040"), "Octal integer literal string"); - // OctalIntegerLiteral has been deprecated since ES3/1999 - // It doesn't pass lint, so disabling until a solution can be found - //ok( t(0144), "Octal integer literal"); - ok( t("0xFF"), "Hexadecimal integer literal string"); - ok( t(0xFFF), "Hexadecimal integer literal"); - ok( t("-1.6"), "Negative floating point string"); - ok( t("4.536"), "Positive floating point string"); - ok( t(-2.6), "Negative floating point number"); - ok( t(3.1415), "Positive floating point number"); - ok( t(8e5), "Exponential notation"); - ok( t("123e-2"), "Exponential notation string"); - ok( t(answer), "Custom .toString returning number"); - equal( t(""), false, "Empty string"); - equal( t(" "), false, "Whitespace characters string"); - equal( t("\t\t"), false, "Tab characters string"); - equal( t("abcdefghijklm1234567890"), false, "Alphanumeric character string"); - equal( t("xabcdefx"), false, "Non-numeric character string"); - equal( t(true), false, "Boolean true literal"); - equal( t(false), false, "Boolean false literal"); - equal( t("bcfed5.2"), false, "Number with preceding non-numeric characters"); - equal( t("7.2acdgs"), false, "Number with trailling non-numeric characters"); - equal( t(undefined), false, "Undefined value"); - equal( t(null), false, "Null value"); - equal( t(NaN), false, "NaN value"); - equal( t(Infinity), false, "Infinity primitive"); - equal( t(Number.POSITIVE_INFINITY), false, "Positive Infinity"); - equal( t(Number.NEGATIVE_INFINITY), false, "Negative Infinity"); - equal( t(rong), false, "Custom .toString returning non-number"); - equal( t({}), false, "Empty object"); - equal( t(function(){} ), false, "Instance of a function"); - equal( t( new Date() ), false, "Instance of a Date"); - equal( t(function(){} ), false, "Instance of a function"); -}); - -test("isXMLDoc - HTML", function() { - expect(4); - - ok( !jQuery.isXMLDoc( document ), "HTML document" ); - ok( !jQuery.isXMLDoc( document.documentElement ), "HTML documentElement" ); - ok( !jQuery.isXMLDoc( document.body ), "HTML Body Element" ); - - var body, - iframe = document.createElement("iframe"); - document.body.appendChild( iframe ); - - try { - body = jQuery(iframe).contents()[0]; - - try { - ok( !jQuery.isXMLDoc( body ), "Iframe body element" ); - } catch(e) { - ok( false, "Iframe body element exception" ); - } - - } catch(e) { - ok( true, "Iframe body element - iframe not working correctly" ); - } - - document.body.removeChild( iframe ); -}); - -test("XSS via location.hash", function() { - expect(1); - - stop(); - jQuery["_check9521"] = function(x){ - ok( x, "script called from #id-like selector with inline handler" ); - jQuery("#check9521").remove(); - delete jQuery["_check9521"]; - start(); - }; - try { - // This throws an error because it's processed like an id - jQuery( "#" ).appendTo("#qunit-fixture"); - } catch (err) { - jQuery["_check9521"](true); - } -}); - -test("isXMLDoc - XML", function() { - expect(3); - var xml = createDashboardXML(); - ok( jQuery.isXMLDoc( xml ), "XML document" ); - ok( jQuery.isXMLDoc( xml.documentElement ), "XML documentElement" ); - ok( jQuery.isXMLDoc( jQuery("tab", xml)[0] ), "XML Tab Element" ); -}); - -test("isWindow", function() { - expect( 14 ); - - ok( jQuery.isWindow(window), "window" ); - ok( jQuery.isWindow(document.getElementsByTagName("iframe")[0].contentWindow), "iframe.contentWindow" ); - ok( !jQuery.isWindow(), "empty" ); - ok( !jQuery.isWindow(null), "null" ); - ok( !jQuery.isWindow(undefined), "undefined" ); - ok( !jQuery.isWindow(document), "document" ); - ok( !jQuery.isWindow(document.documentElement), "documentElement" ); - ok( !jQuery.isWindow(""), "string" ); - ok( !jQuery.isWindow(1), "number" ); - ok( !jQuery.isWindow(true), "boolean" ); - ok( !jQuery.isWindow({}), "object" ); - ok( !jQuery.isWindow({ setInterval: function(){} }), "fake window" ); - ok( !jQuery.isWindow(/window/), "regexp" ); - ok( !jQuery.isWindow(function(){}), "function" ); -}); - -test("jQuery('html')", function() { - expect( 15 ); - - var s, div, j; - - QUnit.reset(); - jQuery["foo"] = false; - s = jQuery("")[0]; - ok( s, "Creating a script" ); - ok( !jQuery["foo"], "Make sure the script wasn't executed prematurely" ); - jQuery("body").append(""); - ok( jQuery["foo"], "Executing a scripts contents in the right context" ); - - // Test multi-line HTML - div = jQuery("
              \r\nsome text\n

              some p

              \nmore text\r\n
              ")[0]; - equal( div.nodeName.toUpperCase(), "DIV", "Make sure we're getting a div." ); - equal( div.firstChild.nodeType, 3, "Text node." ); - equal( div.lastChild.nodeType, 3, "Text node." ); - equal( div.childNodes[1].nodeType, 1, "Paragraph." ); - equal( div.childNodes[1].firstChild.nodeType, 3, "Paragraph text." ); - - QUnit.reset(); - ok( jQuery("")[0], "Creating a link" ); - - ok( !jQuery(""; - equal( jQuery.parseHTML( html ).length, 0, "Ignore scripts by default" ); - equal( jQuery.parseHTML( html, true )[0].nodeName.toLowerCase(), "script", "Preserve scripts when requested" ); - - html += "
              "; - equal( jQuery.parseHTML( html )[0].nodeName.toLowerCase(), "div", "Preserve non-script nodes" ); - equal( jQuery.parseHTML( html, true )[0].nodeName.toLowerCase(), "script", "Preserve script position"); - - equal( jQuery.parseHTML("text")[0].nodeType, 3, "Parsing text returns a text node" ); - equal( jQuery.parseHTML( "\t
              " )[0].nodeValue, "\t", "Preserve leading whitespace" ); - - equal( jQuery.parseHTML("
              ")[0].nodeType, 3, "Leading spaces are treated as text nodes (#11290)" ); - - html = jQuery.parseHTML( "
              test div
              " ); - equal( html[ 0 ].parentNode.nodeType, 11, "parentNode should be documentFragment" ); - equal( html[ 0 ].innerHTML, "test div", "Content should be preserved" ); - - equal( jQuery.parseHTML("").length, 1, "Incorrect html-strings should not break anything" ); - equal( jQuery.parseHTML("")[ 1 ].parentNode.nodeType, 11, "parentNode should be documentFragment" ); -}); - -test("jQuery.parseJSON", function(){ - expect( 9 ); - - equal( jQuery.parseJSON( null ), null, "Actual null returns null" ); - equal( jQuery.isEmptyObject( jQuery.parseJSON("{}") ), true, "Empty object returns empty object" ); - deepEqual( jQuery.parseJSON("{\"test\":1}"), { "test": 1 }, "Plain object parses" ); - deepEqual( jQuery.parseJSON("\n{\"test\":1}"), { "test": 1 }, "Leading whitespaces are ignored." ); - raises(function() { - jQuery.parseJSON(); - }, null, "Undefined raises an error" ); - raises( function() { - jQuery.parseJSON( "" ); - }, null, "Empty string raises an error" ); - raises(function() { - jQuery.parseJSON("''"); - }, null, "Single-quoted string raises an error" ); - raises(function() { - jQuery.parseJSON("{a:1}"); - }, null, "Unquoted property raises an error" ); - raises(function() { - jQuery.parseJSON("{'a':1}"); - }, null, "Single-quoted property raises an error" ); -}); - -test("jQuery.parseXML", 8, function(){ - var xml, tmp; - try { - xml = jQuery.parseXML( "

              A well-formed xml string

              " ); - tmp = xml.getElementsByTagName( "p" )[ 0 ]; - ok( !!tmp, "

              present in document" ); - tmp = tmp.getElementsByTagName( "b" )[ 0 ]; - ok( !!tmp, " present in document" ); - strictEqual( tmp.childNodes[ 0 ].nodeValue, "well-formed", " text is as expected" ); - } catch (e) { - strictEqual( e, undefined, "unexpected error" ); - } - try { - xml = jQuery.parseXML( "

              Not a <well-formed xml string

              " ); - ok( false, "invalid xml not detected" ); - } catch( e ) { - strictEqual( e.message, "Invalid XML:

              Not a <well-formed xml string

              ", "invalid xml detected" ); - } - try { - xml = jQuery.parseXML( "" ); - strictEqual( xml, null, "empty string => null document" ); - xml = jQuery.parseXML(); - strictEqual( xml, null, "undefined string => null document" ); - xml = jQuery.parseXML( null ); - strictEqual( xml, null, "null string => null document" ); - xml = jQuery.parseXML( true ); - strictEqual( xml, null, "non-string => null document" ); - } catch( e ) { - ok( false, "empty input throws exception" ); - } -}); - -test("jQuery.camelCase()", function() { - - var tests = { - "foo-bar": "fooBar", - "foo-bar-baz": "fooBarBaz", - "girl-u-want": "girlUWant", - "the-4th-dimension": "the4thDimension", - "-o-tannenbaum": "OTannenbaum", - "-moz-illa": "MozIlla", - "-ms-take": "msTake" - }; - - expect(7); - - jQuery.each( tests, function( key, val ) { - equal( jQuery.camelCase( key ), val, "Converts: " + key + " => " + val ); - }); -}); diff --git a/book/bower_components/jquery/test/unit/css.js b/book/bower_components/jquery/test/unit/css.js deleted file mode 100644 index 30082155..00000000 --- a/book/bower_components/jquery/test/unit/css.js +++ /dev/null @@ -1,1056 +0,0 @@ -if ( jQuery.css ) { - -module("css", { teardown: moduleTeardown }); - -test("css(String|Hash)", function() { - expect( 41 ); - - equal( jQuery("#qunit-fixture").css("display"), "block", "Check for css property \"display\"" ); - - var $child, div, div2, width, height, child, prctval, checkval, old; - - $child = jQuery("#nothiddendivchild").css({ "width": "20%", "height": "20%" }); - notEqual( $child.css("width"), "20px", "Retrieving a width percentage on the child of a hidden div returns percentage" ); - notEqual( $child.css("height"), "20px", "Retrieving a height percentage on the child of a hidden div returns percentage" ); - - div = jQuery( "
              " ); - - // These should be "auto" (or some better value) - // temporarily provide "0px" for backwards compat - equal( div.css("width"), "0px", "Width on disconnected node." ); - equal( div.css("height"), "0px", "Height on disconnected node." ); - - div.css({ "width": 4, "height": 4 }); - - equal( div.css("width"), "4px", "Width on disconnected node." ); - equal( div.css("height"), "4px", "Height on disconnected node." ); - - div2 = jQuery( "
              "); - clone = element.clone(); - equal( clone[ 0 ].defaultValue, "foo", "Textarea defaultValue cloned correctly" ); -}); - -test( "clone(multiple selected options) (Bug #8129)", function() { - - expect( 1 ); - - var element = jQuery(""); - - equal( element.clone().find("option:selected").length, element.find("option:selected").length, "Multiple selected options cloned correctly" ); - -}); - -test( "clone() on XML nodes", function() { - - expect( 2 ); - - var xml = createDashboardXML(), - root = jQuery(xml.documentElement).clone(), - origTab = jQuery("tab", xml).eq( 0 ), - cloneTab = jQuery("tab", root).eq( 0 ); - - origTab.text("origval"); - cloneTab.text("cloneval"); - equal( origTab.text(), "origval", "Check original XML node was correctly set" ); - equal( cloneTab.text(), "cloneval", "Check cloned XML node was correctly set" ); -}); - -test( "clone() on local XML nodes with html5 nodename", function() { - - expect( 2 ); - - var $xmlDoc = jQuery( jQuery.parseXML( "" ) ), - $meter = $xmlDoc.find( "meter" ).clone(); - - equal( $meter[ 0 ].nodeName, "meter", "Check if nodeName was not changed due to cloning" ); - equal( $meter[ 0 ].nodeType, 1, "Check if nodeType is not changed due to cloning" ); -}); - -test( "html(undefined)", function() { - - expect( 1 ); - - equal( jQuery("#foo").html("test").html(undefined).html().toLowerCase(), "test", ".html(undefined) is chainable (#5571)" ); -}); - -test( "html() on empty set", function() { - - expect( 1 ); - - strictEqual( jQuery().html(), undefined, ".html() returns undefined for empty sets (#11962)" ); -}); - -function childNodeNames( node ) { - return jQuery.map( node.childNodes, function( child ) { - return child.nodeName.toUpperCase(); - }).join(" "); -} - -function testHtml( valueObj ) { - expect( 37 ); - - var actual, expected, tmp, - div = jQuery("
              "), - fixture = jQuery("#qunit-fixture"); - - div.html( valueObj("
              ") ); - equal( div.children().length, 2, "Found children" ); - equal( div.children().children().length, 1, "Found grandchild" ); - - actual = []; expected = []; - tmp = jQuery("").html( valueObj("area") ).each(function() { - expected.push("AREA"); - actual.push( childNodeNames( this ) ); - }); - equal( expected.length, 1, "Expecting one parent" ); - deepEqual( actual, expected, "Found the inserted area element" ); - - equal( div.html(valueObj(5)).html(), "5", "Setting a number as html" ); - equal( div.html(valueObj(0)).html(), "0", "Setting a zero as html" ); - - div.html( valueObj(" &") ); - equal( - div[ 0 ].innerHTML.replace( /\xA0/, " " ), - " &", - "Entities are passed through correctly" - ); - - tmp = "<div>hello1</div>"; - equal( div.html(valueObj(tmp) ).html().replace( />/g, ">" ), tmp, "Escaped html" ); - tmp = "x" + tmp; - equal( div.html(valueObj( tmp )).html().replace( />/g, ">" ), tmp, "Escaped html, leading x" ); - tmp = " " + tmp.slice( 1 ); - equal( div.html(valueObj( tmp )).html().replace( />/g, ">" ), tmp, "Escaped html, leading space" ); - - actual = []; expected = []; tmp = {}; - jQuery("#nonnodes").contents().html( valueObj("bold") ).each(function() { - var html = jQuery( this ).html(); - tmp[ this.nodeType ] = true; - expected.push( this.nodeType === 1 ? "bold" : undefined ); - actual.push( html ? html.toLowerCase() : html ); - }); - deepEqual( actual, expected, "Set containing element, text node, comment" ); - ok( tmp[ 1 ], "element" ); - ok( tmp[ 3 ], "text node" ); - ok( tmp[ 8 ], "comment" ); - - actual = []; expected = []; - fixture.children("div").html( valueObj("test") ).each(function() { - expected.push("B"); - actual.push( childNodeNames( this ) ); - }); - equal( expected.length, 7, "Expecting many parents" ); - deepEqual( actual, expected, "Correct childNodes after setting HTML" ); - - actual = []; expected = []; - fixture.html( valueObj("") ).each(function() { - expected.push("STYLE"); - actual.push( childNodeNames( this ) ); - }); - equal( expected.length, 1, "Expecting one parent" ); - deepEqual( actual, expected, "Found the inserted style element" ); - - fixture.html( valueObj("", {} ); - ok( true, "Does not allow attribute object to be treated like a doc object" ); - } catch ( e ) {} -}); - -test( "jQuery.clone - no exceptions for object elements #9587", function() { - - expect( 1 ); - - try { - jQuery("#no-clone-exception").clone(); - ok( true, "cloned with no exceptions" ); - } catch( e ) { - ok( false, e.message ); - } -}); - -test( "Cloned, detached HTML5 elems (#10667,10670)", function() { - - expect( 7 ); - - var $clone, - $section = jQuery( "
              " ).appendTo( "#qunit-fixture" ); - - // First clone - $clone = $section.clone(); - - // Infer that the test is being run in IE<=8 - if ( $clone[ 0 ].outerHTML && !jQuery.support.opacity ) { - // This branch tests cloning nodes by reading the outerHTML, used only in IE<=8 - equal( $clone[ 0 ].outerHTML, "
              ", "detached clone outerHTML matches '
              '" ); - } else { - // This branch tests a known behaviour in modern browsers that should never fail. - // Included for expected test count symmetry (expecting 1) - equal( $clone[ 0 ].nodeName, "SECTION", "detached clone nodeName matches 'SECTION' in modern browsers" ); - } - - // Bind an event - $section.on( "click", function() { - ok( true, "clone fired event" ); - }); - - // Second clone (will have an event bound) - $clone = $section.clone( true ); - - // Trigger an event from the first clone - $clone.trigger("click"); - $clone.off("click"); - - // Add a child node with text to the original - $section.append("

              Hello

              "); - - // Third clone (will have child node and text) - $clone = $section.clone( true ); - - equal( $clone.find("p").text(), "Hello", "Assert text in child of clone" ); - - // Trigger an event from the third clone - $clone.trigger("click"); - $clone.off("click"); - - // Add attributes to copy - $section.attr({ - "class": "foo bar baz", - "title": "This is a title" - }); - - // Fourth clone (will have newly added attributes) - $clone = $section.clone( true ); - - equal( $clone.attr("class"), $section.attr("class"), "clone and element have same class attribute" ); - equal( $clone.attr("title"), $section.attr("title"), "clone and element have same title attribute" ); - - // Remove the original - $section.remove(); - - // Clone the clone - $section = $clone.clone( true ); - - // Remove the clone - $clone.remove(); - - // Trigger an event from the clone of the clone - $section.trigger("click"); - - // Unbind any remaining events - $section.off("click"); - $clone.off("click"); -}); - -test( "Guard against exceptions when clearing safeChildNodes", function() { - - expect( 1 ); - - var div; - - try { - div = jQuery("

              "); - } catch(e) {} - - ok( div && div.jquery, "Created nodes safely, guarded against exceptions on safeChildNodes[ -1 ]" ); -}); - -test( "Ensure oldIE creates a new set on appendTo (#8894)", function() { - - expect( 5 ); - - strictEqual( jQuery("
              ").clone().addClass("test").appendTo("
              ").end().end().hasClass("test"), false, "Check jQuery.fn.appendTo after jQuery.clone" ); - strictEqual( jQuery("
              ").find("p").end().addClass("test").appendTo("
              ").end().end().hasClass("test"), false, "Check jQuery.fn.appendTo after jQuery.fn.find" ); - strictEqual( jQuery("
              ").text("test").addClass("test").appendTo("
              ").end().end().hasClass("test"), false, "Check jQuery.fn.appendTo after jQuery.fn.text" ); - strictEqual( jQuery("").clone().addClass("test").appendTo("
              ").end().end().hasClass("test"), false, "Check jQuery.fn.appendTo after clone html5 element" ); - strictEqual( jQuery("

              ").appendTo("

              ").end().length, jQuery("

              test

              ").appendTo("
              ").end().length, "Elements created with createElement and with createDocumentFragment should be treated alike" ); -}); - -test( "html() - script exceptions bubble (#11743)", function() { - - expect( 2 ); - - raises(function() { - jQuery("#qunit-fixture").html(""); - ok( false, "Exception ignored" ); - }, "Exception bubbled from inline script" ); - - if ( jQuery.ajax ) { - raises(function() { - jQuery("#qunit-fixture").html(""); - ok( false, "Exception ignored" ); - }, "Exception thrown in remote script" ); - } else { - ok( true, "No jQuery.ajax" ); - } -}); - -test( "checked state is cloned with clone()", function() { - - expect( 2 ); - - var elem = jQuery.parseHTML("")[ 0 ]; - elem.checked = false; - equal( jQuery(elem).clone().attr("id","clone")[ 0 ].checked, false, "Checked false state correctly cloned" ); - - elem = jQuery.parseHTML("")[ 0 ]; - elem.checked = true; - equal( jQuery(elem).clone().attr("id","clone")[ 0 ].checked, true, "Checked true state correctly cloned" ); -}); - -test( "manipulate mixed jQuery and text (#12384, #12346)", function() { - - expect( 2 ); - - var div = jQuery("
              a
              ").append( " ", jQuery("b"), " ", jQuery("c") ), - nbsp = String.fromCharCode( 160 ); - - equal( div.text(), "a" + nbsp + "b" + nbsp+ "c", "Appending mixed jQuery with text nodes" ); - - div = jQuery("
              ") - .find("div") - .after( "

              a

              ", "

              b

              " ) - .parent(); - equal( div.find("*").length, 3, "added 2 paragraphs after inner div" ); -}); - -testIframeWithCallback( "buildFragment works even if document[0] is iframe's window object in IE9/10 (#12266)", "manipulation/iframe-denied.html", function( test ) { - expect( 1 ); - - ok( test.status, test.description ); -}); - -test( "script evaluation (#11795)", function() { - - expect( 13 ); - - var scriptsIn, scriptsOut, - fixture = jQuery("#qunit-fixture").empty(), - objGlobal = (function() { - return this; - })(), - isOk = objGlobal.ok, - notOk = function() { - var args = arguments; - args[ 0 ] = !args[ 0 ]; - return isOk.apply( this, args ); - }; - - objGlobal.ok = notOk; - scriptsIn = jQuery([ - "", - "", - "", - "", - "
              ", - "", - "", - "", - "", - "
              " - ].join("")); - scriptsIn.appendTo( jQuery("
              ") ); - objGlobal.ok = isOk; - - scriptsOut = fixture.append( scriptsIn ).find("script"); - equal( scriptsOut[ 0 ].type, "something/else", "Non-evaluated type." ); - equal( scriptsOut[ 1 ].type, "text/javascript", "Evaluated type." ); - deepEqual( scriptsOut.get(), fixture.find("script").get(), "All script tags remain." ); - - objGlobal.ok = notOk; - scriptsOut = scriptsOut.add( scriptsOut.clone() ).appendTo( fixture.find("div") ); - deepEqual( fixture.find("div script").get(), scriptsOut.get(), "Scripts cloned without reevaluation" ); - fixture.append( scriptsOut.detach() ); - deepEqual( fixture.children("script").get(), scriptsOut.get(), "Scripts detached without reevaluation" ); - objGlobal.ok = isOk; - - if ( jQuery.ajax ) { - Globals.register("testBar"); - jQuery("#qunit-fixture").append( " - - - - - - - - - - - - - - - - - - - - diff --git a/test/spec/test.js b/test/spec/test.js deleted file mode 100644 index adfd6145..00000000 --- a/test/spec/test.js +++ /dev/null @@ -1,13 +0,0 @@ -/* global describe, it */ - -(function () { - 'use strict'; - - describe('Give it some context', function () { - describe('maybe a bit more context here', function () { - it('should run here few assertions', function () { - - }); - }); - }); -})(); diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000..ed2328eb --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,79 @@ +// todo: es6 imports +const path = require('path'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const ExtractTextPlugin = require("extract-text-webpack-plugin"); +const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); +const jshintStylish = require('jshint-stylish'); + +module.exports = { + entry: './book/scripts/index.js', + output: { + path: __dirname + '/dist', + filename: 'bundle.js', + }, + resolve: { + alias: { + shCore: require.resolve('./book/scripts/vendor/syntaxhighlighter/shCore'), + }, + }, + module: { + rules: [ + { + test: /\.js/, + exclude: [/node_modules/, /vendor/], + use: { + loader: 'jshint-loader', + options: { + reporter: jshintStylish, + }, + }, + }, + { + test: /\.html$/, + use: { + loader: 'html-loader', + options: { + attrs: ['img:src', 'link:href'], + }, + }, + }, + { + test: /\.(png|jpe?g|gif)$/, + use: 'file-loader', + }, + { + test: /\.s?css$/, + use: ExtractTextPlugin.extract({ + use: ['css-loader', 'postcss-loader', 'sass-loader'], + }), + }, + // using imports-loader for all of these modules since they can't decide + // which interface to use to mutate syntaxhighlighter + { + test: require.resolve('./book/scripts/vendor/codecode/codecode'), + use: [ + 'imports-loader?jQuery=jquery,SyntaxHighlighter=shCore', + ], + }, + { + test: require.resolve('./book/scripts/vendor/syntaxhighlighter/shCore'), + use: [ + 'exports-loader?SyntaxHighlighter', + ], + }, + { + test: require.resolve('./book/scripts/vendor/syntaxhighlighter/shBrushJScript'), + use: [ + 'imports-loader?SyntaxHighlighter=shCore', + ], + }, + ], + }, + plugins: [ + new ExtractTextPlugin('styles.css'), + new HtmlWebpackPlugin({ + template: 'book/index.html', + }), + new UglifyJSPlugin(), + ], +};