diff --git a/bower.json b/bower.json index 4cbbbe3..41309d6 100644 --- a/bower.json +++ b/bower.json @@ -3,6 +3,7 @@ "dependencies": { "foundation-sites": "*", "jquery": "*", - "components-font-awesome": "*" + "components-font-awesome": "*", + "flip": "*" } } \ No newline at end of file diff --git a/bower_components/flip/.bower.json b/bower_components/flip/.bower.json new file mode 100644 index 0000000..ed1b336 --- /dev/null +++ b/bower_components/flip/.bower.json @@ -0,0 +1,25 @@ +{ + "name": "flip", + "version": "1.1.2", + "license": "MIT", + "dependencies": { + "jquery": "~2.0" + }, + "devDependencies": { + "jquery": "~2.0" + }, + "main": [ + "dist/jquery.flip.js" + ], + "ignore": [], + "homepage": "https://github.com/nnattawat/flip", + "_release": "1.1.2", + "_resolution": { + "type": "version", + "tag": "v1.1.2", + "commit": "e5155d6e29b349205216846822eac8fe9b6426d0" + }, + "_source": "https://github.com/nnattawat/flip.git", + "_target": "*", + "_originalSource": "flip" +} \ No newline at end of file diff --git a/bower_components/flip/.bowerrc b/bower_components/flip/.bowerrc new file mode 100644 index 0000000..44491d3 --- /dev/null +++ b/bower_components/flip/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "bower_components" +} diff --git a/bower_components/flip/.gitignore b/bower_components/flip/.gitignore new file mode 100644 index 0000000..ae9f6df --- /dev/null +++ b/bower_components/flip/.gitignore @@ -0,0 +1,4 @@ +/node_modules/ +/bower_components/ +npm-debug.log +*.swp diff --git a/bower_components/flip/.jshintrc b/bower_components/flip/.jshintrc new file mode 100644 index 0000000..2896f35 --- /dev/null +++ b/bower_components/flip/.jshintrc @@ -0,0 +1,25 @@ +{ + "boss": true, + "browser": true, + "curly": true, + "devel": true, + "eqeqeq": true, + "eqnull": true, + "esversion": 5, + "expr": true, + "immed": true, + "newcap": false, + "noarg": true, + "onevar": true, + "quotmark": false, + "shadow": true, + "trailing": true, + "undef": true, + "unused": true, + "freeze": true, + "maxstatements": 30, + + "globals": { + "jQuery": false + } +} diff --git a/bower_components/flip/.travis.yml b/bower_components/flip/.travis.yml new file mode 100644 index 0000000..f6009b6 --- /dev/null +++ b/bower_components/flip/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - '0.10' +before_install: + - npm install -g grunt-cli bower +install: + - npm install + - bower install \ No newline at end of file diff --git a/bower_components/flip/CONTRIBUTING.md b/bower_components/flip/CONTRIBUTING.md new file mode 100644 index 0000000..73d2cc7 --- /dev/null +++ b/bower_components/flip/CONTRIBUTING.md @@ -0,0 +1,15 @@ +# Issue and Pull Request Guidlines + +## + +##### Be clear + * Just because you have an understanding of what you would like to address, doesnt mean its obvious. Please be clear and consise. + +##### Examples are your friend + * Probably the best way for us to get a handle on what's going on is you providing us with a short example using something like a [JSFiddle](http://jsfiddle.net/). + +##### Stick around + * If you're interested in getting your changes in and/or issue resolved, it's extremely likely you're going to have to have some discussion about it before that happens. So don't just drop something on us and leave and expect that something will come of it. + +##### Discussion before code + * If you don't want to waste your time writing code that might not be used, it's probably best to make an issue and discuss it with us first before you start writing. diff --git a/bower_components/flip/Gruntfile.js b/bower_components/flip/Gruntfile.js new file mode 100644 index 0000000..f51a543 --- /dev/null +++ b/bower_components/flip/Gruntfile.js @@ -0,0 +1,61 @@ +'use strict'; + +module.exports = function (grunt) { + // Load all grunt tasks + require('load-grunt-tasks')(grunt); + // Show elapsed time at the end + require('time-grunt')(grunt); + + // Project configuration. + grunt.initConfig({ + // Metadata. + pkg: grunt.file.readJSON('package.json'), + banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + + ' Licensed MIT */\n', + // Task configuration. + clean: { + files: ['dist'] + }, + jshint: { + options : { + jshintrc : '.jshintrc' + }, + all: [ 'src/<%= pkg.name %>.js' ] + }, + concat: { + options: { + banner: '<%= banner %>', + stripBanners: true + }, + dist: { + src: ['src/<%= pkg.name %>.js'], + dest: 'dist/jquery.<%= pkg.name %>.js' + } + }, + uglify: { + options: { + sourceMap: 'dist/jquery.<%= pkg.name %>.min.js.map', + sourceMappingURL : 'jquery.<%= pkg.name %>.min.js.map', + banner: '<%= banner %>' + }, + dist: { + src: '<%= concat.dist.src %>', + dest: 'dist/jquery.<%= pkg.name %>.min.js' + } + }, + connect: { + server: { + options: { + hostname: '*', + port: 9000 + } + } + } + }); + + // Default task. + grunt.registerTask('default', ['connect', 'clean', 'jshint', 'concat', 'uglify']); +}; diff --git a/bower_components/flip/LICENSE b/bower_components/flip/LICENSE new file mode 100644 index 0000000..0cc25d9 --- /dev/null +++ b/bower_components/flip/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Nattawat Nonsung (author) and Carlos Fagiani Junior + 2015 Jemar Jones, Nattawat Nonsung, Razvan Popa and Stijn de Witt + +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/bower_components/flip/README.md b/bower_components/flip/README.md new file mode 100644 index 0000000..9ffe189 --- /dev/null +++ b/bower_components/flip/README.md @@ -0,0 +1,65 @@ +[![Build Status](https://travis-ci.org/nnattawat/flip.svg?branch=master)](https://travis-ci.org/nnattawat/flip) +# jQuery Flip + +**A lightweight jQuery plugin to create 3d flip animation.** +See the [project page](http://nnattawat.github.io/flip/) + +## Getting Started + +### CDN + https://cdn.rawgit.com/nnattawat/flip/master/dist/jquery.flip.min.js + +### Download +* [jquery.flip.js][max] (development version, commented ~9kB) +* [jquery.flip.min.js][min] (production version, minified ~4kB, gzipped ~2kB) +* [jquery.flip.min.js.map][map] (source map, ~5kB) +[max]: https://cdn.rawgit.com/nnattawat/flip/master/dist/jquery.flip.js +[min]: https://cdn.rawgit.com/nnattawat/flip/master/dist/jquery.flip.min.js +[map]: https://cdn.rawgit.com/nnattawat/flip/master/dist/jquery.flip.min.js.map + +### Bower +
bower install flip
+ +### Usage +In your web page: + +```html + +
+
+ Front content +
+
+ Back content +
+
+ + + + +``` + +## Documentation and Example + +Please refer to [the project website](http://nnattawat.github.io/flip/) + +## Development +Ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed. + +Test that Grunt's CLI and Bower are installed by running `grunt --version` and `bower --version`. If the commands aren't found, run `npm install -g grunt-cli bower`. For more information about installing the tools, see the [getting started with Grunt guide](http://gruntjs.com/getting-started) or [bower.io](http://bower.io/) respectively. + +To run the demo locally, do the following. +
+npm install
+bower install
+
+ +And run grunt command to create files in /dist folder. +
grunt
+ +## What's new +Please refer to [the release page](https://github.com/nnattawat/flip/releases) diff --git a/bower_components/flip/bower.json b/bower_components/flip/bower.json new file mode 100644 index 0000000..0271ee9 --- /dev/null +++ b/bower_components/flip/bower.json @@ -0,0 +1,15 @@ +{ + "name": "flip", + "version": "1.1.2", + "license": "MIT", + "dependencies": { + "jquery": "~2.0" + }, + "devDependencies": { + "jquery": "~2.0" + }, + "main": [ + "dist/jquery.flip.js" + ], + "ignore": [] +} diff --git a/bower_components/flip/demo/flip-with-swipebox/index.html b/bower_components/flip/demo/flip-with-swipebox/index.html new file mode 100644 index 0000000..7ec8ac2 --- /dev/null +++ b/bower_components/flip/demo/flip-with-swipebox/index.html @@ -0,0 +1,56 @@ + + + + + + + + + +
+
+

Flip with Swipebox

+
+ + image + + + image + + + image + + + image + +
+

When a Swipebox is used on + a card animated with Flip, the Swipebox fails, as can be seen in this demo when + we use version 1.0.1 of Flip. If we apply the patch the issue is fixed.

+

Click on the thumbnails. A Swipebox should open.

+ +
+
+

Flip with Swipebox

+

The problem is caused by Flip disabling the bubbling of click + events on any links that are contained inside the element to be flipped, + as can be seen in lines 80-82 of the + source code.

+

This code was written to prevent the card from flipping when buttons and + links on the card are pressed. However, preventing event bubling is + dangerous.

+

The better solution is to ignore those events that you are not interested in.

+
+
+ + + + + + + \ No newline at end of file diff --git a/bower_components/flip/demo/flip-with-swipebox/style.css b/bower_components/flip/demo/flip-with-swipebox/style.css new file mode 100644 index 0000000..3c6d855 --- /dev/null +++ b/bower_components/flip/demo/flip-with-swipebox/style.css @@ -0,0 +1,36 @@ +html, body, div, ul { + box-sizing: border-box; +} + +html, body { + margin: 0; + padding: 0; +} + +.card { + width: 320px; + height: 460px; + padding: 30px; + margin: 0 auto; +} + +.card a.thumb { + float: left; + width: 100px; + height: 60px; + margin: 0 5px 10px 0; +} + +.card a.thumb img { + max-width: 100%; + max-height: 100%; +} + +.front, .back { + width: 100%; + height: 80%; + padding: 15px; + background-color: white; + border-radius: 5px; + box-shadow: 0px 1px 6px rgba(0,0,0, 0.4); +} \ No newline at end of file diff --git a/bower_components/flip/demo/index.html b/bower_components/flip/demo/index.html new file mode 100644 index 0000000..0521abf --- /dev/null +++ b/bower_components/flip/demo/index.html @@ -0,0 +1,68 @@ + + + + + + + jQuery plugin + + + +
+
+ Front: Cursus aliquet mus et sociis, placerat adipiscing a placerat magnis integer nisi lacus in, turpis porttitor? Lectus nunc dis in porta, montes lacus. Tortor. Pid sit nisi eu nec aenean. +
+
+ link + Back: Dolor scelerisque ridiculus! Mus? Augue, montes, montes proin rhoncus vel a parturient dapibus eros? Penatibus nascetur. In turpis nisi elementum nascetur habitasse augue egestas, in ac rhoncus odio porttitor turpis. + Back: Dolor scelerisque ridiculus! Mus? Augue, montes, montes proin rhoncus vel a parturient dapibus eros? Penatibus nascetur. In turpis nisi elementum nascetur habitasse augue egestas, in ac rhoncus odio porttitor turpis. +
+
+ +
+
+ Front: Cursus aliquet mus et sociis, placerat adipiscing a placerat magnis integer nisi lacus in, turpis porttitor? Lectus nunc dis in porta, montes lacus. Tortor. Pid sit nisi eu nec aenean. +
+
+ link + Back: Dolor scelerisque ridiculus! Mus? Augue, montes, montes proin rhoncus vel a parturient dapibus eros? Penatibus nascetur. In turpis nisi elementum nascetur habitasse augue egestas, in ac rhoncus odio porttitor turpis. + +
+
+ + + + diff --git a/bower_components/flip/demo/index2.html b/bower_components/flip/demo/index2.html new file mode 100644 index 0000000..4740a32 --- /dev/null +++ b/bower_components/flip/demo/index2.html @@ -0,0 +1,157 @@ + + + + + + + + jQuery plugin + + + +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ +
+
+ Front +
+
+ Back +
+
+ + + diff --git a/bower_components/flip/dist/jquery.flip.js b/bower_components/flip/dist/jquery.flip.js new file mode 100644 index 0000000..bc5d328 --- /dev/null +++ b/bower_components/flip/dist/jquery.flip.js @@ -0,0 +1,369 @@ +/*! flip - v1.1.2 - 2016-10-20 +* https://github.com/nnattawat/flip +* Copyright (c) 2016 Nattawat Nonsung; Licensed MIT */ +(function( $ ) { + /* + * Private attributes and method + */ + + // Function from David Walsh: http://davidwalsh.name/css-animation-callback licensed with http://opensource.org/licenses/MIT + var whichTransitionEvent = function() { + var t, el = document.createElement("fakeelement"), + transitions = { + "transition" : "transitionend", + "OTransition" : "oTransitionEnd", + "MozTransition" : "transitionend", + "WebkitTransition": "webkitTransitionEnd" + }; + + for (t in transitions) { + if (el.style[t] !== undefined) { + return transitions[t]; + } + } + }; + + /* + * Model declaration + */ + var Flip = function($el, options, callback) { + // Define default setting + this.setting = { + axis: "y", + reverse: false, + trigger: "click", + speed: 500, + forceHeight: false, + forceWidth: false, + autoSize: true, + front: '.front', + back: '.back' + }; + + this.setting = $.extend(this.setting, options); + + if (typeof options.axis === 'string' && (options.axis.toLowerCase() === 'x' || options.axis.toLowerCase() === 'y')) { + this.setting.axis = options.axis.toLowerCase(); + } + + if (typeof options.reverse === "boolean") { + this.setting.reverse = options.reverse; + } + + if (typeof options.trigger === 'string') { + this.setting.trigger = options.trigger.toLowerCase(); + } + + var speed = parseInt(options.speed); + if (!isNaN(speed)) { + this.setting.speed = speed; + } + + if (typeof options.forceHeight === "boolean") { + this.setting.forceHeight = options.forceHeight; + } + + if (typeof options.forceWidth === "boolean") { + this.setting.forceWidth = options.forceWidth; + } + + if (typeof options.autoSize === "boolean") { + this.setting.autoSize = options.autoSize; + } + + if (typeof options.front === 'string' || options.front instanceof $) { + this.setting.front = options.front; + } + + if (typeof options.back === 'string' || options.back instanceof $) { + this.setting.back = options.back; + } + + // Other attributes + this.element = $el; + this.frontElement = this.getFrontElement(); + this.backElement = this.getBackElement(); + this.isFlipped = false; + + this.init(callback); + }; + + /* + * Public methods + */ + $.extend(Flip.prototype, { + + flipDone: function(callback) { + var self = this; + // Providing a nicely wrapped up callback because transform is essentially async + self.element.one(whichTransitionEvent(), function() { + self.element.trigger('flip:done'); + if (typeof callback === 'function') { + callback.call(self.element); + } + }); + }, + + flip: function(callback) { + if (this.isFlipped) { + return; + } + + this.isFlipped = true; + + var rotateAxis = "rotate" + this.setting.axis; + this.frontElement.css({ + transform: rotateAxis + (this.setting.reverse ? "(-180deg)" : "(180deg)"), + "z-index": "0" + }); + + this.backElement.css({ + transform: rotateAxis + "(0deg)", + "z-index": "1" + }); + this.flipDone(callback); + }, + + unflip: function(callback) { + if (!this.isFlipped) { + return; + } + + this.isFlipped = false; + + var rotateAxis = "rotate" + this.setting.axis; + this.frontElement.css({ + transform: rotateAxis + "(0deg)", + "z-index": "1" + }); + + this.backElement.css({ + transform: rotateAxis + (this.setting.reverse ? "(180deg)" : "(-180deg)"), + "z-index": "0" + }); + this.flipDone(callback); + }, + + getFrontElement: function() { + if (this.setting.front instanceof $) { + return this.setting.front; + } else { + return this.element.find(this.setting.front); + } + }, + + getBackElement: function() { + if (this.setting.back instanceof $) { + return this.setting.back; + } else { + return this.element.find(this.setting.back); + } + }, + + init: function(callback) { + var self = this; + + var faces = self.frontElement.add(self.backElement); + var rotateAxis = "rotate" + self.setting.axis; + var perspective = self.element["outer" + (rotateAxis === "rotatex" ? "Height" : "Width")]() * 2; + var elementCss = { + 'perspective': perspective, + 'position': 'relative' + }; + var backElementCss = { + "transform": rotateAxis + "(" + (self.setting.reverse ? "180deg" : "-180deg") + ")", + "z-index": "0", + "position": "relative" + }; + var faceElementCss = { + "backface-visibility": "hidden", + "transform-style": "preserve-3d", + "position": "absolute", + "z-index": "1" + }; + + if (self.setting.forceHeight) { + faces.outerHeight(self.element.height()); + } else if (self.setting.autoSize) { + faceElementCss.height = '100%'; + } + + if (self.setting.forceWidth) { + faces.outerWidth(self.element.width()); + } else if (self.setting.autoSize) { + faceElementCss.width = '100%'; + } + + // Back face always visible on Chrome #39 + if ((window.chrome || (window.Intl && Intl.v8BreakIterator)) && 'CSS' in window) { + //Blink Engine, add preserve-3d to self.element + elementCss["-webkit-transform-style"] = "preserve-3d"; + } + + + faces.css(faceElementCss).find('*').css({ + "backface-visibility": "hidden" + }); + + self.element.css(elementCss); + self.backElement.css(backElementCss); + + // #39 + // not forcing width/height may cause an initial flip to show up on + // page load when we apply the style to reverse the backface... + // To prevent self we first apply the basic styles and then give the + // browser a moment to apply them. Only afterwards do we add the transition. + setTimeout(function() { + // By now the browser should have applied the styles, so the transition + // will only affect subsequent flips. + var speedInSec = self.setting.speed / 1000 || 0.5; + faces.css({ + "transition": "all " + speedInSec + "s ease-out" + }); + + // This allows flip to be called for setup with only a callback (default settings) + if (typeof callback === 'function') { + callback.call(self.element); + } + + // While this used to work with a setTimeout of zero, at some point that became + // unstable and the initial flip returned. The reason for this is unknown but we + // will temporarily use a short delay of 20 to mitigate this issue. + }, 20); + + self.attachEvents(); + }, + + clickHandler: function(event) { + if (!event) { event = window.event; } + if (this.element.find($(event.target).closest('button, a, input[type="submit"]')).length) { + return; + } + + if (this.isFlipped) { + this.unflip(); + } else { + this.flip(); + } + }, + + hoverHandler: function() { + var self = this; + self.element.off('mouseleave.flip'); + + self.flip(); + + setTimeout(function() { + self.element.on('mouseleave.flip', $.proxy(self.unflip, self)); + if (!self.element.is(":hover")) { + self.unflip(); + } + }, (self.setting.speed + 150)); + }, + + attachEvents: function() { + var self = this; + if (self.setting.trigger === "click") { + self.element.on($.fn.tap ? "tap.flip" : "click.flip", $.proxy(self.clickHandler, self)); + } else if (self.setting.trigger === "hover") { + self.element.on('mouseenter.flip', $.proxy(self.hoverHandler, self)); + self.element.on('mouseleave.flip', $.proxy(self.unflip, self)); + } + }, + + flipChanged: function(callback) { + this.element.trigger('flip:change'); + if (typeof callback === 'function') { + callback.call(this.element); + } + }, + + changeSettings: function(options, callback) { + var self = this; + var changeNeeded = false; + + if (options.axis !== undefined && self.setting.axis !== options.axis.toLowerCase()) { + self.setting.axis = options.axis.toLowerCase(); + changeNeeded = true; + } + + if (options.reverse !== undefined && self.setting.reverse !== options.reverse) { + self.setting.reverse = options.reverse; + changeNeeded = true; + } + + if (changeNeeded) { + var faces = self.frontElement.add(self.backElement); + var savedTrans = faces.css(["transition-property", "transition-timing-function", "transition-duration", "transition-delay"]); + + faces.css({ + transition: "none" + }); + + // This sets up the first flip in the new direction automatically + var rotateAxis = "rotate" + self.setting.axis; + + if (self.isFlipped) { + self.frontElement.css({ + transform: rotateAxis + (self.setting.reverse ? "(-180deg)" : "(180deg)"), + "z-index": "0" + }); + } else { + self.backElement.css({ + transform: rotateAxis + (self.setting.reverse ? "(180deg)" : "(-180deg)"), + "z-index": "0" + }); + } + // Providing a nicely wrapped up callback because transform is essentially async + setTimeout(function() { + faces.css(savedTrans); + self.flipChanged(callback); + }, 0); + } else { + // If we didnt have to set the axis we can just call back. + self.flipChanged(callback); + } + } + + }); + + /* + * jQuery collection methods + */ + $.fn.flip = function (options, callback) { + if (typeof options === 'function') { + callback = options; + } + + if (typeof options === "string" || typeof options === "boolean") { + this.each(function() { + var flip = $(this).data('flip-model'); + + if (options === "toggle") { + options = !flip.isFlipped; + } + + if (options) { + flip.flip(callback); + } else { + flip.unflip(callback); + } + }); + } else { + this.each(function() { + if ($(this).data('flip-model')) { // The element has been initiated, all we have to do is change applicable settings + var flip = $(this).data('flip-model'); + + if (options && (options.axis !== undefined || options.reverse !== undefined)) { + flip.changeSettings(options, callback); + } + } else { // Init + $(this).data('flip-model', new Flip($(this), (options || {}), callback)); + } + }); + } + + return this; + }; + +}( jQuery )); diff --git a/bower_components/flip/dist/jquery.flip.min.js b/bower_components/flip/dist/jquery.flip.min.js new file mode 100644 index 0000000..53cfe2b --- /dev/null +++ b/bower_components/flip/dist/jquery.flip.min.js @@ -0,0 +1,6 @@ +/*! flip - v1.1.2 - 2016-10-20 +* https://github.com/nnattawat/flip +* Copyright (c) 2016 Nattawat Nonsung; Licensed MIT */ + +!function(a){var b=function(){var a,b=document.createElement("fakeelement"),c={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(a in c)if(void 0!==b.style[a])return c[a]},c=function(b,c,d){this.setting={axis:"y",reverse:!1,trigger:"click",speed:500,forceHeight:!1,forceWidth:!1,autoSize:!0,front:".front",back:".back"},this.setting=a.extend(this.setting,c),"string"!=typeof c.axis||"x"!==c.axis.toLowerCase()&&"y"!==c.axis.toLowerCase()||(this.setting.axis=c.axis.toLowerCase()),"boolean"==typeof c.reverse&&(this.setting.reverse=c.reverse),"string"==typeof c.trigger&&(this.setting.trigger=c.trigger.toLowerCase());var e=parseInt(c.speed);isNaN(e)||(this.setting.speed=e),"boolean"==typeof c.forceHeight&&(this.setting.forceHeight=c.forceHeight),"boolean"==typeof c.forceWidth&&(this.setting.forceWidth=c.forceWidth),"boolean"==typeof c.autoSize&&(this.setting.autoSize=c.autoSize),("string"==typeof c.front||c.front instanceof a)&&(this.setting.front=c.front),("string"==typeof c.back||c.back instanceof a)&&(this.setting.back=c.back),this.element=b,this.frontElement=this.getFrontElement(),this.backElement=this.getBackElement(),this.isFlipped=!1,this.init(d)};a.extend(c.prototype,{flipDone:function(a){var c=this;c.element.one(b(),function(){c.element.trigger("flip:done"),"function"==typeof a&&a.call(c.element)})},flip:function(a){if(!this.isFlipped){this.isFlipped=!0;var b="rotate"+this.setting.axis;this.frontElement.css({transform:b+(this.setting.reverse?"(-180deg)":"(180deg)"),"z-index":"0"}),this.backElement.css({transform:b+"(0deg)","z-index":"1"}),this.flipDone(a)}},unflip:function(a){if(this.isFlipped){this.isFlipped=!1;var b="rotate"+this.setting.axis;this.frontElement.css({transform:b+"(0deg)","z-index":"1"}),this.backElement.css({transform:b+(this.setting.reverse?"(180deg)":"(-180deg)"),"z-index":"0"}),this.flipDone(a)}},getFrontElement:function(){return this.setting.front instanceof a?this.setting.front:this.element.find(this.setting.front)},getBackElement:function(){return this.setting.back instanceof a?this.setting.back:this.element.find(this.setting.back)},init:function(a){var b=this,c=b.frontElement.add(b.backElement),d="rotate"+b.setting.axis,e=2*b.element["outer"+("rotatex"===d?"Height":"Width")](),f={perspective:e,position:"relative"},g={transform:d+"("+(b.setting.reverse?"180deg":"-180deg")+")","z-index":"0",position:"relative"},h={"backface-visibility":"hidden","transform-style":"preserve-3d",position:"absolute","z-index":"1"};b.setting.forceHeight?c.outerHeight(b.element.height()):b.setting.autoSize&&(h.height="100%"),b.setting.forceWidth?c.outerWidth(b.element.width()):b.setting.autoSize&&(h.width="100%"),(window.chrome||window.Intl&&Intl.v8BreakIterator)&&"CSS"in window&&(f["-webkit-transform-style"]="preserve-3d"),c.css(h).find("*").css({"backface-visibility":"hidden"}),b.element.css(f),b.backElement.css(g),setTimeout(function(){var d=b.setting.speed/1e3||.5;c.css({transition:"all "+d+"s ease-out"}),"function"==typeof a&&a.call(b.element)},20),b.attachEvents()},clickHandler:function(b){b||(b=window.event),this.element.find(a(b.target).closest('button, a, input[type="submit"]')).length||(this.isFlipped?this.unflip():this.flip())},hoverHandler:function(){var b=this;b.element.off("mouseleave.flip"),b.flip(),setTimeout(function(){b.element.on("mouseleave.flip",a.proxy(b.unflip,b)),b.element.is(":hover")||b.unflip()},b.setting.speed+150)},attachEvents:function(){var b=this;"click"===b.setting.trigger?b.element.on(a.fn.tap?"tap.flip":"click.flip",a.proxy(b.clickHandler,b)):"hover"===b.setting.trigger&&(b.element.on("mouseenter.flip",a.proxy(b.hoverHandler,b)),b.element.on("mouseleave.flip",a.proxy(b.unflip,b)))},flipChanged:function(a){this.element.trigger("flip:change"),"function"==typeof a&&a.call(this.element)},changeSettings:function(a,b){var c=this,d=!1;if(void 0!==a.axis&&c.setting.axis!==a.axis.toLowerCase()&&(c.setting.axis=a.axis.toLowerCase(),d=!0),void 0!==a.reverse&&c.setting.reverse!==a.reverse&&(c.setting.reverse=a.reverse,d=!0),d){var e=c.frontElement.add(c.backElement),f=e.css(["transition-property","transition-timing-function","transition-duration","transition-delay"]);e.css({transition:"none"});var g="rotate"+c.setting.axis;c.isFlipped?c.frontElement.css({transform:g+(c.setting.reverse?"(-180deg)":"(180deg)"),"z-index":"0"}):c.backElement.css({transform:g+(c.setting.reverse?"(180deg)":"(-180deg)"),"z-index":"0"}),setTimeout(function(){e.css(f),c.flipChanged(b)},0)}else c.flipChanged(b)}}),a.fn.flip=function(b,d){return"function"==typeof b&&(d=b),"string"==typeof b||"boolean"==typeof b?this.each(function(){var c=a(this).data("flip-model");"toggle"===b&&(b=!c.isFlipped),b?c.flip(d):c.unflip(d)}):this.each(function(){if(a(this).data("flip-model")){var e=a(this).data("flip-model");!b||void 0===b.axis&&void 0===b.reverse||e.changeSettings(b,d)}else a(this).data("flip-model",new c(a(this),b||{},d))}),this}}(jQuery); +//# sourceMappingURL=jquery.flip.min.js.map \ No newline at end of file diff --git a/bower_components/flip/dist/jquery.flip.min.js.map b/bower_components/flip/dist/jquery.flip.min.js.map new file mode 100644 index 0000000..fde9dee --- /dev/null +++ b/bower_components/flip/dist/jquery.flip.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dist/jquery.flip.min.js","sources":["src/flip.js"],"names":["$","whichTransitionEvent","t","el","document","createElement","transitions","transition","OTransition","MozTransition","WebkitTransition","undefined","style","Flip","$el","options","callback","this","setting","axis","reverse","trigger","speed","forceHeight","forceWidth","autoSize","front","back","extend","toLowerCase","parseInt","isNaN","element","frontElement","getFrontElement","backElement","getBackElement","isFlipped","init","prototype","flipDone","self","one","call","flip","rotateAxis","css","transform","z-index","unflip","find","faces","add","perspective","elementCss","position","backElementCss","faceElementCss","backface-visibility","transform-style","outerHeight","height","outerWidth","width","window","chrome","Intl","v8BreakIterator","setTimeout","speedInSec","attachEvents","clickHandler","event","target","closest","length","hoverHandler","off","on","proxy","is","fn","tap","flipChanged","changeSettings","changeNeeded","savedTrans","each","data","jQuery"],"mappings":";;;;CAAC,SAAUA,GAMT,GAAIC,GAAuB,WACzB,GAAIC,GAAGC,EAAKC,SAASC,cAAc,eACnCC,GACEC,WAAoB,gBACpBC,YAAoB,iBACpBC,cAAoB,gBACpBC,iBAAoB,sBAGtB,KAAKR,IAAKI,GACR,GAAoBK,SAAhBR,EAAGS,MAAMV,GACX,MAAOI,GAAYJ,IAQrBW,EAAO,SAASC,EAAKC,EAASC,GAEhCC,KAAKC,SACHC,KAAM,IACNC,SAAS,EACTC,QAAS,QACTC,MAAO,IACPC,aAAa,EACbC,YAAY,EACZC,UAAU,EACVC,MAAO,SACPC,KAAM,SAGRV,KAAKC,QAAUlB,EAAE4B,OAAOX,KAAKC,QAASH,GAEV,gBAAjBA,GAAQI,MAAqD,MAA/BJ,EAAQI,KAAKU,eAAwD,MAA/Bd,EAAQI,KAAKU,gBAC1FZ,KAAKC,QAAQC,KAAOJ,EAAQI,KAAKU,eAGJ,iBAApBd,GAAQK,UACjBH,KAAKC,QAAQE,QAAUL,EAAQK,SAGF,gBAApBL,GAAQM,UACjBJ,KAAKC,QAAQG,QAAUN,EAAQM,QAAQQ,cAGzC,IAAIP,GAAQQ,SAASf,EAAQO,MACxBS,OAAMT,KACTL,KAAKC,QAAQI,MAAQA,GAGY,iBAAxBP,GAAQQ,cACjBN,KAAKC,QAAQK,YAAcR,EAAQQ,aAGH,iBAAvBR,GAAQS,aACjBP,KAAKC,QAAQM,WAAaT,EAAQS,YAGJ,iBAArBT,GAAQU,WACjBR,KAAKC,QAAQO,SAAWV,EAAQU,WAGL,gBAAlBV,GAAQW,OAAsBX,EAAQW,gBAAiB1B,MAChEiB,KAAKC,QAAQQ,MAAQX,EAAQW,QAGH,gBAAjBX,GAAQY,MAAqBZ,EAAQY,eAAgB3B,MAC9DiB,KAAKC,QAAQS,KAAOZ,EAAQY,MAI9BV,KAAKe,QAAUlB,EACfG,KAAKgB,aAAehB,KAAKiB,kBACzBjB,KAAKkB,YAAclB,KAAKmB,iBACxBnB,KAAKoB,WAAY,EAEjBpB,KAAKqB,KAAKtB,GAMZhB,GAAE4B,OAAOf,EAAK0B,WAEZC,SAAU,SAASxB,GACjB,GAAIyB,GAAOxB,IAEXwB,GAAKT,QAAQU,IAAIzC,IAAwB,WACvCwC,EAAKT,QAAQX,QAAQ,aACG,kBAAbL,IACTA,EAAS2B,KAAKF,EAAKT,YAKzBY,KAAM,SAAS5B,GACb,IAAIC,KAAKoB,UAAT,CAIApB,KAAKoB,WAAY,CAEjB,IAAIQ,GAAa,SAAW5B,KAAKC,QAAQC,IACzCF,MAAKgB,aAAaa,KAChBC,UAAWF,GAAc5B,KAAKC,QAAQE,QAAU,YAAc,YAC9D4B,UAAW,MAGb/B,KAAKkB,YAAYW,KACfC,UAAWF,EAAa,SACxBG,UAAW,MAEb/B,KAAKuB,SAASxB,KAGhBiC,OAAQ,SAASjC,GACf,GAAKC,KAAKoB,UAAV,CAIApB,KAAKoB,WAAY,CAEjB,IAAIQ,GAAa,SAAW5B,KAAKC,QAAQC,IACzCF,MAAKgB,aAAaa,KAChBC,UAAWF,EAAa,SACxBG,UAAW,MAGb/B,KAAKkB,YAAYW,KACfC,UAAWF,GAAc5B,KAAKC,QAAQE,QAAU,WAAa,aAC7D4B,UAAW,MAEb/B,KAAKuB,SAASxB,KAGhBkB,gBAAiB,WACf,MAAIjB,MAAKC,QAAQQ,gBAAiB1B,GACzBiB,KAAKC,QAAQQ,MAEbT,KAAKe,QAAQkB,KAAKjC,KAAKC,QAAQQ,QAI1CU,eAAgB,WACd,MAAInB,MAAKC,QAAQS,eAAgB3B,GACxBiB,KAAKC,QAAQS,KAEbV,KAAKe,QAAQkB,KAAKjC,KAAKC,QAAQS,OAI1CW,KAAM,SAAStB,GACb,GAAIyB,GAAOxB,KAEPkC,EAAQV,EAAKR,aAAamB,IAAIX,EAAKN,aACnCU,EAAa,SAAWJ,EAAKvB,QAAQC,KACrCkC,EAA0F,EAA5EZ,EAAKT,QAAQ,SAA0B,YAAfa,EAA2B,SAAW,YAC5ES,GACFD,YAAeA,EACfE,SAAY,YAEVC,GACFT,UAAaF,EAAa,KAAOJ,EAAKvB,QAAQE,QAAU,SAAW,WAAa,IAChF4B,UAAW,IACXO,SAAY,YAEVE,GACFC,sBAAuB,SACvBC,kBAAmB,cACnBJ,SAAY,WACZP,UAAW,IAGTP,GAAKvB,QAAQK,YACf4B,EAAMS,YAAYnB,EAAKT,QAAQ6B,UACtBpB,EAAKvB,QAAQO,WACtBgC,EAAeI,OAAS,QAGtBpB,EAAKvB,QAAQM,WACf2B,EAAMW,WAAWrB,EAAKT,QAAQ+B,SACrBtB,EAAKvB,QAAQO,WACtBgC,EAAeM,MAAQ,SAIpBC,OAAOC,QAAWD,OAAOE,MAAQA,KAAKC,kBAAqB,OAASH,UAEvEV,EAAW,2BAA6B,eAI1CH,EAAML,IAAIW,GAAgBP,KAAK,KAAKJ,KAClCY,sBAAuB,WAGzBjB,EAAKT,QAAQc,IAAIQ,GACjBb,EAAKN,YAAYW,IAAIU,GAOrBY,WAAW,WAGT,GAAIC,GAAa5B,EAAKvB,QAAQI,MAAQ,KAAQ,EAC9C6B,GAAML,KACJvC,WAAc,OAAS8D,EAAa,eAId,kBAAbrD,IACTA,EAAS2B,KAAKF,EAAKT,UAMpB,IAEHS,EAAK6B,gBAGPC,aAAc,SAASC,GAChBA,IAASA,EAAQR,OAAOQ,OACzBvD,KAAKe,QAAQkB,KAAKlD,EAAEwE,EAAMC,QAAQC,QAAQ,oCAAoCC,SAI9E1D,KAAKoB,UACPpB,KAAKgC,SAELhC,KAAK2B,SAITgC,aAAc,WACZ,GAAInC,GAAOxB,IACXwB,GAAKT,QAAQ6C,IAAI,mBAEjBpC,EAAKG,OAELwB,WAAW,WACT3B,EAAKT,QAAQ8C,GAAG,kBAAmB9E,EAAE+E,MAAMtC,EAAKQ,OAAQR,IACnDA,EAAKT,QAAQgD,GAAG,WACnBvC,EAAKQ,UAELR,EAAKvB,QAAQI,MAAQ,MAG3BgD,aAAc,WACZ,GAAI7B,GAAOxB,IACkB,WAAzBwB,EAAKvB,QAAQG,QACfoB,EAAKT,QAAQ8C,GAAG9E,EAAEiF,GAAGC,IAAM,WAAa,aAAclF,EAAE+E,MAAMtC,EAAK8B,aAAc9B,IAC/C,UAAzBA,EAAKvB,QAAQG,UACtBoB,EAAKT,QAAQ8C,GAAG,kBAAmB9E,EAAE+E,MAAMtC,EAAKmC,aAAcnC,IAC9DA,EAAKT,QAAQ8C,GAAG,kBAAmB9E,EAAE+E,MAAMtC,EAAKQ,OAAQR,MAI5D0C,YAAa,SAASnE,GACpBC,KAAKe,QAAQX,QAAQ,eACG,kBAAbL,IACTA,EAAS2B,KAAK1B,KAAKe,UAIvBoD,eAAgB,SAASrE,EAASC,GAChC,GAAIyB,GAAOxB,KACPoE,GAAe,CAYnB,IAVqB1E,SAAjBI,EAAQI,MAAsBsB,EAAKvB,QAAQC,OAASJ,EAAQI,KAAKU,gBACnEY,EAAKvB,QAAQC,KAAOJ,EAAQI,KAAKU,cACjCwD,GAAe,GAGO1E,SAApBI,EAAQK,SAAyBqB,EAAKvB,QAAQE,UAAYL,EAAQK,UACpEqB,EAAKvB,QAAQE,QAAUL,EAAQK,QAC/BiE,GAAe,GAGbA,EAAc,CAChB,GAAIlC,GAAQV,EAAKR,aAAamB,IAAIX,EAAKN,aACnCmD,EAAanC,EAAML,KAAK,sBAAuB,6BAA8B,sBAAuB,oBAExGK,GAAML,KACJvC,WAAY,QAId,IAAIsC,GAAa,SAAWJ,EAAKvB,QAAQC,IAErCsB,GAAKJ,UACPI,EAAKR,aAAaa,KAChBC,UAAWF,GAAcJ,EAAKvB,QAAQE,QAAU,YAAc,YAC9D4B,UAAW,MAGbP,EAAKN,YAAYW,KACfC,UAAWF,GAAcJ,EAAKvB,QAAQE,QAAU,WAAa,aAC7D4B,UAAW,MAIfoB,WAAW,WACTjB,EAAML,IAAIwC,GACV7C,EAAK0C,YAAYnE,IAChB,OAGHyB,GAAK0C,YAAYnE,MASvBhB,EAAEiF,GAAGrC,KAAO,SAAU7B,EAASC,GAiC7B,MAhCuB,kBAAZD,KACTC,EAAWD,GAGU,gBAAZA,IAA2C,iBAAZA,GACxCE,KAAKsE,KAAK,WACR,GAAI3C,GAAO5C,EAAEiB,MAAMuE,KAAK,aAER,YAAZzE,IACFA,GAAW6B,EAAKP,WAGdtB,EACF6B,EAAKA,KAAK5B,GAEV4B,EAAKK,OAAOjC,KAIhBC,KAAKsE,KAAK,WACR,GAAIvF,EAAEiB,MAAMuE,KAAK,cAAe,CAC9B,GAAI5C,GAAO5C,EAAEiB,MAAMuE,KAAK,eAEpBzE,GAA6BJ,SAAjBI,EAAQI,MAA0CR,SAApBI,EAAQK,SACpDwB,EAAKwC,eAAerE,EAASC,OAG/BhB,GAAEiB,MAAMuE,KAAK,aAAc,GAAI3E,GAAKb,EAAEiB,MAAQF,MAAgBC,MAK7DC,OAGRwE"} \ No newline at end of file diff --git a/bower_components/flip/package.json b/bower_components/flip/package.json new file mode 100644 index 0000000..42d1c76 --- /dev/null +++ b/bower_components/flip/package.json @@ -0,0 +1,64 @@ +{ + "name": "flip", + "version": "1.1.2", + "description": "jQuery Plugin - 3d Flip Content", + "keywords": [ + "jquery-plugin" + ], + "main": "dist/jquery.flip.js", + "homepage": "https://github.com/nnattawat/flip", + "bugs": "https://github.com/nnattawat/flip/issues", + "author": { + "name": "Nattawat Nonsung", + "email": "armmer1@gmail.com", + "url": "https://github.com/nnattawat" + }, + "contributors": [ + { + "name": "Carlos Fagiani Junior", + "email": "fagianijunior@gmail.com", + "url": "https://github.com/fagianijunior" + }, + { + "name": "Zlatko Fedor", + "email": "zfedor@gmail.com", + "url": "https://github.com/seeden" + }, + { + "name": "Jemar Jones", + "email": "jemarkjones@gmail.com", + "url": "http://JKJones.me/" + }, + { + "name": "Razvan Popa", + "url": "https://github.com/VholtWCP" + }, + { + "name": "Stijn de Witt", + "email": "StijnDeWitt@hotmail.com", + "url": "http://StijnDeWitt.com" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/nnattawat/flip.git" + }, + "license": "MIT", + "devDependencies": { + "grunt-contrib-concat": "~0.3.0", + "grunt-contrib-uglify": "~0.2.7", + "grunt-contrib-watch": "~0.5.3", + "grunt-contrib-clean": "~0.5.0", + "grunt-contrib-connect": "~0.5.0", + "time-grunt": "~0.2.3", + "load-grunt-tasks": "~0.2.0", + "grunt": "~0.4.2", + "grunt-contrib-jshint": "~1.0.0", + "grunt-cli": "~0.1.13", + "bower": "~1.7.6" + }, + "scripts": { + "test": "grunt jshint", + "grunt": "grunt" + } +} diff --git a/bower_components/flip/src/flip.js b/bower_components/flip/src/flip.js new file mode 100644 index 0000000..dfe07b9 --- /dev/null +++ b/bower_components/flip/src/flip.js @@ -0,0 +1,366 @@ +(function( $ ) { + /* + * Private attributes and method + */ + + // Function from David Walsh: http://davidwalsh.name/css-animation-callback licensed with http://opensource.org/licenses/MIT + var whichTransitionEvent = function() { + var t, el = document.createElement("fakeelement"), + transitions = { + "transition" : "transitionend", + "OTransition" : "oTransitionEnd", + "MozTransition" : "transitionend", + "WebkitTransition": "webkitTransitionEnd" + }; + + for (t in transitions) { + if (el.style[t] !== undefined) { + return transitions[t]; + } + } + }; + + /* + * Model declaration + */ + var Flip = function($el, options, callback) { + // Define default setting + this.setting = { + axis: "y", + reverse: false, + trigger: "click", + speed: 500, + forceHeight: false, + forceWidth: false, + autoSize: true, + front: '.front', + back: '.back' + }; + + this.setting = $.extend(this.setting, options); + + if (typeof options.axis === 'string' && (options.axis.toLowerCase() === 'x' || options.axis.toLowerCase() === 'y')) { + this.setting.axis = options.axis.toLowerCase(); + } + + if (typeof options.reverse === "boolean") { + this.setting.reverse = options.reverse; + } + + if (typeof options.trigger === 'string') { + this.setting.trigger = options.trigger.toLowerCase(); + } + + var speed = parseInt(options.speed); + if (!isNaN(speed)) { + this.setting.speed = speed; + } + + if (typeof options.forceHeight === "boolean") { + this.setting.forceHeight = options.forceHeight; + } + + if (typeof options.forceWidth === "boolean") { + this.setting.forceWidth = options.forceWidth; + } + + if (typeof options.autoSize === "boolean") { + this.setting.autoSize = options.autoSize; + } + + if (typeof options.front === 'string' || options.front instanceof $) { + this.setting.front = options.front; + } + + if (typeof options.back === 'string' || options.back instanceof $) { + this.setting.back = options.back; + } + + // Other attributes + this.element = $el; + this.frontElement = this.getFrontElement(); + this.backElement = this.getBackElement(); + this.isFlipped = false; + + this.init(callback); + }; + + /* + * Public methods + */ + $.extend(Flip.prototype, { + + flipDone: function(callback) { + var self = this; + // Providing a nicely wrapped up callback because transform is essentially async + self.element.one(whichTransitionEvent(), function() { + self.element.trigger('flip:done'); + if (typeof callback === 'function') { + callback.call(self.element); + } + }); + }, + + flip: function(callback) { + if (this.isFlipped) { + return; + } + + this.isFlipped = true; + + var rotateAxis = "rotate" + this.setting.axis; + this.frontElement.css({ + transform: rotateAxis + (this.setting.reverse ? "(-180deg)" : "(180deg)"), + "z-index": "0" + }); + + this.backElement.css({ + transform: rotateAxis + "(0deg)", + "z-index": "1" + }); + this.flipDone(callback); + }, + + unflip: function(callback) { + if (!this.isFlipped) { + return; + } + + this.isFlipped = false; + + var rotateAxis = "rotate" + this.setting.axis; + this.frontElement.css({ + transform: rotateAxis + "(0deg)", + "z-index": "1" + }); + + this.backElement.css({ + transform: rotateAxis + (this.setting.reverse ? "(180deg)" : "(-180deg)"), + "z-index": "0" + }); + this.flipDone(callback); + }, + + getFrontElement: function() { + if (this.setting.front instanceof $) { + return this.setting.front; + } else { + return this.element.find(this.setting.front); + } + }, + + getBackElement: function() { + if (this.setting.back instanceof $) { + return this.setting.back; + } else { + return this.element.find(this.setting.back); + } + }, + + init: function(callback) { + var self = this; + + var faces = self.frontElement.add(self.backElement); + var rotateAxis = "rotate" + self.setting.axis; + var perspective = self.element["outer" + (rotateAxis === "rotatex" ? "Height" : "Width")]() * 2; + var elementCss = { + 'perspective': perspective, + 'position': 'relative' + }; + var backElementCss = { + "transform": rotateAxis + "(" + (self.setting.reverse ? "180deg" : "-180deg") + ")", + "z-index": "0", + "position": "relative" + }; + var faceElementCss = { + "backface-visibility": "hidden", + "transform-style": "preserve-3d", + "position": "absolute", + "z-index": "1" + }; + + if (self.setting.forceHeight) { + faces.outerHeight(self.element.height()); + } else if (self.setting.autoSize) { + faceElementCss.height = '100%'; + } + + if (self.setting.forceWidth) { + faces.outerWidth(self.element.width()); + } else if (self.setting.autoSize) { + faceElementCss.width = '100%'; + } + + // Back face always visible on Chrome #39 + if ((window.chrome || (window.Intl && Intl.v8BreakIterator)) && 'CSS' in window) { + //Blink Engine, add preserve-3d to self.element + elementCss["-webkit-transform-style"] = "preserve-3d"; + } + + + faces.css(faceElementCss).find('*').css({ + "backface-visibility": "hidden" + }); + + self.element.css(elementCss); + self.backElement.css(backElementCss); + + // #39 + // not forcing width/height may cause an initial flip to show up on + // page load when we apply the style to reverse the backface... + // To prevent self we first apply the basic styles and then give the + // browser a moment to apply them. Only afterwards do we add the transition. + setTimeout(function() { + // By now the browser should have applied the styles, so the transition + // will only affect subsequent flips. + var speedInSec = self.setting.speed / 1000 || 0.5; + faces.css({ + "transition": "all " + speedInSec + "s ease-out" + }); + + // This allows flip to be called for setup with only a callback (default settings) + if (typeof callback === 'function') { + callback.call(self.element); + } + + // While this used to work with a setTimeout of zero, at some point that became + // unstable and the initial flip returned. The reason for this is unknown but we + // will temporarily use a short delay of 20 to mitigate this issue. + }, 20); + + self.attachEvents(); + }, + + clickHandler: function(event) { + if (!event) { event = window.event; } + if (this.element.find($(event.target).closest('button, a, input[type="submit"]')).length) { + return; + } + + if (this.isFlipped) { + this.unflip(); + } else { + this.flip(); + } + }, + + hoverHandler: function() { + var self = this; + self.element.off('mouseleave.flip'); + + self.flip(); + + setTimeout(function() { + self.element.on('mouseleave.flip', $.proxy(self.unflip, self)); + if (!self.element.is(":hover")) { + self.unflip(); + } + }, (self.setting.speed + 150)); + }, + + attachEvents: function() { + var self = this; + if (self.setting.trigger === "click") { + self.element.on($.fn.tap ? "tap.flip" : "click.flip", $.proxy(self.clickHandler, self)); + } else if (self.setting.trigger === "hover") { + self.element.on('mouseenter.flip', $.proxy(self.hoverHandler, self)); + self.element.on('mouseleave.flip', $.proxy(self.unflip, self)); + } + }, + + flipChanged: function(callback) { + this.element.trigger('flip:change'); + if (typeof callback === 'function') { + callback.call(this.element); + } + }, + + changeSettings: function(options, callback) { + var self = this; + var changeNeeded = false; + + if (options.axis !== undefined && self.setting.axis !== options.axis.toLowerCase()) { + self.setting.axis = options.axis.toLowerCase(); + changeNeeded = true; + } + + if (options.reverse !== undefined && self.setting.reverse !== options.reverse) { + self.setting.reverse = options.reverse; + changeNeeded = true; + } + + if (changeNeeded) { + var faces = self.frontElement.add(self.backElement); + var savedTrans = faces.css(["transition-property", "transition-timing-function", "transition-duration", "transition-delay"]); + + faces.css({ + transition: "none" + }); + + // This sets up the first flip in the new direction automatically + var rotateAxis = "rotate" + self.setting.axis; + + if (self.isFlipped) { + self.frontElement.css({ + transform: rotateAxis + (self.setting.reverse ? "(-180deg)" : "(180deg)"), + "z-index": "0" + }); + } else { + self.backElement.css({ + transform: rotateAxis + (self.setting.reverse ? "(180deg)" : "(-180deg)"), + "z-index": "0" + }); + } + // Providing a nicely wrapped up callback because transform is essentially async + setTimeout(function() { + faces.css(savedTrans); + self.flipChanged(callback); + }, 0); + } else { + // If we didnt have to set the axis we can just call back. + self.flipChanged(callback); + } + } + + }); + + /* + * jQuery collection methods + */ + $.fn.flip = function (options, callback) { + if (typeof options === 'function') { + callback = options; + } + + if (typeof options === "string" || typeof options === "boolean") { + this.each(function() { + var flip = $(this).data('flip-model'); + + if (options === "toggle") { + options = !flip.isFlipped; + } + + if (options) { + flip.flip(callback); + } else { + flip.unflip(callback); + } + }); + } else { + this.each(function() { + if ($(this).data('flip-model')) { // The element has been initiated, all we have to do is change applicable settings + var flip = $(this).data('flip-model'); + + if (options && (options.axis !== undefined || options.reverse !== undefined)) { + flip.changeSettings(options, callback); + } + } else { // Init + $(this).data('flip-model', new Flip($(this), (options || {}), callback)); + } + }); + } + + return this; + }; + +}( jQuery )); diff --git a/bower_components/jquery/.bower.json b/bower_components/jquery/.bower.json index 6f34470..7549b20 100644 --- a/bower_components/jquery/.bower.json +++ b/bower_components/jquery/.bower.json @@ -12,14 +12,14 @@ "library" ], "homepage": "https://github.com/jquery/jquery-dist", - "version": "2.2.4", - "_release": "2.2.4", + "version": "3.1.1", + "_release": "3.1.1", "_resolution": { "type": "version", - "tag": "2.2.4", - "commit": "c0185ab7c75aab88762c5aae780b9d83b80eda72" + "tag": "3.1.1", + "commit": "1b30f3ad466ebf2714d47eda34dbd7fdf6849fe3" }, "_source": "https://github.com/jquery/jquery-dist.git", - "_target": "~2.2.0", + "_target": "*", "_originalSource": "jquery" } \ No newline at end of file diff --git a/bower_components/jquery/AUTHORS.txt b/bower_components/jquery/AUTHORS.txt index dde64ca..334363d 100644 --- a/bower_components/jquery/AUTHORS.txt +++ b/bower_components/jquery/AUTHORS.txt @@ -77,7 +77,7 @@ Jared Grippe Sylvester Keil Brandon Sterne Mathias Bynens -Timmy Willison +Timmy Willison <4timmywil@gmail.com> Corey Frang Digitalxero Anton Kovalyov @@ -272,7 +272,24 @@ Christian Grete Liza Ramo Julian Alexander Murillo Joelle Fleurantin +Jae Sung Park Jun Sun +Josh Soref +Henry Wong +Jon Dufresne +Martijn W. van der Lee Devin Wilson -Todor Prikumov +Steve Mao Zack Hall +Bernhard M. Wiedemann +Todor Prikumov +Jha Naman +William Robinet +Alexander Lisianoi +Vitaliy Terziev +Joe Trumbull +Alexander K +Damian Senn +Ralin Chimev +Felipe Sateler +Christophe Tafani-Dereeper diff --git a/bower_components/jquery/dist/core.js b/bower_components/jquery/dist/core.js new file mode 100644 index 0000000..4c8a4ab --- /dev/null +++ b/bower_components/jquery/dist/core.js @@ -0,0 +1,482 @@ +/* global Symbol */ +// Defining this global in .eslintrc.json would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + +define( [ + "./var/arr", + "./var/document", + "./var/getProto", + "./var/slice", + "./var/concat", + "./var/push", + "./var/indexOf", + "./var/class2type", + "./var/toString", + "./var/hasOwn", + "./var/fnToString", + "./var/ObjectFunctionString", + "./var/support", + "./core/DOMEval" +], function( arr, document, getProto, slice, concat, push, indexOf, + class2type, toString, hasOwn, fnToString, ObjectFunctionString, + support, DOMEval ) { + +"use strict"; + +var + version = "3.1.1", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android <=4.0 only + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + + // Return all the elements in a clean array + if ( num == null ) { + return slice.call( this ); + } + + // Return just the one element from the set + return num < 0 ? this[ num + this.length ] : 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; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = jQuery.isArray( copy ) ) ) ) { + + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray( src ) ? src : []; + + } else { + clone = src && jQuery.isPlainObject( src ) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isFunction: function( obj ) { + return jQuery.type( obj ) === "function"; + }, + + isArray: Array.isArray, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + + // As of jQuery 3.0, isNumeric is limited to + // strings and numbers (primitives or objects) + // that can be coerced to finite numbers (gh-2662) + var type = jQuery.type( obj ); + return ( type === "number" || type === "string" ) && + + // parseFloat NaNs numeric-cast false positives ("") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + !isNaN( obj - parseFloat( obj ) ); + }, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + + /* eslint-disable no-unused-vars */ + // See https://github.com/eslint/eslint/issues/6125 + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + globalEval: function( code ) { + DOMEval( code ); + }, + + // Convert dashed to camelCase; used by the css and data modules + // Support: IE <=9 - 11, Edge 12 - 13 + // 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(); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + // Support: Android <=4.0 only + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), +function( i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +} ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} + +return jQuery; +} ); diff --git a/bower_components/jquery/dist/jquery.js b/bower_components/jquery/dist/jquery.js index 5c3c456..072e308 100644 --- a/bower_components/jquery/dist/jquery.js +++ b/bower_components/jquery/dist/jquery.js @@ -1,20 +1,22 @@ /*! - * jQuery JavaScript Library v2.2.4 - * http://jquery.com/ + * jQuery JavaScript Library v3.1.1 + * https://jquery.com/ * * Includes Sizzle.js - * http://sizzlejs.com/ + * https://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license - * http://jquery.org/license + * https://jquery.org/license * - * Date: 2016-05-20T17:23Z + * Date: 2016-09-22T22:30Z */ +( function( global, factory ) { -(function( global, factory ) { + "use strict"; if ( typeof module === "object" && typeof module.exports === "object" ) { + // For CommonJS and CommonJS-like environments where a proper `window` // is present, execute the factory and get jQuery. // For environments that do not have a `window` with a `document` @@ -35,17 +37,20 @@ } // Pass this if window is not defined yet -}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; -// Support: Firefox 18+ -// Can't be in strict mode, several libs including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -//"use strict"; var arr = []; var document = window.document; +var getProto = Object.getPrototypeOf; + var slice = arr.slice; var concat = arr.concat; @@ -60,12 +65,30 @@ var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + var support = {}; + function DOMEval( code, doc ) { + doc = doc || document; + + var script = doc.createElement( "script" ); + + script.text = code; + doc.head.appendChild( script ).parentNode.removeChild( script ); + } +/* global Symbol */ +// Defining this global in .eslintrc.json would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + var - version = "2.2.4", + version = "3.1.1", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -75,13 +98,13 @@ var return new jQuery.fn.init( selector, context ); }, - // Support: Android<4.1 + // Support: Android <=4.0 only // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, + rdashAlpha = /-([a-z])/g, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { @@ -95,9 +118,6 @@ jQuery.fn = jQuery.prototype = { constructor: jQuery, - // Start with an empty selector - selector: "", - // The default length of a jQuery object is 0 length: 0, @@ -108,13 +128,14 @@ jQuery.fn = jQuery.prototype = { // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { - return num != null ? - // Return just the one element from the set - ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + // Return all the elements in a clean array + if ( num == null ) { + return slice.call( this ); + } - // Return all the elements in a clean array - slice.call( this ); + // Return just the one element from the set + return num < 0 ? this[ num + this.length ] : this[ num ]; }, // Take an array of elements and push it onto the stack @@ -126,7 +147,6 @@ jQuery.fn = jQuery.prototype = { // 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; @@ -267,41 +287,45 @@ jQuery.extend( { isNumeric: function( obj ) { - // parseFloat NaNs numeric-cast false positives (null|true|false|"") - // ...but misinterprets leading-number strings, particularly hex literals ("0x...") - // subtraction forces infinities to NaN - // adding 1 corrects loss of precision from parseFloat (#15100) - var realStringObj = obj && obj.toString(); - return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; + // As of jQuery 3.0, isNumeric is limited to + // strings and numbers (primitives or objects) + // that can be coerced to finite numbers (gh-2662) + var type = jQuery.type( obj ); + return ( type === "number" || type === "string" ) && + + // parseFloat NaNs numeric-cast false positives ("") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + !isNaN( obj - parseFloat( obj ) ); }, isPlainObject: function( obj ) { - var key; + var proto, Ctor; - // Not plain objects: - // - Any object or value whose internal [[Class]] property is not "[object Object]" - // - DOM nodes - // - window - if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { return false; } - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call( obj, "constructor" ) && - !hasOwn.call( obj.constructor.prototype || {}, "isPrototypeOf" ) ) { - return false; + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; } - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; }, isEmptyObject: function( obj ) { + + /* eslint-disable no-unused-vars */ + // See https://github.com/eslint/eslint/issues/6125 var name; + for ( name in obj ) { return false; } @@ -313,7 +337,7 @@ jQuery.extend( { return obj + ""; } - // Support: Android<4.0, iOS<6 (functionish RegExp) + // Support: Android <=2.3 only (functionish RegExp) return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call( obj ) ] || "object" : typeof obj; @@ -321,32 +345,11 @@ jQuery.extend( { // Evaluates a script in a global context globalEval: function( code ) { - var script, - indirect = eval; - - code = jQuery.trim( code ); - - if ( code ) { - - // If the code includes a valid, prologue position - // strict mode pragma, execute code by injecting a - // script tag into the document. - if ( code.indexOf( "use strict" ) === 1 ) { - script = document.createElement( "script" ); - script.text = code; - document.head.appendChild( script ).parentNode.removeChild( script ); - } else { - - // Otherwise, avoid the DOM node creation, insertion - // and removal by using an indirect global eval - - indirect( code ); - } - } + DOMEval( code ); }, // Convert dashed to camelCase; used by the css and data modules - // Support: IE9-11+ + // Support: IE <=9 - 11, Edge 12 - 13 // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); @@ -377,7 +380,7 @@ jQuery.extend( { return obj; }, - // Support: Android<4.1 + // Support: Android <=4.0 only trim: function( text ) { return text == null ? "" : @@ -406,6 +409,8 @@ jQuery.extend( { return arr == null ? -1 : indexOf.call( arr, elem, i ); }, + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit merge: function( first, second ) { var len = +second.length, j = 0, @@ -510,15 +515,9 @@ jQuery.extend( { support: support } ); -// JSHint would error on this code due to the Symbol not being defined in ES5. -// Defining this global in .jshintrc would create a danger of using the global -// unguarded in another place, it seems safer to just disable JSHint for these -// three lines. -/* jshint ignore: start */ if ( typeof Symbol === "function" ) { jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; } -/* jshint ignore: end */ // Populate the class2type map jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), @@ -528,7 +527,7 @@ function( i, name ) { function isArrayLike( obj ) { - // Support: iOS 8.2 (not reproducible in simulator) + // Support: real iOS 8.2 only (not reproducible in simulator) // `in` check used to prevent JIT error (gh-2145) // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE @@ -544,14 +543,14 @@ function isArrayLike( obj ) { } var Sizzle = /*! - * Sizzle CSS Selector Engine v2.2.1 - * http://sizzlejs.com/ + * Sizzle CSS Selector Engine v2.3.3 + * https://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * - * Date: 2015-10-17 + * Date: 2016-08-08 */ (function( window ) { @@ -592,9 +591,6 @@ var i, return 0; }, - // General-purpose constants - MAX_NEGATIVE = 1 << 31, - // Instance methods hasOwn = ({}).hasOwnProperty, arr = [], @@ -603,7 +599,7 @@ var i, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf as it's faster than native - // http://jsperf.com/thor-indexof-vs-for/5 + // https://jsperf.com/thor-indexof-vs-for/5 indexOf = function( list, elem ) { var i = 0, len = list.length; @@ -623,7 +619,7 @@ var i, whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + @@ -680,9 +676,9 @@ var i, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, - rescape = /'|\\/g, - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + // CSS escapes + // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; @@ -698,13 +694,39 @@ var i, String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }, + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, + fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }, + // Used for iframes // See setDocument() // Removing the function wrapper causes a "Permission Denied" // error in IE unloadHandler = function() { setDocument(); - }; + }, + + disabledAncestor = addCombinator( + function( elem ) { + return elem.disabled === true && ("form" in elem || "label" in elem); + }, + { dir: "parentNode", next: "legend" } + ); // Optimize for push.apply( _, NodeList ) try { @@ -736,7 +758,7 @@ try { } function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, nidselect, match, groups, newSelector, + var m, i, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, // nodeType defaults to 9, since context defaults to document @@ -829,7 +851,7 @@ function Sizzle( selector, context, results, seed ) { // Capture the context ID, setting it first if necessary if ( (nid = context.getAttribute( "id" )) ) { - nid = nid.replace( rescape, "\\$&" ); + nid = nid.replace( rcssescape, fcssescape ); } else { context.setAttribute( "id", (nid = expando) ); } @@ -837,9 +859,8 @@ function Sizzle( selector, context, results, seed ) { // Prefix every selector in the list groups = tokenize( selector ); i = groups.length; - nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; while ( i-- ) { - groups[i] = nidselect + " " + toSelector( groups[i] ); + groups[i] = "#" + nid + " " + toSelector( groups[i] ); } newSelector = groups.join( "," ); @@ -900,22 +921,22 @@ function markFunction( fn ) { /** * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result + * @param {Function} fn Passed the created element and returns a boolean result */ function assert( fn ) { - var div = document.createElement("div"); + var el = document.createElement("fieldset"); try { - return !!fn( div ); + return !!fn( el ); } catch (e) { return false; } finally { // Remove from its parent by default - if ( div.parentNode ) { - div.parentNode.removeChild( div ); + if ( el.parentNode ) { + el.parentNode.removeChild( el ); } // release memory in IE - div = null; + el = null; } } @@ -942,8 +963,7 @@ function addHandle( attrs, handler ) { function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && - ( ~b.sourceIndex || MAX_NEGATIVE ) - - ( ~a.sourceIndex || MAX_NEGATIVE ); + a.sourceIndex - b.sourceIndex; // Use IE sourceIndex if available on both nodes if ( diff ) { @@ -984,6 +1004,62 @@ function createButtonPseudo( type ) { }; } +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + + // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Only certain elements can match :enabled or :disabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled + if ( "form" in elem ) { + + // Check for inherited disabledness on relevant non-disabled elements: + // * listed form-associated elements in a disabled fieldset + // https://html.spec.whatwg.org/multipage/forms.html#category-listed + // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled + // * option elements in a disabled optgroup + // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled + // All such elements have a "form" property. + if ( elem.parentNode && elem.disabled === false ) { + + // Option elements defer to a parent optgroup if present + if ( "label" in elem ) { + if ( "label" in elem.parentNode ) { + return elem.parentNode.disabled === disabled; + } else { + return elem.disabled === disabled; + } + } + + // Support: IE 6 - 11 + // Use the isDisabled shortcut property to check for disabled fieldset ancestors + return elem.isDisabled === disabled || + + // Where there is no isDisabled, check manually + /* jshint -W018 */ + elem.isDisabled !== !disabled && + disabledAncestor( elem ) === disabled; + } + + return elem.disabled === disabled; + + // Try to winnow out elements that can't be disabled before trusting the disabled property. + // Some victims get caught in our net (label, legend, menu, track), but it shouldn't + // even exist on them, let alone have a boolean value. + } else if ( "label" in elem ) { + return elem.disabled === disabled; + } + + // Remaining elements are neither :enabled nor :disabled + return false; + }; +} + /** * Returns a function to use in pseudos for positionals * @param {Function} fn @@ -1036,7 +1112,7 @@ isXML = Sizzle.isXML = function( elem ) { * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, parent, + var hasCompare, subWindow, doc = node ? node.ownerDocument || node : preferredDoc; // Return early if doc is invalid or already selected @@ -1051,14 +1127,16 @@ setDocument = Sizzle.setDocument = function( node ) { // Support: IE 9-11, Edge // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - if ( (parent = document.defaultView) && parent.top !== parent ) { - // Support: IE 11 - if ( parent.addEventListener ) { - parent.addEventListener( "unload", unloadHandler, false ); + if ( preferredDoc !== document && + (subWindow = document.defaultView) && subWindow.top !== subWindow ) { + + // Support: IE 11, Edge + if ( subWindow.addEventListener ) { + subWindow.addEventListener( "unload", unloadHandler, false ); // Support: IE 9 - 10 only - } else if ( parent.attachEvent ) { - parent.attachEvent( "onunload", unloadHandler ); + } else if ( subWindow.attachEvent ) { + subWindow.attachEvent( "onunload", unloadHandler ); } } @@ -1068,18 +1146,18 @@ setDocument = Sizzle.setDocument = function( node ) { // Support: IE<8 // Verify that getAttribute really returns attributes and not properties // (excepting IE8 booleans) - support.attributes = assert(function( div ) { - div.className = "i"; - return !div.getAttribute("className"); + support.attributes = assert(function( el ) { + el.className = "i"; + return !el.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( div ) { - div.appendChild( document.createComment("") ); - return !div.getElementsByTagName("*").length; + support.getElementsByTagName = assert(function( el ) { + el.appendChild( document.createComment("") ); + return !el.getElementsByTagName("*").length; }); // Support: IE<9 @@ -1087,32 +1165,28 @@ setDocument = Sizzle.setDocument = function( node ) { // Support: IE<10 // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programatically-set names, + // The broken getElementById methods don't pick up programmatically-set names, // so use a roundabout getElementsByName test - support.getById = assert(function( div ) { - docElem.appendChild( div ).id = expando; + support.getById = assert(function( el ) { + docElem.appendChild( el ).id = expando; return !document.getElementsByName || !document.getElementsByName( expando ).length; }); - // ID find and filter + // ID filter and find if ( support.getById ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var m = context.getElementById( id ); - return m ? [ m ] : []; - } - }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var elem = context.getElementById( id ); + return elem ? [ elem ] : []; + } + }; } else { - // Support: IE6/7 - // getElementById is not reliable as a find shortcut - delete Expr.find["ID"]; - Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { @@ -1121,6 +1195,36 @@ setDocument = Sizzle.setDocument = function( node ) { return node && node.value === attrId; }; }; + + // Support: IE 6 - 7 only + // getElementById is not reliable as a find shortcut + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var node, i, elems, + elem = context.getElementById( id ); + + if ( elem ) { + + // Verify the id attribute + node = elem.getAttributeNode("id"); + if ( node && node.value === id ) { + return [ elem ]; + } + + // Fall back on getElementsByName + elems = context.getElementsByName( id ); + i = 0; + while ( (elem = elems[i++]) ) { + node = elem.getAttributeNode("id"); + if ( node && node.value === id ) { + return [ elem ]; + } + } + } + + return []; + } + }; } // Tag @@ -1174,77 +1278,87 @@ setDocument = Sizzle.setDocument = function( node ) { // We allow this because of a bug in IE8/9 that throws an error // whenever `document.activeElement` is accessed on an iframe // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See http://bugs.jquery.com/ticket/13378 + // See https://bugs.jquery.com/ticket/13378 rbuggyQSA = []; if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { // Build QSA regex // Regex strategy adopted from Diego Perini - assert(function( div ) { + assert(function( el ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - docElem.appendChild( div ).innerHTML = "" + + // https://bugs.jquery.com/ticket/12359 + docElem.appendChild( el ).innerHTML = "" + ""; // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= // The test attribute must be unknown in Opera but "safe" for WinRT - // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( div.querySelectorAll("[msallowcapture^='']").length ) { + // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( el.querySelectorAll("[msallowcapture^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } // Support: IE8 // Boolean attributes and "value" are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { + if ( !el.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { rbuggyQSA.push("~="); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { + if ( !el.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } // Support: Safari 8+, iOS 8+ // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibing-combinator selector` fails - if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { + // In-page `selector#id sibling-combinator selector` fails + if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { rbuggyQSA.push(".#.+[+~]"); } }); - assert(function( div ) { + assert(function( el ) { + el.innerHTML = "" + + ""; + // Support: Windows 8 Native Apps // The type and name attributes are restricted during .innerHTML assignment var input = document.createElement("input"); input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "name", "D" ); + el.appendChild( input ).setAttribute( "name", "D" ); // Support: IE8 // Enforce case-sensitivity of name attribute - if ( div.querySelectorAll("[name=d]").length ) { + if ( el.querySelectorAll("[name=d]").length ) { rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { + if ( el.querySelectorAll(":enabled").length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: IE9-11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + docElem.appendChild( el ).disabled = true; + if ( el.querySelectorAll(":disabled").length !== 2 ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); + el.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } @@ -1255,14 +1369,14 @@ setDocument = Sizzle.setDocument = function( node ) { docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { - assert(function( div ) { + assert(function( el ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); + support.disconnectedMatch = matches.call( el, "*" ); // This should fail with an exception // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); + matches.call( el, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } @@ -1464,6 +1578,10 @@ Sizzle.attr = function( elem, name ) { null; }; +Sizzle.escape = function( sel ) { + return (sel + "").replace( rcssescape, fcssescape ); +}; + Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; @@ -1931,13 +2049,8 @@ Expr = Sizzle.selectors = { }, // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, + "enabled": createDisabledPseudo( false ), + "disabled": createDisabledPseudo( true ), "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements @@ -2139,7 +2252,9 @@ function toSelector( tokens ) { function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", + skip = combinator.next, + key = skip || dir, + checkNonElements = base && key === "parentNode", doneName = done++; return combinator.first ? @@ -2150,6 +2265,7 @@ function addCombinator( matcher, combinator, base ) { return matcher( elem, context, xml ); } } + return false; } : // Check against all ancestor/preceding elements @@ -2175,14 +2291,16 @@ function addCombinator( matcher, combinator, base ) { // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); - if ( (oldCache = uniqueCache[ dir ]) && + if ( skip && skip === elem.nodeName.toLowerCase() ) { + elem = elem[ dir ] || elem; + } else if ( (oldCache = uniqueCache[ key ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements return (newCache[ 2 ] = oldCache[ 2 ]); } else { // Reuse newcache so results back-propagate to previous elements - uniqueCache[ dir ] = newCache; + uniqueCache[ key ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { @@ -2192,6 +2310,7 @@ function addCombinator( matcher, combinator, base ) { } } } + return false; }; } @@ -2554,8 +2673,7 @@ select = Sizzle.select = function( selector, context, results, seed ) { // Reduce context if the leading compound selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { + context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { @@ -2625,17 +2743,17 @@ setDocument(); // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) // Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( div1 ) { +support.sortDetached = assert(function( el ) { // Should return 1, but returns 4 (following) - return div1.compareDocumentPosition( document.createElement("div") ) & 1; + return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; }); // Support: IE<8 // Prevent attribute/property "interpolation" -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( div ) { - div.innerHTML = ""; - return div.firstChild.getAttribute("href") === "#" ; +// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( el ) { + el.innerHTML = ""; + return el.firstChild.getAttribute("href") === "#" ; }) ) { addHandle( "type|href|height|width", function( elem, name, isXML ) { if ( !isXML ) { @@ -2646,10 +2764,10 @@ if ( !assert(function( div ) { // Support: IE<9 // Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( div ) { - div.innerHTML = ""; - div.firstChild.setAttribute( "value", "" ); - return div.firstChild.getAttribute( "value" ) === ""; +if ( !support.attributes || !assert(function( el ) { + el.innerHTML = ""; + el.firstChild.setAttribute( "value", "" ); + return el.firstChild.getAttribute( "value" ) === ""; }) ) { addHandle( "value", function( elem, name, isXML ) { if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { @@ -2660,8 +2778,8 @@ if ( !support.attributes || !assert(function( div ) { // Support: IE<9 // Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( div ) { - return div.getAttribute("disabled") == null; +if ( !assert(function( el ) { + return el.getAttribute("disabled") == null; }) ) { addHandle( booleans, function( elem, name, isXML ) { var val; @@ -2682,11 +2800,15 @@ return Sizzle; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; + +// Deprecated jQuery.expr[ ":" ] = jQuery.expr.pseudos; jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; +jQuery.escapeSelector = Sizzle.escape; + @@ -2721,7 +2843,7 @@ var siblings = function( n, elem ) { var rneedsContext = jQuery.expr.match.needsContext; -var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); +var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); @@ -2731,29 +2853,33 @@ var risSimple = /^.[^:#\[\.,]*$/; function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { - /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; } ); - } + // Single element if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; } ); - } - if ( typeof qualifier === "string" ) { - if ( risSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } - - qualifier = jQuery.filter( qualifier, elements ); + // Arraylike of elements (jQuery, arguments, Array) + if ( typeof qualifier !== "string" ) { + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + } ); } + // Simple selector that can be filtered directly, removing non-Elements + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + // Complex selector, compare the two sets, removing non-Elements + qualifier = jQuery.filter( qualifier, elements ); return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; } ); } @@ -2764,18 +2890,19 @@ jQuery.filter = function( expr, elems, not ) { expr = ":not(" + expr + ")"; } - return elems.length === 1 && elem.nodeType === 1 ? - jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : - jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); + if ( elems.length === 1 && elem.nodeType === 1 ) { + return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; + } + + return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + } ) ); }; jQuery.fn.extend( { find: function( selector ) { - var i, + var i, ret, len = this.length, - ret = [], self = this; if ( typeof selector !== "string" ) { @@ -2788,14 +2915,13 @@ jQuery.fn.extend( { } ) ); } + ret = this.pushStack( [] ); + for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = this.selector ? this.selector + " " + selector : selector; - return ret; + return len > 1 ? jQuery.uniqueSort( ret ) : ret; }, filter: function( selector ) { return this.pushStack( winnow( this, selector || [], false ) ); @@ -2827,7 +2953,8 @@ var rootjQuery, // 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-]*))$/, + // Shortcut simple #id case for speed + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init = jQuery.fn.init = function( selector, context, root ) { var match, elem; @@ -2890,17 +3017,12 @@ var rootjQuery, } else { elem = document.getElementById( match[ 2 ] ); - // Support: Blackberry 4.6 - // gEBID returns nodes no longer in the document (#6963) - if ( elem && elem.parentNode ) { + if ( elem ) { // Inject the element directly into the jQuery object - this.length = 1; this[ 0 ] = elem; + this.length = 1; } - - this.context = document; - this.selector = selector; return this; } @@ -2916,7 +3038,7 @@ var rootjQuery, // HANDLE: $(DOMElement) } else if ( selector.nodeType ) { - this.context = this[ 0 ] = selector; + this[ 0 ] = selector; this.length = 1; return this; @@ -2930,11 +3052,6 @@ var rootjQuery, selector( jQuery ); } - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - return jQuery.makeArray( selector, this ); }; @@ -2975,23 +3092,24 @@ jQuery.fn.extend( { i = 0, l = this.length, matched = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; + targets = typeof selectors !== "string" && jQuery( selectors ); - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { + // Positional selectors never match, since there's no _selection_ context + if ( !rneedsContext.test( selectors ) ) { + for ( ; i < l; i++ ) { + for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - // Always skip document fragments - if ( cur.nodeType < 11 && ( pos ? - pos.index( cur ) > -1 : + // Always skip document fragments + if ( cur.nodeType < 11 && ( targets ? + targets.index( cur ) > -1 : - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector( cur, selectors ) ) ) { - matched.push( cur ); - break; + matched.push( cur ); + break; + } } } } @@ -3106,14 +3224,14 @@ jQuery.each( { return this.pushStack( matched ); }; } ); -var rnotwhite = ( /\S+/g ); +var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); // Convert String-formatted options into Object-formatted ones function createOptions( options ) { var object = {}; - jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { + jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { object[ flag ] = true; } ); return object; @@ -3298,7 +3416,7 @@ jQuery.Callbacks = function( options ) { // Abort any pending executions lock: function() { locked = queue = []; - if ( !memory ) { + if ( !memory && !firing ) { list = memory = ""; } return this; @@ -3336,15 +3454,58 @@ jQuery.Callbacks = function( options ) { }; +function Identity( v ) { + return v; +} +function Thrower( ex ) { + throw ex; +} + +function adoptValue( value, resolve, reject ) { + var method; + + try { + + // Check for promise aspect first to privilege synchronous behavior + if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { + method.call( value ).done( resolve ).fail( reject ); + + // Other thenables + } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { + method.call( value, resolve, reject ); + + // Other non-thenables + } else { + + // Support: Android 4.0 only + // Strict mode functions invoked without .call/.apply get global-object context + resolve.call( undefined, value ); + } + + // For Promises/A+, convert exceptions into rejections + // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in + // Deferred#then to conditionally suppress rejection. + } catch ( value ) { + + // Support: Android 4.0 only + // Strict mode functions invoked without .call/.apply get global-object context + reject.call( undefined, value ); + } +} + jQuery.extend( { Deferred: function( func ) { var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], - [ "notify", "progress", jQuery.Callbacks( "memory" ) ] + // action, add listener, callbacks, + // ... .then handlers, argument index, [final state] + [ "notify", "progress", jQuery.Callbacks( "memory" ), + jQuery.Callbacks( "memory" ), 2 ], + [ "resolve", "done", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 0, "resolved" ], + [ "reject", "fail", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 1, "rejected" ] ], state = "pending", promise = { @@ -3355,13 +3516,23 @@ jQuery.extend( { deferred.done( arguments ).fail( arguments ); return this; }, - then: function( /* fnDone, fnFail, fnProgress */ ) { + "catch": function( fn ) { + return promise.then( null, fn ); + }, + + // Keep pipe for back-compat + pipe: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; + return jQuery.Deferred( function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { - var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer + // Map tuples (progress, done, fail) to arguments (done, fail, progress) + var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; + + // deferred.progress(function() { bind to newDefer or newDefer.notify }) + // deferred.done(function() { bind to newDefer or newDefer.resolve }) + // deferred.fail(function() { bind to newDefer or newDefer.reject }) deferred[ tuple[ 1 ] ]( function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { @@ -3371,7 +3542,7 @@ jQuery.extend( { .fail( newDefer.reject ); } else { newDefer[ tuple[ 0 ] + "With" ]( - this === promise ? newDefer.promise() : this, + this, fn ? [ returned ] : arguments ); } @@ -3380,6 +3551,170 @@ jQuery.extend( { fns = null; } ).promise(); }, + then: function( onFulfilled, onRejected, onProgress ) { + var maxDepth = 0; + function resolve( depth, deferred, handler, special ) { + return function() { + var that = this, + args = arguments, + mightThrow = function() { + var returned, then; + + // Support: Promises/A+ section 2.3.3.3.3 + // https://promisesaplus.com/#point-59 + // Ignore double-resolution attempts + if ( depth < maxDepth ) { + return; + } + + returned = handler.apply( that, args ); + + // Support: Promises/A+ section 2.3.1 + // https://promisesaplus.com/#point-48 + if ( returned === deferred.promise() ) { + throw new TypeError( "Thenable self-resolution" ); + } + + // Support: Promises/A+ sections 2.3.3.1, 3.5 + // https://promisesaplus.com/#point-54 + // https://promisesaplus.com/#point-75 + // Retrieve `then` only once + then = returned && + + // Support: Promises/A+ section 2.3.4 + // https://promisesaplus.com/#point-64 + // Only check objects and functions for thenability + ( typeof returned === "object" || + typeof returned === "function" ) && + returned.then; + + // Handle a returned thenable + if ( jQuery.isFunction( then ) ) { + + // Special processors (notify) just wait for resolution + if ( special ) { + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ) + ); + + // Normal processors (resolve) also hook into progress + } else { + + // ...and disregard older resolution values + maxDepth++; + + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ), + resolve( maxDepth, deferred, Identity, + deferred.notifyWith ) + ); + } + + // Handle all other returned values + } else { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Identity ) { + that = undefined; + args = [ returned ]; + } + + // Process the value(s) + // Default process is resolve + ( special || deferred.resolveWith )( that, args ); + } + }, + + // Only normal processors (resolve) catch and reject exceptions + process = special ? + mightThrow : + function() { + try { + mightThrow(); + } catch ( e ) { + + if ( jQuery.Deferred.exceptionHook ) { + jQuery.Deferred.exceptionHook( e, + process.stackTrace ); + } + + // Support: Promises/A+ section 2.3.3.3.4.1 + // https://promisesaplus.com/#point-61 + // Ignore post-resolution exceptions + if ( depth + 1 >= maxDepth ) { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Thrower ) { + that = undefined; + args = [ e ]; + } + + deferred.rejectWith( that, args ); + } + } + }; + + // Support: Promises/A+ section 2.3.3.3.1 + // https://promisesaplus.com/#point-57 + // Re-resolve promises immediately to dodge false rejection from + // subsequent errors + if ( depth ) { + process(); + } else { + + // Call an optional hook to record the stack, in case of exception + // since it's otherwise lost when execution goes async + if ( jQuery.Deferred.getStackHook ) { + process.stackTrace = jQuery.Deferred.getStackHook(); + } + window.setTimeout( process ); + } + }; + } + + return jQuery.Deferred( function( newDefer ) { + + // progress_handlers.add( ... ) + tuples[ 0 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onProgress ) ? + onProgress : + Identity, + newDefer.notifyWith + ) + ); + + // fulfilled_handlers.add( ... ) + tuples[ 1 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onFulfilled ) ? + onFulfilled : + Identity + ) + ); + + // rejected_handlers.add( ... ) + tuples[ 2 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onRejected ) ? + onRejected : + Thrower + ) + ); + } ).promise(); + }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object @@ -3389,33 +3724,51 @@ jQuery.extend( { }, deferred = {}; - // Keep pipe for back-compat - promise.pipe = promise.then; - // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], - stateString = tuple[ 3 ]; + stateString = tuple[ 5 ]; - // promise[ done | fail | progress ] = list.add + // promise.progress = list.add + // promise.done = list.add + // promise.fail = list.add promise[ tuple[ 1 ] ] = list.add; // Handle state if ( stateString ) { - list.add( function() { + list.add( + function() { - // state = [ resolved | rejected ] - state = stateString; + // state = "resolved" (i.e., fulfilled) + // state = "rejected" + state = stateString; + }, - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + // rejected_callbacks.disable + // fulfilled_callbacks.disable + tuples[ 3 - i ][ 2 ].disable, + + // progress_callbacks.lock + tuples[ 0 ][ 2 ].lock + ); } - // deferred[ resolve | reject | notify ] + // progress_handlers.fire + // fulfilled_handlers.fire + // rejected_handlers.fire + list.add( tuple[ 3 ].fire ); + + // deferred.notify = function() { deferred.notifyWith(...) } + // deferred.resolve = function() { deferred.resolveWith(...) } + // deferred.reject = function() { deferred.rejectWith(...) } deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); + deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); return this; }; + + // deferred.notifyWith = list.fireWith + // deferred.resolveWith = list.fireWith + // deferred.rejectWith = list.fireWith deferred[ tuple[ 0 ] + "With" ] = list.fireWith; } ); @@ -3432,68 +3785,94 @@ jQuery.extend( { }, // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, + when: function( singleValue ) { + var + + // count of uncompleted subordinates + remaining = arguments.length, + + // count of unprocessed arguments + i = remaining, + + // subordinate fulfillment data + resolveContexts = Array( i ), resolveValues = slice.call( arguments ), - length = resolveValues.length, - // the count of uncompleted subordinates - remaining = length !== 1 || - ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + // the master Deferred + master = jQuery.Deferred(), - // the master Deferred. - // If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { + // subordinate callback factory + updateFunc = function( i ) { return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); + resolveContexts[ i ] = this; + resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( !( --remaining ) ) { + master.resolveWith( resolveContexts, resolveValues ); } }; - }, + }; - progressValues, progressContexts, resolveContexts; + // Single- and empty arguments are adopted like Promise.resolve + if ( remaining <= 1 ) { + adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject ); - // Add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .progress( updateFunc( i, progressContexts, progressValues ) ) - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ); - } else { - --remaining; - } + // Use .then() to unwrap secondary thenables (cf. gh-3000) + if ( master.state() === "pending" || + jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { + + return master.then(); } } - // If we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); + // Multiple arguments are aggregated like Promise.all array elements + while ( i-- ) { + adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); } - return deferred.promise(); + return master.promise(); } } ); +// These usually indicate a programmer mistake during development, +// warn about them ASAP rather than swallowing them by default. +var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; + +jQuery.Deferred.exceptionHook = function( error, stack ) { + + // Support: IE 8 - 9 only + // Console exists when dev tools are open, which can happen at any time + if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { + window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); + } +}; + + + + +jQuery.readyException = function( error ) { + window.setTimeout( function() { + throw error; + } ); +}; + + + + // The deferred used on DOM ready -var readyList; +var readyList = jQuery.Deferred(); jQuery.fn.ready = function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); + readyList + .then( fn ) + + // Wrap jQuery.readyException in a function so that the lookup + // happens at the time of error handling instead of callback + // registration. + .catch( function( error ) { + jQuery.readyException( error ); + } ); return this; }; @@ -3534,53 +3913,36 @@ jQuery.extend( { // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.triggerHandler ) { - jQuery( document ).triggerHandler( "ready" ); - jQuery( document ).off( "ready" ); - } } } ); -/** - * The ready event handler and self cleanup method - */ +jQuery.ready.then = readyList.then; + +// The ready event handler and self cleanup method function completed() { document.removeEventListener( "DOMContentLoaded", completed ); window.removeEventListener( "load", completed ); jQuery.ready(); } -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { +// Catch cases where $(document).ready() is called +// after the browser event has already occurred. +// Support: IE <=9 - 10 only +// Older IE sometimes signals "interactive" too soon +if ( document.readyState === "complete" || + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - readyList = jQuery.Deferred(); + // Handle it asynchronously to allow scripts the opportunity to delay ready + window.setTimeout( jQuery.ready ); - // Catch cases where $(document).ready() is called - // after the browser event has already occurred. - // Support: IE9-10 only - // Older IE sometimes signals "interactive" too soon - if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { +} else { - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed ); - } else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); - } - } - return readyList.promise( obj ); -}; - -// Kick off the DOM ready check even if the user does not -jQuery.ready.promise(); + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed ); +} @@ -3634,13 +3996,16 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { } } - return chainable ? - elems : + if ( chainable ) { + return elems; + } - // Gets - bulk ? - fn.call( elems ) : - len ? fn( elems[ 0 ], key ) : emptyGet; + // Gets + if ( bulk ) { + return fn.call( elems ); + } + + return len ? fn( elems[ 0 ], key ) : emptyGet; }; var acceptData = function( owner ) { @@ -3650,7 +4015,6 @@ var acceptData = function( owner ) { // - Node.DOCUMENT_NODE // - Object // - Any - /* jshint -W018 */ return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); }; @@ -3665,35 +4029,8 @@ Data.uid = 1; Data.prototype = { - register: function( owner, initial ) { - var value = initial || {}; - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable, non-writable property - // configurability must be true to allow the property to be - // deleted with the delete operator - } else { - Object.defineProperty( owner, this.expando, { - value: value, - writable: true, - configurable: true - } ); - } - return owner[ this.expando ]; - }, cache: function( owner ) { - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return an empty object. - if ( !acceptData( owner ) ) { - return {}; - } - // Check if the owner object already has a cache var value = owner[ this.expando ]; @@ -3730,15 +4067,16 @@ Data.prototype = { cache = this.cache( owner ); // Handle: [ owner, key, value ] args + // Always use camelCase key (gh-2257) if ( typeof data === "string" ) { - cache[ data ] = value; + cache[ jQuery.camelCase( data ) ] = value; // Handle: [ owner, { properties } ] args } else { // Copy the properties one-by-one to the cache object for ( prop in data ) { - cache[ prop ] = data[ prop ]; + cache[ jQuery.camelCase( prop ) ] = data[ prop ]; } } return cache; @@ -3746,10 +4084,11 @@ Data.prototype = { get: function( owner, key ) { return key === undefined ? this.cache( owner ) : - owner[ this.expando ] && owner[ this.expando ][ key ]; + + // Always use camelCase key (gh-2257) + owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; }, access: function( owner, key, value ) { - var stored; // In cases where either: // @@ -3765,10 +4104,7 @@ Data.prototype = { if ( key === undefined || ( ( key && typeof key === "string" ) && value === undefined ) ) { - stored = this.get( owner, key ); - - return stored !== undefined ? - stored : this.get( owner, jQuery.camelCase( key ) ); + return this.get( owner, key ); } // When the key is not a string, or both a key and value @@ -3784,58 +4120,45 @@ Data.prototype = { return value !== undefined ? value : key; }, remove: function( owner, key ) { - var i, name, camel, + var i, cache = owner[ this.expando ]; if ( cache === undefined ) { return; } - if ( key === undefined ) { - this.register( owner ); - - } else { + if ( key !== undefined ) { // Support array or space separated string of keys if ( jQuery.isArray( key ) ) { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = key.concat( key.map( jQuery.camelCase ) ); + // If key is an array of keys... + // We always set camelCase keys, so remove that. + key = key.map( jQuery.camelCase ); } else { - camel = jQuery.camelCase( key ); + key = jQuery.camelCase( key ); - // Try the string as a key before any manipulation - if ( key in cache ) { - name = [ key, camel ]; - } else { - - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - name = camel; - name = name in cache ? - [ name ] : ( name.match( rnotwhite ) || [] ); - } + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + key = key in cache ? + [ key ] : + ( key.match( rnothtmlwhite ) || [] ); } - i = name.length; + i = key.length; while ( i-- ) { - delete cache[ name[ i ] ]; + delete cache[ key[ i ] ]; } } // Remove the expando if there's no more data if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - // Support: Chrome <= 35-45+ + // Support: Chrome <=35 - 45 // Webkit & Blink performance suffers when deleting properties // from DOM nodes, so set to undefined instead - // https://code.google.com/p/chromium/issues/detail?id=378607 + // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) if ( owner.nodeType ) { owner[ this.expando ] = undefined; } else { @@ -3867,6 +4190,31 @@ var dataUser = new Data(); var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g; +function getData( data ) { + if ( data === "true" ) { + return true; + } + + if ( data === "false" ) { + return false; + } + + if ( data === "null" ) { + return null; + } + + // Only convert to a number if it doesn't change the string + if ( data === +data + "" ) { + return +data; + } + + if ( rbrace.test( data ) ) { + return JSON.parse( data ); + } + + return data; +} + function dataAttr( elem, key, data ) { var name; @@ -3878,14 +4226,7 @@ function dataAttr( elem, key, data ) { if ( typeof data === "string" ) { try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; + data = getData( data ); } catch ( e ) {} // Make sure we set the data so it isn't changed later @@ -3936,7 +4277,7 @@ jQuery.fn.extend( { i = attrs.length; while ( i-- ) { - // Support: IE11+ + // Support: IE 11 only // The attrs elements can be null (#14894) if ( attrs[ i ] ) { name = attrs[ i ].name; @@ -3961,7 +4302,7 @@ jQuery.fn.extend( { } return access( this, function( value ) { - var data, camelKey; + var data; // The calling jQuery object (element matches) is not empty // (and therefore has an element appears at this[ 0 ]) and the @@ -3971,29 +4312,15 @@ jQuery.fn.extend( { if ( elem && value === undefined ) { // Attempt to get data from the cache - // with the key as-is - data = dataUser.get( elem, key ) || - - // Try to find dashed key if it exists (gh-2779) - // This is for 2.2.x only - dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() ); - - if ( data !== undefined ) { - return data; - } - - camelKey = jQuery.camelCase( key ); - - // Attempt to get data from the cache - // with the key camelized - data = dataUser.get( elem, camelKey ); + // The key will always be camelCased in Data + data = dataUser.get( elem, key ); if ( data !== undefined ) { return data; } // Attempt to "discover" the data in // HTML5 custom data-* attrs - data = dataAttr( elem, camelKey, undefined ); + data = dataAttr( elem, key ); if ( data !== undefined ) { return data; } @@ -4003,24 +4330,10 @@ jQuery.fn.extend( { } // Set the data... - camelKey = jQuery.camelCase( key ); this.each( function() { - // First, attempt to store a copy or reference of any - // data that might've been store with a camelCased key. - var data = dataUser.get( this, camelKey ); - - // For HTML5 data-* attribute interop, we have to - // store property names with dashes in a camelCase form. - // This might not apply to all properties...* - dataUser.set( this, camelKey, value ); - - // *... In the case of properties that might _actually_ - // have dashes, we need to also store a copy of that - // unchanged property. - if ( key.indexOf( "-" ) > -1 && data !== undefined ) { - dataUser.set( this, key, value ); - } + // We always store the camelCased key + dataUser.set( this, key, value ); } ); }, null, value, arguments.length > 1, null, true ); }, @@ -4173,15 +4486,46 @@ var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; -var isHidden = function( elem, el ) { +var isHiddenWithinTree = function( elem, el ) { - // isHidden might be called from jQuery#filter function; + // isHiddenWithinTree 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 ); + + // Inline style trumps all + return elem.style.display === "none" || + elem.style.display === "" && + + // Otherwise, check computed style + // Support: Firefox <=43 - 45 + // Disconnected elements can have computed display: none, so first confirm that elem is + // in the document. + jQuery.contains( elem.ownerDocument, elem ) && + + jQuery.css( elem, "display" ) === "none"; }; +var 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; +}; + + function adjustCSS( elem, prop, valueParts, tween ) { @@ -4189,8 +4533,12 @@ function adjustCSS( elem, prop, valueParts, tween ) { scale = 1, maxIterations = 20, currentValue = tween ? - function() { return tween.cur(); } : - function() { return jQuery.css( elem, prop, "" ); }, + function() { + return tween.cur(); + } : + function() { + return jQuery.css( elem, prop, "" ); + }, initial = currentValue(), unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), @@ -4241,9 +4589,105 @@ function adjustCSS( elem, prop, valueParts, tween ) { } return adjusted; } + + +var defaultDisplayMap = {}; + +function getDefaultDisplay( elem ) { + var temp, + doc = elem.ownerDocument, + nodeName = elem.nodeName, + display = defaultDisplayMap[ nodeName ]; + + if ( display ) { + return display; + } + + temp = doc.body.appendChild( doc.createElement( nodeName ) ); + display = jQuery.css( temp, "display" ); + + temp.parentNode.removeChild( temp ); + + if ( display === "none" ) { + display = "block"; + } + defaultDisplayMap[ nodeName ] = display; + + return display; +} + +function showHide( elements, show ) { + var display, elem, + values = [], + index = 0, + length = elements.length; + + // Determine new display value for elements that need to change + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + display = elem.style.display; + if ( show ) { + + // Since we force visibility upon cascade-hidden elements, an immediate (and slow) + // check is required in this first loop unless we have a nonempty display value (either + // inline or about-to-be-restored) + if ( display === "none" ) { + values[ index ] = dataPriv.get( elem, "display" ) || null; + if ( !values[ index ] ) { + elem.style.display = ""; + } + } + if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { + values[ index ] = getDefaultDisplay( elem ); + } + } else { + if ( display !== "none" ) { + values[ index ] = "none"; + + // Remember what we're overwriting + dataPriv.set( elem, "display", display ); + } + } + } + + // Set the display of the elements in a second loop to avoid constant reflow + for ( index = 0; index < length; index++ ) { + if ( values[ index ] != null ) { + elements[ index ].style.display = values[ index ]; + } + } + + return elements; +} + +jQuery.fn.extend( { + 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 ( isHiddenWithinTree( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + } ); + } +} ); var rcheckableType = ( /^(?:checkbox|radio)$/i ); -var rtagName = ( /<([\w:-]+)/ ); +var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); var rscriptType = ( /^$|\/(?:java|ecma)script/i ); @@ -4252,7 +4696,7 @@ var rscriptType = ( /^$|\/(?:java|ecma)script/i ); // We have to close these tags to support XHTML (#13200) var wrapMap = { - // Support: IE9 + // Support: IE <=9 only option: [ 1, "" ], // XHTML parsers do not magically insert elements in the @@ -4266,7 +4710,7 @@ var wrapMap = { _default: [ 0, "", "" ] }; -// Support: IE9 +// Support: IE <=9 only wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; @@ -4275,17 +4719,25 @@ wrapMap.th = wrapMap.td; function getAll( context, tag ) { - // Support: IE9-11+ + // Support: IE <=9 - 11 only // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== "undefined" ? - context.querySelectorAll( tag || "*" ) : - []; + var ret; - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], ret ) : - ret; + if ( typeof context.getElementsByTagName !== "undefined" ) { + ret = context.getElementsByTagName( tag || "*" ); + + } else if ( typeof context.querySelectorAll !== "undefined" ) { + ret = context.querySelectorAll( tag || "*" ); + + } else { + ret = []; + } + + if ( tag === undefined || tag && jQuery.nodeName( context, tag ) ) { + return jQuery.merge( [ context ], ret ); + } + + return ret; } @@ -4321,7 +4773,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { // Add nodes directly if ( jQuery.type( elem ) === "object" ) { - // Support: Android<4.1, PhantomJS<2 + // Support: Android <=4.0 only, PhantomJS 1 only // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); @@ -4344,7 +4796,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { tmp = tmp.lastChild; } - // Support: Android<4.1, PhantomJS<2 + // Support: Android <=4.0 only, PhantomJS 1 only // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, tmp.childNodes ); @@ -4401,7 +4853,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { div = fragment.appendChild( document.createElement( "div" ) ), input = document.createElement( "input" ); - // Support: Android 4.0-4.3, Safari<=5.1 + // Support: Android 4.0 - 4.3 only // Check state lost if the name is set (#11217) // Support: Windows Web Apps (WWA) // `name` and `type` must use .setAttribute for WWA (#14901) @@ -4411,15 +4863,17 @@ function buildFragment( elems, context, scripts, selection, ignored ) { div.appendChild( input ); - // Support: Safari<=5.1, Android<4.2 + // Support: Android <=4.1 only // Older WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - // Support: IE<=11+ + // Support: IE <=11 only // Make sure textarea (and checkbox) defaultValue is properly cloned div.innerHTML = ""; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; } )(); +var documentElement = document.documentElement; + var @@ -4435,7 +4889,7 @@ function returnFalse() { return false; } -// Support: IE9 +// Support: IE <=9 only // See #13393 for more info function safeActiveElement() { try { @@ -4531,6 +4985,12 @@ jQuery.event = { selector = handleObjIn.selector; } + // Ensure that invalid selectors throw exceptions at attach time + // Evaluate against documentElement in case elem is a non-element node (e.g., document) + if ( selector ) { + jQuery.find.matchesSelector( documentElement, selector ); + } + // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; @@ -4551,7 +5011,7 @@ jQuery.event = { } // Handle multiple events separated by a space - types = ( types || "" ).match( rnotwhite ) || [ "" ]; + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; @@ -4633,7 +5093,7 @@ jQuery.event = { } // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnotwhite ) || [ "" ]; + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; @@ -4694,19 +5154,23 @@ jQuery.event = { } }, - dispatch: function( event ) { + dispatch: function( nativeEvent ) { // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); + var event = jQuery.event.fix( nativeEvent ); - var i, j, ret, matched, handleObj, - handlerQueue = [], - args = slice.call( arguments ), + var i, j, ret, matched, handleObj, handlerQueue, + args = new Array( arguments.length ), handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[ 0 ] = event; + + for ( i = 1; i < arguments.length; i++ ) { + args[ i ] = arguments[ i ]; + } + event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired @@ -4755,146 +5219,95 @@ jQuery.event = { }, handlers: function( event, handlers ) { - var i, matches, sel, handleObj, + var i, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; - // Support (at least): Chrome, IE9 // Find delegate handlers - // Black-hole SVG instance trees (#13180) - // - // Support: Firefox<=42+ - // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) - if ( delegateCount && cur.nodeType && - ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { + if ( delegateCount && + + // Support: IE <=9 + // Black-hole SVG instance trees (trac-13180) + cur.nodeType && + + // Support: Firefox <=42 + // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) + // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click + // Support: IE 11 only + // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) + !( event.type === "click" && event.button >= 1 ) ) { for ( ; cur !== this; cur = cur.parentNode || this ) { // Don't check non-elements (#13208) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { - matches = []; + if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { + matchedHandlers = []; + matchedSelectors = {}; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? + if ( matchedSelectors[ sel ] === undefined ) { + matchedSelectors[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) > -1 : jQuery.find( sel, this, null, [ cur ] ).length; } - if ( matches[ sel ] ) { - matches.push( handleObj ); + if ( matchedSelectors[ sel ] ) { + matchedHandlers.push( handleObj ); } } - if ( matches.length ) { - handlerQueue.push( { elem: cur, handlers: matches } ); + if ( matchedHandlers.length ) { + handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); } } } } // Add the remaining (directly-bound) handlers + cur = this; if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); + handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); } return handlerQueue; }, - // Includes some event props shared by KeyEvent and MouseEvent - props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + - "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), + addProp: function( name, hook ) { + Object.defineProperty( jQuery.Event.prototype, name, { + enumerable: true, + configurable: true, - fixHooks: {}, + get: jQuery.isFunction( hook ) ? + function() { + if ( this.originalEvent ) { + return hook( this.originalEvent ); + } + } : + function() { + if ( this.originalEvent ) { + return this.originalEvent[ name ]; + } + }, - keyHooks: { - props: "char charCode key keyCode".split( " " ), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; + set: function( value ) { + Object.defineProperty( this, name, { + enumerable: true, + configurable: true, + writable: true, + value: value + } ); } - - return event; - } + } ); }, - mouseHooks: { - props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " + - "screenX screenY toElement" ).split( " " ), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + - ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + - ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: Cordova 2.5 (WebKit) (#13255) - // All events should have a target; Cordova deviceready doesn't - if ( !event.target ) { - event.target = document; - } - - // Support: Safari 6.0+, Chrome<28 - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + fix: function( originalEvent ) { + return originalEvent[ jQuery.expando ] ? + originalEvent : + new jQuery.Event( originalEvent ); }, special: { @@ -4977,11 +5390,21 @@ jQuery.Event = function( src, props ) { this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && - // Support: Android<4.0 + // Support: Android <=2.3 only src.returnValue === false ? returnTrue : returnFalse; + // Create target properties + // Support: Safari <=6 - 7 only + // Target should not be a text node (#504, #13143) + this.target = ( src.target && src.target.nodeType === 3 ) ? + src.target.parentNode : + src.target; + + this.currentTarget = src.currentTarget; + this.relatedTarget = src.relatedTarget; + // Event type } else { this.type = src; @@ -5000,7 +5423,7 @@ jQuery.Event = function( src, props ) { }; // 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 +// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { constructor: jQuery.Event, isDefaultPrevented: returnFalse, @@ -5039,13 +5462,74 @@ jQuery.Event.prototype = { } }; +// Includes all common event props including KeyEvent and MouseEvent specific props +jQuery.each( { + altKey: true, + bubbles: true, + cancelable: true, + changedTouches: true, + ctrlKey: true, + detail: true, + eventPhase: true, + metaKey: true, + pageX: true, + pageY: true, + shiftKey: true, + view: true, + "char": true, + charCode: true, + key: true, + keyCode: true, + button: true, + buttons: true, + clientX: true, + clientY: true, + offsetX: true, + offsetY: true, + pointerId: true, + pointerType: true, + screenX: true, + screenY: true, + targetTouches: true, + toElement: true, + touches: true, + + which: function( event ) { + var button = event.button; + + // Add which for key events + if ( event.which == null && rkeyEvent.test( event.type ) ) { + return event.charCode != null ? event.charCode : event.keyCode; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { + if ( button & 1 ) { + return 1; + } + + if ( button & 2 ) { + return 3; + } + + if ( button & 4 ) { + return 2; + } + + return 0; + } + + return event.which; + } +}, jQuery.event.addProp ); + // Create mouseenter/leave events using mouseover/out and event-time checks // so that event delegation works in jQuery. // Do the same for pointerenter/pointerleave and pointerover/pointerout // // Support: Safari 7 only // Safari sends mouseenter too often; see: -// https://code.google.com/p/chromium/issues/detail?id=470258 +// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 // for the description of the bug (it existed in older Chrome versions as well). jQuery.each( { mouseenter: "mouseover", @@ -5076,6 +5560,7 @@ jQuery.each( { } ); jQuery.fn.extend( { + on: function( types, selector, data, fn ) { return on( this, types, selector, data, fn ); }, @@ -5122,9 +5607,15 @@ jQuery.fn.extend( { var - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, - // Support: IE 10-11, Edge 10240+ + /* eslint-disable max-len */ + + // See https://github.com/eslint/eslint/issues/3229 + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, + + /* eslint-enable */ + + // Support: IE <=10 - 11, Edge 12 - 13 // In IE/Edge using regex groups here causes severe slowdowns. // See https://connect.microsoft.com/IE/feedback/details/1736512/ rnoInnerhtml = /\s*$/g; -// Manipulating tables requires a tbody function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? + if ( jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - elem.getElementsByTagName( "tbody" )[ 0 ] || - elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) : - elem; + return elem.getElementsByTagName( "tbody" )[ 0 ] || elem; + } + + return elem; } // Replace/restore the type attribute of script elements for safe DOM manipulation @@ -5259,7 +5750,7 @@ function domManip( collection, args, callback, ignored ) { // Keep references to cloned scripts for later restoration if ( hasScripts ) { - // Support: Android<4.1, PhantomJS<2 + // Support: Android <=4.0 only, PhantomJS 1 only // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( scripts, getAll( node, "script" ) ); } @@ -5288,7 +5779,7 @@ function domManip( collection, args, callback, ignored ) { jQuery._evalUrl( node.src ); } } else { - jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); + DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); } } } @@ -5334,7 +5825,7 @@ jQuery.extend( { if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); @@ -5387,13 +5878,13 @@ jQuery.extend( { } } - // Support: Chrome <= 35-45+ + // Support: Chrome <=35 - 45+ // Assign undefined instead of using delete, see Data#remove elem[ dataPriv.expando ] = undefined; } if ( elem[ dataUser.expando ] ) { - // Support: Chrome <= 35-45+ + // Support: Chrome <=35 - 45+ // Assign undefined instead of using delete, see Data#remove elem[ dataUser.expando ] = undefined; } @@ -5403,10 +5894,6 @@ jQuery.extend( { } ); jQuery.fn.extend( { - - // Keep domManip exposed until 3.0 (gh-2225) - domManip: domManip, - detach: function( selector ) { return remove( this, selector, true ); }, @@ -5564,86 +6051,21 @@ jQuery.each( { elems = i === last ? this : this.clone( true ); jQuery( insert[ i ] )[ original ]( elems ); - // Support: QtWebKit - // .get() because push.apply(_, arraylike) throws + // Support: Android <=4.0 only, PhantomJS 1 only + // .get() because push.apply(_, arraylike) throws on ancient WebKit push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; } ); - - -var iframe, - elemdisplay = { - - // Support: Firefox - // We have to pre-define these values for FF (#10227) - HTML: "block", - BODY: "block" - }; - -/** - * Retrieve the actual display of a element - * @param {String} name nodeName of the element - * @param {Object} doc Document object - */ - -// Called only from within defaultDisplay -function actualDisplay( name, doc ) { - var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), - - display = jQuery.css( elem[ 0 ], "display" ); - - // We don't have any data stored on the element, - // so use "detach" method as fast way to get rid of the element - elem.detach(); - - return display; -} - -/** - * Try to determine the default display value of an element - * @param {String} nodeName - */ -function defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - - // Use the already-created iframe if possible - iframe = ( iframe || jQuery( "