Built motion from commit 943eae279.|1.0.24
[motion.git] / public / bower_components / angular-scenario / angular-scenario.js
index 5215ced..7ce72f8 100644 (file)
@@ -1,27 +1,27 @@
 /*!
- * jQuery JavaScript Library v3.2.1
- * https://jquery.com/
+ * jQuery JavaScript Library v2.1.1
+ * http://jquery.com/
  *
  * Includes Sizzle.js
- * https://sizzlejs.com/
+ * http://sizzlejs.com/
  *
- * Copyright JS Foundation and other contributors
+ * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
  * Released under the MIT license
- * https://jquery.org/license
+ * http://jquery.org/license
  *
- * Date: 2017-03-20T18:59Z
+ * Date: 2014-05-01T17:11Z
  */
-( function( global, factory ) {
 
-if ( typeof module === "object" && typeof module.exports === "object" ) {
+(function( global, factory ) {'use strict';
 
-               // 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`
-               // (such as Node.js), expose a factory as module.exports.
-               // This accentuates the need for the creation of a real `window`.
+       if ( typeof module === "object" && typeof module.exports === "object" ) {
+               // For CommonJS and CommonJS-like environments where a proper window is present,
+               // execute the factory and get jQuery
+               // For environments that do not inherently posses a window with a document
+               // (such as Node.js), expose a jQuery-making factory as module.exports
+               // This accentuates the need for the creation of a real window
                // e.g. var jQuery = require("jquery")(window);
-               // See ticket #14549 for more info.
+               // See ticket #14549 for more info
                module.exports = global.document ?
                        factory( global, true ) :
                        function( w ) {
@@ -35,19 +35,16 @@ if ( typeof module === "object" && typeof module.exports === "object" ) {
        }
 
 // 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.
+// Can't do this because several apps including ASP.NET trace
+// the stack via arguments.caller.callee and Firefox dies if
+// you try to trace through "use strict" call chains. (#13335)
+// Support: Firefox 18+
+//
 
 var arr = [];
 
-var document = window.document;
-
-var getProto = Object.getPrototypeOf;
-
 var slice = arr.slice;
 
 var concat = arr.concat;
@@ -62,46 +59,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 = "3.2.1",
+       // Use the correct document accordingly with window argument (sandbox)
+       document = window.document,
+
+       version = "2.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
+       // Support: Android<4.1
        // 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,
+       rdashAlpha = /-([\da-z])/gi,
 
        // Used by jQuery.camelCase as callback to replace()
        fcamelCase = function( all, letter ) {
@@ -109,12 +90,14 @@ var
        };
 
 jQuery.fn = jQuery.prototype = {
-
        // The current version of jQuery being used
        jquery: version,
 
        constructor: jQuery,
 
+       // Start with an empty selector
+       selector: "",
+
        // The default length of a jQuery object is 0
        length: 0,
 
@@ -125,14 +108,13 @@ 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 all the elements in a clean array
-               if ( num == null ) {
-                       return slice.call( this );
-               }
+                       // Return just the one element from the set
+                       ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
 
-               // Return just the one element from the set
-               return num < 0 ? this[ num + this.length ] : this[ num ];
+                       // Return all the elements in a clean array
+                       slice.call( this );
        },
 
        // Take an array of elements and push it onto the stack
@@ -144,20 +126,23 @@ 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;
        },
 
        // Execute a callback for every element in the matched set.
-       each: function( callback ) {
-               return jQuery.each( this, callback );
+       // (You can seed the arguments with an array of args, but this is
+       // only used internally.)
+       each: function( callback, args ) {
+               return jQuery.each( this, callback, args );
        },
 
        map: function( callback ) {
-               return this.pushStack( jQuery.map( this, function( elem, i ) {
+               return this.pushStack( jQuery.map(this, function( elem, i ) {
                        return callback.call( elem, i, elem );
-               } ) );
+               }));
        },
 
        slice: function() {
@@ -175,11 +160,11 @@ jQuery.fn = jQuery.prototype = {
        eq: function( i ) {
                var len = this.length,
                        j = +i + ( i < 0 ? len : 0 );
-               return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
+               return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
        },
 
        end: function() {
-               return this.prevObject || this.constructor();
+               return this.prevObject || this.constructor(null);
        },
 
        // For internal use only.
@@ -191,7 +176,7 @@ jQuery.fn = jQuery.prototype = {
 
 jQuery.extend = jQuery.fn.extend = function() {
        var options, name, src, copy, copyIsArray, clone,
-               target = arguments[ 0 ] || {},
+               target = arguments[0] || {},
                i = 1,
                length = arguments.length,
                deep = false;
@@ -200,27 +185,25 @@ jQuery.extend = jQuery.fn.extend = function() {
        if ( typeof target === "boolean" ) {
                deep = target;
 
-               // Skip the boolean and the 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 ) ) {
+       if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
                target = {};
        }
 
-       // Extend jQuery itself if only one argument is passed
+       // 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 ) {
-
+               if ( (options = arguments[ i ]) != null ) {
                        // Extend the base object
                        for ( name in options ) {
                                src = target[ name ];
@@ -232,15 +215,13 @@ jQuery.extend = jQuery.fn.extend = function() {
                                }
 
                                // Recurse if we're merging plain objects or arrays
-                               if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
-                                       ( copyIsArray = Array.isArray( copy ) ) ) ) {
-
+                               if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
                                        if ( copyIsArray ) {
                                                copyIsArray = false;
-                                               clone = src && Array.isArray( src ) ? src : [];
+                                               clone = src && jQuery.isArray(src) ? src : [];
 
                                        } else {
-                                               clone = src && jQuery.isPlainObject( src ) ? src : {};
+                                               clone = src && jQuery.isPlainObject(src) ? src : {};
                                        }
 
                                        // Never move original objects, clone them
@@ -258,8 +239,7 @@ jQuery.extend = jQuery.fn.extend = function() {
        return target;
 };
 
-jQuery.extend( {
-
+jQuery.extend({
        // Unique for each copy of jQuery on the page
        expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
 
@@ -272,55 +252,47 @@ jQuery.extend( {
 
        noop: function() {},
 
+       // See test/unit/core.js for details concerning isFunction.
+       // Since version 1.3, DOM methods and functions like alert
+       // aren't supported. They return false on IE (#2968).
        isFunction: function( obj ) {
-               return jQuery.type( obj ) === "function";
+               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 ) );
+               // parseFloat NaNs numeric-cast false positives (null|true|false|"")
+               // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
+               // subtraction forces infinities to NaN
+               return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0;
        },
 
        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]" ) {
+               // 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 ) ) {
                        return false;
                }
 
-               proto = getProto( obj );
-
-               // Objects with no prototype (e.g., `Object.create( null )`) are plain
-               if ( !proto ) {
-                       return true;
+               if ( obj.constructor &&
+                               !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
+                       return false;
                }
 
-               // 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;
+               // If the function hasn't returned already, we're confident that
+               // |obj| is a plain object, created by {} or constructed with new Object
+               return true;
        },
 
        isEmptyObject: function( obj ) {
-
-               /* eslint-disable no-unused-vars */
-               // See https://github.com/eslint/eslint/issues/6125
                var name;
-
                for ( name in obj ) {
                        return false;
                }
@@ -331,39 +303,88 @@ jQuery.extend( {
                if ( obj == null ) {
                        return obj + "";
                }
-
-               // Support: Android <=2.3 only (functionish RegExp)
+               // Support: Android < 4.0, iOS < 6 (functionish RegExp)
                return typeof obj === "object" || typeof obj === "function" ?
-                       class2type[ toString.call( obj ) ] || "object" :
+                       class2type[ toString.call(obj) ] || "object" :
                        typeof obj;
        },
 
        // Evaluates a script in a global context
        globalEval: function( code ) {
-               DOMEval( 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 );
+                       }
+               }
        },
 
        // 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 );
        },
 
-       each: function( obj, callback ) {
-               var length, i = 0;
+       nodeName: function( elem, name ) {
+               return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+       },
 
-               if ( isArrayLike( obj ) ) {
-                       length = obj.length;
-                       for ( ; i < length; i++ ) {
-                               if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
-                                       break;
+       // args is for internal usage only
+       each: function( obj, callback, args ) {
+               var value,
+                       i = 0,
+                       length = obj.length,
+                       isArray = isArraylike( obj );
+
+               if ( args ) {
+                       if ( isArray ) {
+                               for ( ; i < length; i++ ) {
+                                       value = callback.apply( obj[ i ], args );
+
+                                       if ( value === false ) {
+                                               break;
+                                       }
+                               }
+                       } else {
+                               for ( i in obj ) {
+                                       value = callback.apply( obj[ i ], args );
+
+                                       if ( value === false ) {
+                                               break;
+                                       }
                                }
                        }
+
+               // A special, fast, case for the most common use of each
                } else {
-                       for ( i in obj ) {
-                               if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
-                                       break;
+                       if ( isArray ) {
+                               for ( ; i < length; i++ ) {
+                                       value = callback.call( obj[ i ], i, obj[ i ] );
+
+                                       if ( value === false ) {
+                                               break;
+                                       }
+                               }
+                       } else {
+                               for ( i in obj ) {
+                                       value = callback.call( obj[ i ], i, obj[ i ] );
+
+                                       if ( value === false ) {
+                                               break;
+                                       }
                                }
                        }
                }
@@ -371,7 +392,7 @@ jQuery.extend( {
                return obj;
        },
 
-       // Support: Android <=4.0 only
+       // Support: Android<4.1
        trim: function( text ) {
                return text == null ?
                        "" :
@@ -383,7 +404,7 @@ jQuery.extend( {
                var ret = results || [];
 
                if ( arr != null ) {
-                       if ( isArrayLike( Object( arr ) ) ) {
+                       if ( isArraylike( Object(arr) ) ) {
                                jQuery.merge( ret,
                                        typeof arr === "string" ?
                                        [ arr ] : arr
@@ -400,8 +421,6 @@ 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,
@@ -437,13 +456,14 @@ jQuery.extend( {
 
        // arg is for internal usage only
        map: function( elems, callback, arg ) {
-               var length, value,
+               var value,
                        i = 0,
+                       length = elems.length,
+                       isArray = isArraylike( elems ),
                        ret = [];
 
                // Go through the array, translating each of the items to their new values
-               if ( isArrayLike( elems ) ) {
-                       length = elems.length;
+               if ( isArray ) {
                        for ( ; i < length; i++ ) {
                                value = callback( elems[ i ], i, arg );
 
@@ -504,46 +524,40 @@ jQuery.extend( {
        // 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 ) {
+jQuery.each("Boolean Number String Function Array Date RegExp Object Error".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,
+function isArraylike( obj ) {
+       var length = obj.length,
                type = jQuery.type( obj );
 
        if ( type === "function" || jQuery.isWindow( obj ) ) {
                return false;
        }
 
+       if ( obj.nodeType === 1 && length ) {
+               return true;
+       }
+
        return type === "array" || length === 0 ||
                typeof length === "number" && length > 0 && ( length - 1 ) in obj;
 }
 var Sizzle =
 /*!
- * Sizzle CSS Selector Engine v2.3.3
- * https://sizzlejs.com/
+ * Sizzle CSS Selector Engine v1.10.19
+ * http://sizzlejs.com/
  *
- * Copyright jQuery Foundation and other contributors
+ * Copyright 2013 jQuery Foundation, Inc. and other contributors
  * Released under the MIT license
  * http://jquery.org/license
  *
- * Date: 2016-08-08
+ * Date: 2014-04-18
  */
-(function( window ) {'use strict';
+(function( window ) {
 
 var i,
        support,
@@ -568,7 +582,7 @@ var i,
        contains,
 
        // Instance-specific data
-       expando = "sizzle" + 1 * new Date(),
+       expando = "sizzle" + -(new Date()),
        preferredDoc = window.document,
        dirruns = 0,
        done = 0,
@@ -582,6 +596,10 @@ var i,
                return 0;
        },
 
+       // General-purpose constants
+       strundefined = typeof undefined,
+       MAX_NEGATIVE = 1 << 31,
+
        // Instance methods
        hasOwn = ({}).hasOwnProperty,
        arr = [],
@@ -589,13 +607,12 @@ var i,
        push_native = arr.push,
        push = arr.push,
        slice = arr.slice,
-       // Use a stripped-down indexOf as it's faster than native
-       // https://jsperf.com/thor-indexof-vs-for/5
-       indexOf = function( list, elem ) {
+       // Use a stripped-down indexOf if we can't use a native one
+       indexOf = arr.indexOf || function( elem ) {
                var i = 0,
-                       len = list.length;
+                       len = this.length;
                for ( ; i < len; i++ ) {
-                       if ( list[i] === elem ) {
+                       if ( this[i] === elem ) {
                                return i;
                        }
                }
@@ -606,21 +623,25 @@ var i,
 
        // Regular expressions
 
-       // http://www.w3.org/TR/css3-selectors/#whitespace
+       // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
        whitespace = "[\\x20\\t\\r\\n\\f]",
+       // http://www.w3.org/TR/css3-syntax/#characters
+       characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
 
-       // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
-       identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
+       // Loosely modeled on CSS identifier characters
+       // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
+       // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+       identifier = characterEncoding.replace( "w", "w#" ),
 
        // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
-       attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
+       attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
                // Operator (capture 2)
                "*([*^$|!~]?=)" + whitespace +
                // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
                "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
                "*\\]",
 
-       pseudos = ":(" + identifier + ")(?:\\((" +
+       pseudos = ":(" + characterEncoding + ")(?:\\((" +
                // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
                // 1. quoted (capture 3; capture 4 or capture 5)
                "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
@@ -631,7 +652,6 @@ var i,
                ")\\)|)",
 
        // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
-       rwhitespace = new RegExp( whitespace + "+", "g" ),
        rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
 
        rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
@@ -643,9 +663,9 @@ var i,
        ridentifier = new RegExp( "^" + identifier + "$" ),
 
        matchExpr = {
-               "ID": new RegExp( "^#(" + identifier + ")" ),
-               "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
-               "TAG": new RegExp( "^(" + identifier + "|[*])" ),
+               "ID": new RegExp( "^#(" + characterEncoding + ")" ),
+               "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
+               "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
                "ATTR": new RegExp( "^" + attributes ),
                "PSEUDO": new RegExp( "^" + pseudos ),
                "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
@@ -667,9 +687,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;
@@ -683,41 +703,7 @@ var i,
                                String.fromCharCode( high + 0x10000 ) :
                                // Supplemental Plane codepoint (surrogate pair)
                                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 {
@@ -749,128 +735,104 @@ try {
 }
 
 function Sizzle( selector, context, results, seed ) {
-       var m, i, elem, nid, match, groups, newSelector,
-               newContext = context && context.ownerDocument,
+       var match, elem, m, nodeType,
+               // QSA vars
+               i, groups, old, nid, newContext, newSelector;
 
-               // nodeType defaults to 9, since context defaults to document
-               nodeType = context ? context.nodeType : 9;
+       if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
+               setDocument( context );
+       }
 
+       context = context || document;
        results = results || [];
 
-       // Return early from calls with invalid selector or context
-       if ( typeof selector !== "string" || !selector ||
-               nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
-
+       if ( !selector || typeof selector !== "string" ) {
                return results;
        }
 
-       // Try to shortcut find operations (as opposed to filters) in HTML documents
-       if ( !seed ) {
-
-               if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
-                       setDocument( context );
-               }
-               context = context || document;
-
-               if ( documentIsHTML ) {
-
-                       // If the selector is sufficiently simple, try using a "get*By*" DOM method
-                       // (excepting DocumentFragment context, where the methods don't exist)
-                       if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
-
-                               // ID selector
-                               if ( (m = match[1]) ) {
-
-                                       // Document context
-                                       if ( nodeType === 9 ) {
-                                               if ( (elem = context.getElementById( m )) ) {
-
-                                                       // Support: IE, Opera, Webkit
-                                                       // TODO: identify versions
-                                                       // getElementById can match elements by name instead of ID
-                                                       if ( elem.id === m ) {
-                                                               results.push( elem );
-                                                               return results;
-                                                       }
-                                               } else {
-                                                       return results;
-                                               }
-
-                                       // Element context
-                                       } else {
-
-                                               // Support: IE, Opera, Webkit
-                                               // TODO: identify versions
-                                               // getElementById can match elements by name instead of ID
-                                               if ( newContext && (elem = newContext.getElementById( m )) &&
-                                                       contains( context, elem ) &&
-                                                       elem.id === m ) {
+       if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+               return [];
+       }
 
+       if ( documentIsHTML && !seed ) {
+
+               // Shortcuts
+               if ( (match = rquickExpr.exec( selector )) ) {
+                       // Speed-up: Sizzle("#ID")
+                       if ( (m = match[1]) ) {
+                               if ( nodeType === 9 ) {
+                                       elem = context.getElementById( m );
+                                       // Check parentNode to catch when Blackberry 4.6 returns
+                                       // nodes that are no longer in the document (jQuery #6963)
+                                       if ( elem && elem.parentNode ) {
+                                               // Handle the case where IE, Opera, and Webkit return items
+                                               // by name instead of ID
+                                               if ( elem.id === m ) {
                                                        results.push( elem );
                                                        return results;
                                                }
+                                       } else {
+                                               return results;
+                                       }
+                               } else {
+                                       // Context is not a document
+                                       if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+                                               contains( context, elem ) && elem.id === m ) {
+                                               results.push( elem );
+                                               return results;
                                        }
-
-                               // Type selector
-                               } else if ( match[2] ) {
-                                       push.apply( results, context.getElementsByTagName( selector ) );
-                                       return results;
-
-                               // Class selector
-                               } else if ( (m = match[3]) && support.getElementsByClassName &&
-                                       context.getElementsByClassName ) {
-
-                                       push.apply( results, context.getElementsByClassName( m ) );
-                                       return results;
                                }
-                       }
 
-                       // Take advantage of querySelectorAll
-                       if ( support.qsa &&
-                               !compilerCache[ selector + " " ] &&
-                               (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
+                       // Speed-up: Sizzle("TAG")
+                       } else if ( match[2] ) {
+                               push.apply( results, context.getElementsByTagName( selector ) );
+                               return results;
 
-                               if ( nodeType !== 1 ) {
-                                       newContext = context;
-                                       newSelector = selector;
+                       // Speed-up: Sizzle(".CLASS")
+                       } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
+                               push.apply( results, context.getElementsByClassName( m ) );
+                               return results;
+                       }
+               }
 
-                               // qSA looks outside Element context, which is not what we want
-                               // Thanks to Andrew Dupont for this workaround technique
-                               // Support: IE <=8
-                               // Exclude object elements
-                               } else if ( context.nodeName.toLowerCase() !== "object" ) {
+               // QSA path
+               if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
+                       nid = old = expando;
+                       newContext = context;
+                       newSelector = nodeType === 9 && selector;
 
-                                       // Capture the context ID, setting it first if necessary
-                                       if ( (nid = context.getAttribute( "id" )) ) {
-                                               nid = nid.replace( rcssescape, fcssescape );
-                                       } else {
-                                               context.setAttribute( "id", (nid = expando) );
-                                       }
+                       // qSA works strangely on Element-rooted queries
+                       // We can work around this by specifying an extra ID on the root
+                       // and working up from there (Thanks to Andrew Dupont for the technique)
+                       // IE 8 doesn't work on object elements
+                       if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+                               groups = tokenize( selector );
 
-                                       // Prefix every selector in the list
-                                       groups = tokenize( selector );
-                                       i = groups.length;
-                                       while ( i-- ) {
-                                               groups[i] = "#" + nid + " " + toSelector( groups[i] );
-                                       }
-                                       newSelector = groups.join( "," );
+                               if ( (old = context.getAttribute("id")) ) {
+                                       nid = old.replace( rescape, "\\$&" );
+                               } else {
+                                       context.setAttribute( "id", nid );
+                               }
+                               nid = "[id='" + nid + "'] ";
 
-                                       // Expand context for sibling selectors
-                                       newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
-                                               context;
+                               i = groups.length;
+                               while ( i-- ) {
+                                       groups[i] = nid + toSelector( groups[i] );
                                }
+                               newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
+                               newSelector = groups.join(",");
+                       }
 
-                               if ( newSelector ) {
-                                       try {
-                                               push.apply( results,
-                                                       newContext.querySelectorAll( newSelector )
-                                               );
-                                               return results;
-                                       } catch ( qsaError ) {
-                                       } finally {
-                                               if ( nid === expando ) {
-                                                       context.removeAttribute( "id" );
-                                               }
+                       if ( newSelector ) {
+                               try {
+                                       push.apply( results,
+                                               newContext.querySelectorAll( newSelector )
+                                       );
+                                       return results;
+                               } catch(qsaError) {
+                               } finally {
+                                       if ( !old ) {
+                                               context.removeAttribute("id");
                                        }
                                }
                        }
@@ -883,7 +845,7 @@ function Sizzle( selector, context, results, seed ) {
 
 /**
  * Create key-value caches of limited size
- * @returns {function(string, object)} Returns the Object data after storing it on itself with
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
  *     property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  *     deleting the oldest entry
  */
@@ -912,22 +874,22 @@ function markFunction( fn ) {
 
 /**
  * Support testing using an element
- * @param {Function} fn Passed the created element and returns a boolean result
+ * @param {Function} fn Passed the created div and expects a boolean result
  */
 function assert( fn ) {
-       var el = document.createElement("fieldset");
+       var div = document.createElement("div");
 
        try {
-               return !!fn( el );
+               return !!fn( div );
        } catch (e) {
                return false;
        } finally {
                // Remove from its parent by default
-               if ( el.parentNode ) {
-                       el.parentNode.removeChild( el );
+               if ( div.parentNode ) {
+                       div.parentNode.removeChild( div );
                }
                // release memory in IE
-               el = null;
+               div = null;
        }
 }
 
@@ -938,7 +900,7 @@ function assert( fn ) {
  */
 function addHandle( attrs, handler ) {
        var arr = attrs.split("|"),
-               i = arr.length;
+               i = attrs.length;
 
        while ( i-- ) {
                Expr.attrHandle[ arr[i] ] = handler;
@@ -954,7 +916,8 @@ function addHandle( attrs, handler ) {
 function siblingCheck( a, b ) {
        var cur = b && a,
                diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
-                       a.sourceIndex - b.sourceIndex;
+                       ( ~b.sourceIndex || MAX_NEGATIVE ) -
+                       ( ~a.sourceIndex || MAX_NEGATIVE );
 
        // Use IE sourceIndex if available on both nodes
        if ( diff ) {
@@ -996,62 +959,6 @@ 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
  */
@@ -1079,7 +986,7 @@ function createPositionalPseudo( fn ) {
  * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  */
 function testContext( context ) {
-       return context && typeof context.getElementsByTagName !== "undefined" && context;
+       return context && typeof context.getElementsByTagName !== strundefined && context;
 }
 
 // Expose support vars for convenience
@@ -1103,31 +1010,36 @@ isXML = Sizzle.isXML = function( elem ) {
  * @returns {Object} Returns the current document
  */
 setDocument = Sizzle.setDocument = function( node ) {
-       var hasCompare, subWindow,
-               doc = node ? node.ownerDocument || node : preferredDoc;
+       var hasCompare,
+               doc = node ? node.ownerDocument || node : preferredDoc,
+               parent = doc.defaultView;
 
-       // Return early if doc is invalid or already selected
+       // If no document and documentElement is available, return
        if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
                return document;
        }
 
-       // Update global variables
+       // Set our document
        document = doc;
-       docElem = document.documentElement;
-       documentIsHTML = !isXML( document );
-
-       // Support: IE 9-11, Edge
-       // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
-       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 ( subWindow.attachEvent ) {
-                       subWindow.attachEvent( "onunload", unloadHandler );
+       docElem = doc.documentElement;
+
+       // Support tests
+       documentIsHTML = !isXML( doc );
+
+       // Support: IE>8
+       // If iframe document is assigned to "document" variable and if iframe has been reloaded,
+       // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
+       // IE6-8 do not support the defaultView property so parent will be undefined
+       if ( parent && parent !== parent.top ) {
+               // IE11 does not have attachEvent, so all must suffer
+               if ( parent.addEventListener ) {
+                       parent.addEventListener( "unload", function() {
+                               setDocument();
+                       }, false );
+               } else if ( parent.attachEvent ) {
+                       parent.attachEvent( "onunload", function() {
+                               setDocument();
+                       });
                }
        }
 
@@ -1135,106 +1047,83 @@ setDocument = Sizzle.setDocument = function( node ) {
        ---------------------------------------------------------------------- */
 
        // Support: IE<8
-       // Verify that getAttribute really returns attributes and not properties
-       // (excepting IE8 booleans)
-       support.attributes = assert(function( el ) {
-               el.className = "i";
-               return !el.getAttribute("className");
+       // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
+       support.attributes = assert(function( div ) {
+               div.className = "i";
+               return !div.getAttribute("className");
        });
 
        /* getElement(s)By*
        ---------------------------------------------------------------------- */
 
        // Check if getElementsByTagName("*") returns only elements
-       support.getElementsByTagName = assert(function( el ) {
-               el.appendChild( document.createComment("") );
-               return !el.getElementsByTagName("*").length;
+       support.getElementsByTagName = assert(function( div ) {
+               div.appendChild( doc.createComment("") );
+               return !div.getElementsByTagName("*").length;
        });
 
-       // Support: IE<9
-       support.getElementsByClassName = rnative.test( document.getElementsByClassName );
+       // Check if getElementsByClassName can be trusted
+       support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
+               div.innerHTML = "<div class='a'></div><div class='a i'></div>";
+
+               // Support: Safari<4
+               // Catch class over-caching
+               div.firstChild.className = "i";
+               // Support: Opera<10
+               // Catch gEBCN failure to find non-leading classes
+               return div.getElementsByClassName("i").length === 2;
+       });
 
        // Support: IE<10
        // Check if getElementById returns elements by name
-       // The broken getElementById methods don't pick up programmatically-set names,
+       // The broken getElementById methods don't pick up programatically-set names,
        // so use a roundabout getElementsByName test
-       support.getById = assert(function( el ) {
-               docElem.appendChild( el ).id = expando;
-               return !document.getElementsByName || !document.getElementsByName( expando ).length;
+       support.getById = assert(function( div ) {
+               docElem.appendChild( div ).id = expando;
+               return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
        });
 
-       // ID filter and find
+       // ID find and filter
        if ( support.getById ) {
+               Expr.find["ID"] = function( id, context ) {
+                       if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
+                               var m = context.getElementById( id );
+                               // Check parentNode to catch when Blackberry 4.6 returns
+                               // nodes that are no longer in the document #6963
+                               return m && m.parentNode ? [ m ] : [];
+                       }
+               };
                Expr.filter["ID"] = function( id ) {
                        var attrId = id.replace( runescape, funescape );
                        return function( elem ) {
                                return elem.getAttribute("id") === attrId;
                        };
                };
-               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 ) {
-                               var node = typeof elem.getAttributeNode !== "undefined" &&
-                                       elem.getAttributeNode("id");
+                               var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
                                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
        Expr.find["TAG"] = support.getElementsByTagName ?
                function( tag, context ) {
-                       if ( typeof context.getElementsByTagName !== "undefined" ) {
+                       if ( typeof context.getElementsByTagName !== strundefined ) {
                                return context.getElementsByTagName( tag );
-
-                       // DocumentFragment nodes don't have gEBTN
-                       } else if ( support.qsa ) {
-                               return context.querySelectorAll( tag );
                        }
                } :
-
                function( tag, context ) {
                        var elem,
                                tmp = [],
                                i = 0,
-                               // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
                                results = context.getElementsByTagName( tag );
 
                        // Filter out possible comments
@@ -1252,7 +1141,7 @@ setDocument = Sizzle.setDocument = function( node ) {
 
        // Class
        Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
-               if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
+               if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
                        return context.getElementsByClassName( className );
                }
        };
@@ -1269,87 +1158,63 @@ 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 https://bugs.jquery.com/ticket/13378
+       // See http://bugs.jquery.com/ticket/13378
        rbuggyQSA = [];
 
-       if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
+       if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
                // Build QSA regex
                // Regex strategy adopted from Diego Perini
-               assert(function( el ) {
+               assert(function( div ) {
                        // Select is set to empty string on purpose
                        // This is to test IE's treatment of not explicitly
                        // setting a boolean content attribute,
                        // since its presence should be enough
-                       // https://bugs.jquery.com/ticket/12359
-                       docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
-                               "<select id='" + expando + "-\r\\' msallowcapture=''>" +
-                               "<option selected=''></option></select>";
+                       // http://bugs.jquery.com/ticket/12359
+                       div.innerHTML = "<select msallowclip=''><option selected=''></option></select>";
 
                        // 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
-                       // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
-                       if ( el.querySelectorAll("[msallowcapture^='']").length ) {
+                       // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
+                       if ( div.querySelectorAll("[msallowclip^='']").length ) {
                                rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
                        }
 
                        // Support: IE8
                        // Boolean attributes and "value" are not treated correctly
-                       if ( !el.querySelectorAll("[selected]").length ) {
+                       if ( !div.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 ( !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 ( !el.querySelectorAll(":checked").length ) {
+                       if ( !div.querySelectorAll(":checked").length ) {
                                rbuggyQSA.push(":checked");
                        }
-
-                       // Support: Safari 8+, iOS 8+
-                       // https://bugs.webkit.org/show_bug.cgi?id=136851
-                       // In-page `selector#id sibling-combinator selector` fails
-                       if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
-                               rbuggyQSA.push(".#.+[+~]");
-                       }
                });
 
-               assert(function( el ) {
-                       el.innerHTML = "<a href='' disabled='disabled'></a>" +
-                               "<select disabled='disabled'><option/></select>";
-
+               assert(function( div ) {
                        // Support: Windows 8 Native Apps
                        // The type and name attributes are restricted during .innerHTML assignment
-                       var input = document.createElement("input");
+                       var input = doc.createElement("input");
                        input.setAttribute( "type", "hidden" );
-                       el.appendChild( input ).setAttribute( "name", "D" );
+                       div.appendChild( input ).setAttribute( "name", "D" );
 
                        // Support: IE8
                        // Enforce case-sensitivity of name attribute
-                       if ( el.querySelectorAll("[name=d]").length ) {
+                       if ( div.querySelectorAll("[name=d]").length ) {
                                rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
                        }
 
                        // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
                        // IE8 throws error here and will not see later tests
-                       if ( 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 ) {
+                       if ( !div.querySelectorAll(":enabled").length ) {
                                rbuggyQSA.push( ":enabled", ":disabled" );
                        }
 
                        // Opera 10-11 does not throw on post-comma invalid pseudos
-                       el.querySelectorAll("*,:x");
+                       div.querySelectorAll("*,:x");
                        rbuggyQSA.push(",.*:");
                });
        }
@@ -1360,14 +1225,14 @@ setDocument = Sizzle.setDocument = function( node ) {
                docElem.oMatchesSelector ||
                docElem.msMatchesSelector) )) ) {
 
-               assert(function( el ) {
+               assert(function( div ) {
                        // Check to see if it's possible to do matchesSelector
                        // on a disconnected node (IE 9)
-                       support.disconnectedMatch = matches.call( el, "*" );
+                       support.disconnectedMatch = matches.call( div, "div" );
 
                        // This should fail with an exception
                        // Gecko does not error, returns false instead
-                       matches.call( el, "[s!='']:x" );
+                       matches.call( div, "[s!='']:x" );
                        rbuggyMatches.push( "!=", pseudos );
                });
        }
@@ -1380,7 +1245,7 @@ setDocument = Sizzle.setDocument = function( node ) {
        hasCompare = rnative.test( docElem.compareDocumentPosition );
 
        // Element contains another
-       // Purposefully self-exclusive
+       // Purposefully does not implement inclusive descendent
        // As in, an element does not contain itself
        contains = hasCompare || rnative.test( docElem.contains ) ?
                function( a, b ) {
@@ -1434,16 +1299,16 @@ setDocument = Sizzle.setDocument = function( node ) {
                        (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
 
                        // Choose the first element that is related to our preferred document
-                       if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
+                       if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
                                return -1;
                        }
-                       if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
+                       if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
                                return 1;
                        }
 
                        // Maintain original order
                        return sortInput ?
-                               ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
+                               ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
                                0;
                }
 
@@ -1465,12 +1330,12 @@ setDocument = Sizzle.setDocument = function( node ) {
 
                // Parentless nodes are either documents or disconnected
                if ( !aup || !bup ) {
-                       return a === document ? -1 :
-                               b === document ? 1 :
+                       return a === doc ? -1 :
+                               b === doc ? 1 :
                                aup ? -1 :
                                bup ? 1 :
                                sortInput ?
-                               ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
+                               ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
                                0;
 
                // If the nodes are siblings, we can do a quick check
@@ -1503,7 +1368,7 @@ setDocument = Sizzle.setDocument = function( node ) {
                        0;
        };
 
-       return document;
+       return doc;
 };
 
 Sizzle.matches = function( expr, elements ) {
@@ -1520,7 +1385,6 @@ Sizzle.matchesSelector = function( elem, expr ) {
        expr = expr.replace( rattributeQuotes, "='$1']" );
 
        if ( support.matchesSelector && documentIsHTML &&
-               !compilerCache[ expr + " " ] &&
                ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
                ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
 
@@ -1534,7 +1398,7 @@ Sizzle.matchesSelector = function( elem, expr ) {
                                        elem.document && elem.document.nodeType !== 11 ) {
                                return ret;
                        }
-               } catch (e) {}
+               } catch(e) {}
        }
 
        return Sizzle( expr, document, null, [ elem ] ).length > 0;
@@ -1569,10 +1433,6 @@ 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 );
 };
@@ -1757,7 +1617,7 @@ Expr = Sizzle.selectors = {
                        return pattern ||
                                (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
                                classCache( className, function( elem ) {
-                                       return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
+                                       return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
                                });
                },
 
@@ -1779,7 +1639,7 @@ Expr = Sizzle.selectors = {
                                        operator === "^=" ? check && result.indexOf( check ) === 0 :
                                        operator === "*=" ? check && result.indexOf( check ) > -1 :
                                        operator === "$=" ? check && result.slice( -check.length ) === check :
-                                       operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
+                                       operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
                                        operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
                                        false;
                        };
@@ -1798,12 +1658,11 @@ Expr = Sizzle.selectors = {
                                } :
 
                                function( elem, context, xml ) {
-                                       var cache, uniqueCache, outerCache, node, nodeIndex, start,
+                                       var cache, outerCache, node, diff, nodeIndex, start,
                                                dir = simple !== forward ? "nextSibling" : "previousSibling",
                                                parent = elem.parentNode,
                                                name = ofType && elem.nodeName.toLowerCase(),
-                                               useCache = !xml && !ofType,
-                                               diff = false;
+                                               useCache = !xml && !ofType;
 
                                        if ( parent ) {
 
@@ -1812,10 +1671,7 @@ Expr = Sizzle.selectors = {
                                                        while ( dir ) {
                                                                node = elem;
                                                                while ( (node = node[ dir ]) ) {
-                                                                       if ( ofType ?
-                                                                               node.nodeName.toLowerCase() === name :
-                                                                               node.nodeType === 1 ) {
-
+                                                                       if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
                                                                                return false;
                                                                        }
                                                                }
@@ -1829,21 +1685,11 @@ Expr = Sizzle.selectors = {
 
                                                // non-xml :nth-child(...) stores cache data on `parent`
                                                if ( forward && useCache ) {
-
                                                        // Seek `elem` from a previously-cached index
-
-                                                       // ...in a gzip-friendly way
-                                                       node = parent;
-                                                       outerCache = node[ expando ] || (node[ expando ] = {});
-
-                                                       // Support: IE <9 only
-                                                       // Defend against cloned attroperties (jQuery gh-1709)
-                                                       uniqueCache = outerCache[ node.uniqueID ] ||
-                                                               (outerCache[ node.uniqueID ] = {});
-
-                                                       cache = uniqueCache[ type ] || [];
-                                                       nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
-                                                       diff = nodeIndex && cache[ 2 ];
+                                                       outerCache = parent[ expando ] || (parent[ expando ] = {});
+                                                       cache = outerCache[ type ] || [];
+                                                       nodeIndex = cache[0] === dirruns && cache[1];
+                                                       diff = cache[0] === dirruns && cache[2];
                                                        node = nodeIndex && parent.childNodes[ nodeIndex ];
 
                                                        while ( (node = ++nodeIndex && node && node[ dir ] ||
@@ -1853,55 +1699,29 @@ Expr = Sizzle.selectors = {
 
                                                                // When found, cache indexes on `parent` and break
                                                                if ( node.nodeType === 1 && ++diff && node === elem ) {
-                                                                       uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
+                                                                       outerCache[ type ] = [ dirruns, nodeIndex, diff ];
                                                                        break;
                                                                }
                                                        }
 
-                                               } else {
-                                                       // Use previously-cached element index if available
-                                                       if ( useCache ) {
-                                                               // ...in a gzip-friendly way
-                                                               node = elem;
-                                                               outerCache = node[ expando ] || (node[ expando ] = {});
+                                               // Use previously-cached element index if available
+                                               } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
+                                                       diff = cache[1];
 
-                                                               // Support: IE <9 only
-                                                               // Defend against cloned attroperties (jQuery gh-1709)
-                                                               uniqueCache = outerCache[ node.uniqueID ] ||
-                                                                       (outerCache[ node.uniqueID ] = {});
+                                               // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
+                                               } else {
+                                                       // Use the same loop as above to seek `elem` from the start
+                                                       while ( (node = ++nodeIndex && node && node[ dir ] ||
+                                                               (diff = nodeIndex = 0) || start.pop()) ) {
 
-                                                               cache = uniqueCache[ type ] || [];
-                                                               nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
-                                                               diff = nodeIndex;
-                                                       }
+                                                               if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+                                                                       // Cache the index of each encountered element
+                                                                       if ( useCache ) {
+                                                                               (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+                                                                       }
 
-                                                       // xml :nth-child(...)
-                                                       // or :nth-last-child(...) or :nth(-last)?-of-type(...)
-                                                       if ( diff === false ) {
-                                                               // Use the same loop as above to seek `elem` from the start
-                                                               while ( (node = ++nodeIndex && node && node[ dir ] ||
-                                                                       (diff = nodeIndex = 0) || start.pop()) ) {
-
-                                                                       if ( ( ofType ?
-                                                                               node.nodeName.toLowerCase() === name :
-                                                                               node.nodeType === 1 ) &&
-                                                                               ++diff ) {
-
-                                                                               // Cache the index of each encountered element
-                                                                               if ( useCache ) {
-                                                                                       outerCache = node[ expando ] || (node[ expando ] = {});
-
-                                                                                       // Support: IE <9 only
-                                                                                       // Defend against cloned attroperties (jQuery gh-1709)
-                                                                                       uniqueCache = outerCache[ node.uniqueID ] ||
-                                                                                               (outerCache[ node.uniqueID ] = {});
-
-                                                                                       uniqueCache[ type ] = [ dirruns, diff ];
-                                                                               }
-
-                                                                               if ( node === elem ) {
-                                                                                       break;
-                                                                               }
+                                                                       if ( node === elem ) {
+                                                                               break;
                                                                        }
                                                                }
                                                        }
@@ -1939,7 +1759,7 @@ Expr = Sizzle.selectors = {
                                                        matched = fn( seed, argument ),
                                                        i = matched.length;
                                                while ( i-- ) {
-                                                       idx = indexOf( seed, matched[i] );
+                                                       idx = indexOf.call( seed, matched[i] );
                                                        seed[ idx ] = !( matches[ idx ] = matched[i] );
                                                }
                                        }) :
@@ -1978,8 +1798,6 @@ Expr = Sizzle.selectors = {
                                function( elem, context, xml ) {
                                        input[0] = elem;
                                        matcher( input, null, xml, results );
-                                       // Don't keep the element (issue #299)
-                                       input[0] = null;
                                        return !results.pop();
                                };
                }),
@@ -1991,7 +1809,6 @@ Expr = Sizzle.selectors = {
                }),
 
                "contains": markFunction(function( text ) {
-                       text = text.replace( runescape, funescape );
                        return function( elem ) {
                                return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
                        };
@@ -2040,8 +1857,13 @@ Expr = Sizzle.selectors = {
                },
 
                // Boolean properties
-               "enabled": createDisabledPseudo( false ),
-               "disabled": createDisabledPseudo( true ),
+               "enabled": function( elem ) {
+                       return elem.disabled === false;
+               },
+
+               "disabled": function( elem ) {
+                       return elem.disabled === true;
+               },
 
                "checked": function( elem ) {
                        // In CSS3, :checked should return both checked and selected elements
@@ -2243,9 +2065,7 @@ function toSelector( tokens ) {
 
 function addCombinator( matcher, combinator, base ) {
        var dir = combinator.dir,
-               skip = combinator.next,
-               key = skip || dir,
-               checkNonElements = base && key === "parentNode",
+               checkNonElements = base && dir === "parentNode",
                doneName = done++;
 
        return combinator.first ?
@@ -2256,15 +2076,14 @@ function addCombinator( matcher, combinator, base ) {
                                        return matcher( elem, context, xml );
                                }
                        }
-                       return false;
                } :
 
                // Check against all ancestor/preceding elements
                function( elem, context, xml ) {
-                       var oldCache, uniqueCache, outerCache,
+                       var oldCache, outerCache,
                                newCache = [ dirruns, doneName ];
 
-                       // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
+                       // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
                        if ( xml ) {
                                while ( (elem = elem[ dir ]) ) {
                                        if ( elem.nodeType === 1 || checkNonElements ) {
@@ -2277,21 +2096,14 @@ function addCombinator( matcher, combinator, base ) {
                                while ( (elem = elem[ dir ]) ) {
                                        if ( elem.nodeType === 1 || checkNonElements ) {
                                                outerCache = elem[ expando ] || (elem[ expando ] = {});
-
-                                               // Support: IE <9 only
-                                               // Defend against cloned attroperties (jQuery gh-1709)
-                                               uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
-
-                                               if ( skip && skip === elem.nodeName.toLowerCase() ) {
-                                                       elem = elem[ dir ] || elem;
-                                               } else if ( (oldCache = uniqueCache[ key ]) &&
+                                               if ( (oldCache = outerCache[ dir ]) &&
                                                        oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
 
                                                        // Assign to newCache so results back-propagate to previous elements
                                                        return (newCache[ 2 ] = oldCache[ 2 ]);
                                                } else {
                                                        // Reuse newcache so results back-propagate to previous elements
-                                                       uniqueCache[ key ] = newCache;
+                                                       outerCache[ dir ] = newCache;
 
                                                        // A match means we're done; a fail means we have to keep checking
                                                        if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
@@ -2301,7 +2113,6 @@ function addCombinator( matcher, combinator, base ) {
                                        }
                                }
                        }
-                       return false;
                };
 }
 
@@ -2419,7 +2230,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
                                i = matcherOut.length;
                                while ( i-- ) {
                                        if ( (elem = matcherOut[i]) &&
-                                               (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
+                                               (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
 
                                                seed[temp] = !(results[temp] = elem);
                                        }
@@ -2454,16 +2265,13 @@ function matcherFromTokens( tokens ) {
                        return elem === checkContext;
                }, implicitRelative, true ),
                matchAnyContext = addCombinator( function( elem ) {
-                       return indexOf( checkContext, elem ) > -1;
+                       return indexOf.call( checkContext, elem ) > -1;
                }, implicitRelative, true ),
                matchers = [ function( elem, context, xml ) {
-                       var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+                       return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
                                (checkContext = context).nodeType ?
                                        matchContext( elem, context, xml ) :
                                        matchAnyContext( elem, context, xml ) );
-                       // Avoid hanging onto element (issue #299)
-                       checkContext = null;
-                       return ret;
                } ];
 
        for ( ; i < len; i++ ) {
@@ -2517,21 +2325,18 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
                                len = elems.length;
 
                        if ( outermost ) {
-                               outermostContext = context === document || context || outermost;
+                               outermostContext = context !== document && context;
                        }
 
                        // Add elements passing elementMatchers directly to results
+                       // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
                        // Support: IE<9, Safari
                        // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
                        for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
                                if ( byElement && elem ) {
                                        j = 0;
-                                       if ( !context && elem.ownerDocument !== document ) {
-                                               setDocument( elem );
-                                               xml = !documentIsHTML;
-                                       }
                                        while ( (matcher = elementMatchers[j++]) ) {
-                                               if ( matcher( elem, context || document, xml) ) {
+                                               if ( matcher( elem, context, xml ) ) {
                                                        results.push( elem );
                                                        break;
                                                }
@@ -2555,17 +2360,8 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
                                }
                        }
 
-                       // `i` is now the count of elements visited above, and adding it to `matchedCount`
-                       // makes the latter nonnegative.
-                       matchedCount += i;
-
                        // Apply set filters to unmatched elements
-                       // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
-                       // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
-                       // no element matchers and no seed.
-                       // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
-                       // case, which will result in a "00" `matchedCount` that differs from `i` but is also
-                       // numerically zero.
+                       matchedCount += i;
                        if ( bySet && i !== matchedCount ) {
                                j = 0;
                                while ( (matcher = setMatchers[j++]) ) {
@@ -2657,14 +2453,14 @@ select = Sizzle.select = function( selector, context, results, seed ) {
 
        results = results || [];
 
-       // Try to minimize operations if there is only one selector in the list and no seed
-       // (the latter of which guarantees us context)
+       // Try to minimize operations if there is no seed and only one group
        if ( match.length === 1 ) {
 
-               // Reduce context if the leading compound selector is an ID
+               // Take a shortcut and set the context if the root selector is an ID
                tokens = match[0] = match[0].slice( 0 );
                if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
-                               context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
+                               support.getById && context.nodeType === 9 && documentIsHTML &&
+                               Expr.relative[ tokens[1].type ] ) {
 
                        context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
                        if ( !context ) {
@@ -2715,7 +2511,7 @@ select = Sizzle.select = function( selector, context, results, seed ) {
                context,
                !documentIsHTML,
                results,
-               !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
+               rsibling.test( selector ) && testContext( context.parentNode ) || context
        );
        return results;
 };
@@ -2725,7 +2521,7 @@ select = Sizzle.select = function( selector, context, results, seed ) {
 // Sort stability
 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
 
-// Support: Chrome 14-35+
+// Support: Chrome<14
 // Always assume duplicates if they aren't passed to the comparison function
 support.detectDuplicates = !!hasDuplicate;
 
@@ -2734,17 +2530,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( el ) {
+support.sortDetached = assert(function( div1 ) {
        // Should return 1, but returns 4 (following)
-       return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
+       return div1.compareDocumentPosition( document.createElement("div") ) & 1;
 });
 
 // Support: IE<8
 // Prevent attribute/property "interpolation"
-// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
-if ( !assert(function( el ) {
-       el.innerHTML = "<a href='#'></a>";
-       return el.firstChild.getAttribute("href") === "#" ;
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !assert(function( div ) {
+       div.innerHTML = "<a href='#'></a>";
+       return div.firstChild.getAttribute("href") === "#" ;
 }) ) {
        addHandle( "type|href|height|width", function( elem, name, isXML ) {
                if ( !isXML ) {
@@ -2755,10 +2551,10 @@ if ( !assert(function( el ) {
 
 // Support: IE<9
 // Use defaultValue in place of getAttribute("value")
-if ( !support.attributes || !assert(function( el ) {
-       el.innerHTML = "<input/>";
-       el.firstChild.setAttribute( "value", "" );
-       return el.firstChild.getAttribute( "value" ) === "";
+if ( !support.attributes || !assert(function( div ) {
+       div.innerHTML = "<input/>";
+       div.firstChild.setAttribute( "value", "" );
+       return div.firstChild.getAttribute( "value" ) === "";
 }) ) {
        addHandle( "value", function( elem, name, isXML ) {
                if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
@@ -2769,8 +2565,8 @@ if ( !support.attributes || !assert(function( el ) {
 
 // Support: IE<9
 // Use getAttributeNode to fetch booleans when getAttribute lies
-if ( !assert(function( el ) {
-       return el.getAttribute("disabled") == null;
+if ( !assert(function( div ) {
+       return div.getAttribute("disabled") == null;
 }) ) {
        addHandle( booleans, function( elem, name, isXML ) {
                var val;
@@ -2791,57 +2587,17 @@ return Sizzle;
 
 jQuery.find = Sizzle;
 jQuery.expr = Sizzle.selectors;
-
-// Deprecated
-jQuery.expr[ ":" ] = jQuery.expr.pseudos;
-jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
 jQuery.text = Sizzle.getText;
 jQuery.isXMLDoc = Sizzle.isXML;
 jQuery.contains = Sizzle.contains;
-jQuery.escapeSelector = Sizzle.escape;
-
-
-
-
-var dir = function( elem, dir, until ) {
-       var matched = [],
-               truncate = until !== undefined;
-
-       while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
-               if ( elem.nodeType === 1 ) {
-                       if ( truncate && jQuery( elem ).is( until ) ) {
-                               break;
-                       }
-                       matched.push( elem );
-               }
-       }
-       return matched;
-};
 
 
-var siblings = function( n, elem ) {
-       var matched = [];
-
-       for ( ; n; n = n.nextSibling ) {
-               if ( n.nodeType === 1 && n !== elem ) {
-                       matched.push( n );
-               }
-       }
-
-       return matched;
-};
-
 
 var rneedsContext = jQuery.expr.match.needsContext;
 
-
-
-function nodeName( elem, name ) {
-
-  return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
-
-};
-var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
+var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
 
 
 
@@ -2851,34 +2607,30 @@ 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;
-               } );
-       }
+               });
 
-       // 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 );
+       if ( typeof qualifier === "string" ) {
+               if ( risSimple.test( qualifier ) ) {
+                       return jQuery.filter( qualifier, elements, not );
+               }
+
+               qualifier = jQuery.filter( qualifier, elements );
        }
 
-       // 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 && elem.nodeType === 1;
-       } );
+               return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
+       });
 }
 
 jQuery.filter = function( expr, elems, not ) {
@@ -2888,44 +2640,44 @@ jQuery.filter = function( expr, elems, not ) {
                expr = ":not(" + expr + ")";
        }
 
-       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;
-       } ) );
+       return elems.length === 1 && elem.nodeType === 1 ?
+               jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
+               jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
+                       return elem.nodeType === 1;
+               }));
 };
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        find: function( selector ) {
-               var i, ret,
+               var i,
                        len = this.length,
+                       ret = [],
                        self = this;
 
                if ( typeof selector !== "string" ) {
-                       return this.pushStack( jQuery( selector ).filter( function() {
+                       return this.pushStack( jQuery( selector ).filter(function() {
                                for ( i = 0; i < len; i++ ) {
                                        if ( jQuery.contains( self[ i ], this ) ) {
                                                return true;
                                        }
                                }
-                       } ) );
+                       }) );
                }
 
-               ret = this.pushStack( [] );
-
                for ( i = 0; i < len; i++ ) {
                        jQuery.find( selector, self[ i ], ret );
                }
 
-               return len > 1 ? jQuery.uniqueSort( ret ) : ret;
+               // Needed because $( selector, context ) becomes $( context ).find( selector )
+               ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
+               ret.selector = this.selector ? this.selector + " " + selector : selector;
+               return ret;
        },
        filter: function( selector ) {
-               return this.pushStack( winnow( this, selector || [], false ) );
+               return this.pushStack( winnow(this, selector || [], false) );
        },
        not: function( selector ) {
-               return this.pushStack( winnow( this, selector || [], true ) );
+               return this.pushStack( winnow(this, selector || [], true) );
        },
        is: function( selector ) {
                return !!winnow(
@@ -2939,7 +2691,7 @@ jQuery.fn.extend( {
                        false
                ).length;
        }
-} );
+});
 
 
 // Initialize a jQuery object
@@ -2951,10 +2703,9 @@ var rootjQuery,
        // A simple way to check for HTML strings
        // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
        // Strict HTML recognition (#11290: must start with <)
-       // Shortcut simple #id case for speed
-       rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
+       rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
 
-       init = jQuery.fn.init = function( selector, context, root ) {
+       init = jQuery.fn.init = function( selector, context ) {
                var match, elem;
 
                // HANDLE: $(""), $(null), $(undefined), $(false)
@@ -2962,16 +2713,9 @@ var rootjQuery,
                        return this;
                }
 
-               // Method init() accepts an alternate rootjQuery
-               // so migrate can support jQuery.sub (gh-2101)
-               root = root || rootjQuery;
-
                // Handle HTML strings
                if ( typeof selector === "string" ) {
-                       if ( selector[ 0 ] === "<" &&
-                               selector[ selector.length - 1 ] === ">" &&
-                               selector.length >= 3 ) {
-
+                       if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
                                // Assume that strings that start and end with <> are HTML and skip the regex check
                                match = [ null, selector, null ];
 
@@ -2980,24 +2724,23 @@ var rootjQuery,
                        }
 
                        // Match html or make sure no context is specified for #id
-                       if ( match && ( match[ 1 ] || !context ) ) {
+                       if ( match && (match[1] || !context) ) {
 
                                // HANDLE: $(html) -> $(array)
-                               if ( match[ 1 ] ) {
-                                       context = context instanceof jQuery ? context[ 0 ] : context;
+                               if ( match[1] ) {
+                                       context = context instanceof jQuery ? context[0] : context;
 
-                                       // Option to run scripts is true for back-compat
+                                       // scripts is true for back-compat
                                        // Intentionally let the error be thrown if parseHTML is not present
                                        jQuery.merge( this, jQuery.parseHTML(
-                                               match[ 1 ],
+                                               match[1],
                                                context && context.nodeType ? context.ownerDocument || context : document,
                                                true
                                        ) );
 
                                        // HANDLE: $(html, props)
-                                       if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
+                                       if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
                                                for ( match in context ) {
-
                                                        // Properties of context are called as methods if possible
                                                        if ( jQuery.isFunction( this[ match ] ) ) {
                                                                this[ match ]( context[ match ] );
@@ -3013,20 +2756,24 @@ var rootjQuery,
 
                                // HANDLE: $(#id)
                                } else {
-                                       elem = document.getElementById( match[ 2 ] );
-
-                                       if ( elem ) {
+                                       elem = document.getElementById( match[2] );
 
+                                       // Check parentNode to catch when Blackberry 4.6 returns
+                                       // nodes that are no longer in the document #6963
+                                       if ( elem && elem.parentNode ) {
                                                // Inject the element directly into the jQuery object
-                                               this[ 0 ] = elem;
                                                this.length = 1;
+                                               this[0] = elem;
                                        }
+
+                                       this.context = document;
+                                       this.selector = selector;
                                        return this;
                                }
 
                        // HANDLE: $(expr, $(...))
                        } else if ( !context || context.jquery ) {
-                               return ( context || root ).find( selector );
+                               return ( context || rootjQuery ).find( selector );
 
                        // HANDLE: $(expr, context)
                        // (which is just equivalent to: $(context).find(expr)
@@ -3036,20 +2783,24 @@ var rootjQuery,
 
                // HANDLE: $(DOMElement)
                } else if ( selector.nodeType ) {
-                       this[ 0 ] = selector;
+                       this.context = this[0] = selector;
                        this.length = 1;
                        return this;
 
                // HANDLE: $(function)
                // Shortcut for document ready
                } else if ( jQuery.isFunction( selector ) ) {
-                       return root.ready !== undefined ?
-                               root.ready( selector ) :
-
+                       return typeof rootjQuery.ready !== "undefined" ?
+                               rootjQuery.ready( selector ) :
                                // Execute immediately if ready is not present
                                selector( jQuery );
                }
 
+               if ( selector.selector !== undefined ) {
+                       this.selector = selector.selector;
+                       this.context = selector.context;
+               }
+
                return jQuery.makeArray( selector, this );
        };
 
@@ -3061,8 +2812,7 @@ rootjQuery = jQuery( document );
 
 
 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
-
-       // Methods guaranteed to produce a unique set when starting from a unique set
+       // methods guaranteed to produce a unique set when starting from a unique set
        guaranteedUnique = {
                children: true,
                contents: true,
@@ -3070,19 +2820,48 @@ var rparentsprev = /^(?:parents|prev(?:Until|All))/,
                prev: true
        };
 
-jQuery.fn.extend( {
+jQuery.extend({
+       dir: function( elem, dir, until ) {
+               var matched = [],
+                       truncate = until !== undefined;
+
+               while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
+                       if ( elem.nodeType === 1 ) {
+                               if ( truncate && jQuery( elem ).is( until ) ) {
+                                       break;
+                               }
+                               matched.push( elem );
+                       }
+               }
+               return matched;
+       },
+
+       sibling: function( n, elem ) {
+               var matched = [];
+
+               for ( ; n; n = n.nextSibling ) {
+                       if ( n.nodeType === 1 && n !== elem ) {
+                               matched.push( n );
+                       }
+               }
+
+               return matched;
+       }
+});
+
+jQuery.fn.extend({
        has: function( target ) {
                var targets = jQuery( target, this ),
                        l = targets.length;
 
-               return this.filter( function() {
+               return this.filter(function() {
                        var i = 0;
                        for ( ; i < l; i++ ) {
-                               if ( jQuery.contains( this, targets[ i ] ) ) {
+                               if ( jQuery.contains( this, targets[i] ) ) {
                                        return true;
                                }
                        }
-               } );
+               });
        },
 
        closest: function( selectors, context ) {
@@ -3090,32 +2869,31 @@ jQuery.fn.extend( {
                        i = 0,
                        l = this.length,
                        matched = [],
-                       targets = typeof selectors !== "string" && jQuery( selectors );
-
-               // 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 ) {
+                       pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+                               jQuery( selectors, context || this.context ) :
+                               0;
 
-                                       // Always skip document fragments
-                                       if ( cur.nodeType < 11 && ( targets ?
-                                               targets.index( cur ) > -1 :
+               for ( ; i < l; i++ ) {
+                       for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
+                               // Always skip document fragments
+                               if ( cur.nodeType < 11 && (pos ?
+                                       pos.index(cur) > -1 :
 
-                                               // Don't pass non-elements to Sizzle
-                                               cur.nodeType === 1 &&
-                                                       jQuery.find.matchesSelector( cur, selectors ) ) ) {
+                                       // Don't pass non-elements to Sizzle
+                                       cur.nodeType === 1 &&
+                                               jQuery.find.matchesSelector(cur, selectors)) ) {
 
-                                               matched.push( cur );
-                                               break;
-                                       }
+                                       matched.push( cur );
+                                       break;
                                }
                        }
                }
 
-               return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
+               return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
        },
 
-       // Determine the position of an element within the set
+       // Determine the position of an element within
+       // the matched set of elements
        index: function( elem ) {
 
                // No argument, return index in parent
@@ -3123,7 +2901,7 @@ jQuery.fn.extend( {
                        return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
                }
 
-               // Index in selector
+               // index in selector
                if ( typeof elem === "string" ) {
                        return indexOf.call( jQuery( elem ), this[ 0 ] );
                }
@@ -3138,7 +2916,7 @@ jQuery.fn.extend( {
 
        add: function( selector, context ) {
                return this.pushStack(
-                       jQuery.uniqueSort(
+                       jQuery.unique(
                                jQuery.merge( this.get(), jQuery( selector, context ) )
                        )
                );
@@ -3146,26 +2924,26 @@ jQuery.fn.extend( {
 
        addBack: function( selector ) {
                return this.add( selector == null ?
-                       this.prevObject : this.prevObject.filter( selector )
+                       this.prevObject : this.prevObject.filter(selector)
                );
        }
-} );
+});
 
 function sibling( cur, dir ) {
-       while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
+       while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
        return cur;
 }
 
-jQuery.each( {
+jQuery.each({
        parent: function( elem ) {
                var parent = elem.parentNode;
                return parent && parent.nodeType !== 11 ? parent : null;
        },
        parents: function( elem ) {
-               return dir( elem, "parentNode" );
+               return jQuery.dir( elem, "parentNode" );
        },
        parentsUntil: function( elem, i, until ) {
-               return dir( elem, "parentNode", until );
+               return jQuery.dir( elem, "parentNode", until );
        },
        next: function( elem ) {
                return sibling( elem, "nextSibling" );
@@ -3174,36 +2952,25 @@ jQuery.each( {
                return sibling( elem, "previousSibling" );
        },
        nextAll: function( elem ) {
-               return dir( elem, "nextSibling" );
+               return jQuery.dir( elem, "nextSibling" );
        },
        prevAll: function( elem ) {
-               return dir( elem, "previousSibling" );
+               return jQuery.dir( elem, "previousSibling" );
        },
        nextUntil: function( elem, i, until ) {
-               return dir( elem, "nextSibling", until );
+               return jQuery.dir( elem, "nextSibling", until );
        },
        prevUntil: function( elem, i, until ) {
-               return dir( elem, "previousSibling", until );
+               return jQuery.dir( elem, "previousSibling", until );
        },
        siblings: function( elem ) {
-               return siblings( ( elem.parentNode || {} ).firstChild, elem );
+               return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
        },
        children: function( elem ) {
-               return siblings( elem.firstChild );
+               return jQuery.sibling( elem.firstChild );
        },
        contents: function( elem ) {
-        if ( nodeName( elem, "iframe" ) ) {
-            return elem.contentDocument;
-        }
-
-        // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
-        // Treat the template element as a regular one in browsers that
-        // don't support it.
-        if ( nodeName( elem, "template" ) ) {
-            elem = elem.content || elem;
-        }
-
-        return jQuery.merge( [], elem.childNodes );
+               return elem.contentDocument || jQuery.merge( [], elem.childNodes );
        }
 }, function( name, fn ) {
        jQuery.fn[ name ] = function( until, selector ) {
@@ -3218,10 +2985,9 @@ jQuery.each( {
                }
 
                if ( this.length > 1 ) {
-
                        // Remove duplicates
                        if ( !guaranteedUnique[ name ] ) {
-                               jQuery.uniqueSort( matched );
+                               jQuery.unique( matched );
                        }
 
                        // Reverse order for parents* and prev-derivatives
@@ -3232,17 +2998,20 @@ jQuery.each( {
 
                return this.pushStack( matched );
        };
-} );
-var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
+});
+var rnotwhite = (/\S+/g);
 
 
 
-// Convert String-formatted options into Object-formatted ones
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
 function createOptions( options ) {
-       var object = {};
-       jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
+       var object = optionsCache[ options ] = {};
+       jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
                object[ flag ] = true;
-       } );
+       });
        return object;
 }
 
@@ -3273,186 +3042,156 @@ jQuery.Callbacks = function( options ) {
        // Convert options from String-formatted to Object-formatted if needed
        // (we check in cache first)
        options = typeof options === "string" ?
-               createOptions( options ) :
+               ( optionsCache[ options ] || createOptions( options ) ) :
                jQuery.extend( {}, options );
 
-       var // Flag to know if list is currently firing
-               firing,
-
-               // Last fire value for non-forgettable lists
+       var // Last fire value (for non-forgettable lists)
                memory,
-
                // Flag to know if list was already fired
                fired,
-
-               // Flag to prevent firing
-               locked,
-
+               // Flag to know if list is currently firing
+               firing,
+               // First callback to fire (used internally by add and fireWith)
+               firingStart,
+               // End of the loop when firing
+               firingLength,
+               // Index of currently firing callback (modified by remove if needed)
+               firingIndex,
                // Actual callback list
                list = [],
-
-               // Queue of execution data for repeatable lists
-               queue = [],
-
-               // Index of currently firing callback (modified by add/remove as needed)
-               firingIndex = -1,
-
+               // Stack of fire calls for repeatable lists
+               stack = !options.once && [],
                // Fire callbacks
-               fire = function() {
-
-                       // Enforce single-firing
-                       locked = locked || options.once;
-
-                       // Execute callbacks for all pending executions,
-                       // respecting firingIndex overrides and runtime changes
-                       fired = firing = true;
-                       for ( ; queue.length; firingIndex = -1 ) {
-                               memory = queue.shift();
-                               while ( ++firingIndex < list.length ) {
-
-                                       // Run callback and check for early termination
-                                       if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
-                                               options.stopOnFalse ) {
-
-                                               // Jump to end and forget the data so .add doesn't re-fire
-                                               firingIndex = list.length;
-                                               memory = false;
-                                       }
+               fire = function( data ) {
+                       memory = options.memory && data;
+                       fired = true;
+                       firingIndex = firingStart || 0;
+                       firingStart = 0;
+                       firingLength = list.length;
+                       firing = true;
+                       for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+                               if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+                                       memory = false; // To prevent further calls using add
+                                       break;
                                }
                        }
-
-                       // Forget the data if we're done with it
-                       if ( !options.memory ) {
-                               memory = false;
-                       }
-
                        firing = false;
-
-                       // Clean up if we're done firing for good
-                       if ( locked ) {
-
-                               // Keep an empty list if we have data for future add calls
-                               if ( memory ) {
+                       if ( list ) {
+                               if ( stack ) {
+                                       if ( stack.length ) {
+                                               fire( stack.shift() );
+                                       }
+                               } else if ( memory ) {
                                        list = [];
-
-                               // Otherwise, this object is spent
                                } else {
-                                       list = "";
+                                       self.disable();
                                }
                        }
                },
-
                // Actual Callbacks object
                self = {
-
                        // Add a callback or a collection of callbacks to the list
                        add: function() {
                                if ( list ) {
-
-                                       // If we have memory from a past run, we should fire after adding
-                                       if ( memory && !firing ) {
-                                               firingIndex = list.length - 1;
-                                               queue.push( memory );
-                                       }
-
-                                       ( function add( args ) {
+                                       // First, we save the current length
+                                       var start = list.length;
+                                       (function add( args ) {
                                                jQuery.each( args, function( _, arg ) {
-                                                       if ( jQuery.isFunction( arg ) ) {
+                                                       var type = jQuery.type( arg );
+                                                       if ( type === "function" ) {
                                                                if ( !options.unique || !self.has( arg ) ) {
                                                                        list.push( arg );
                                                                }
-                                                       } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
-
+                                                       } else if ( arg && arg.length && type !== "string" ) {
                                                                // Inspect recursively
                                                                add( arg );
                                                        }
-                                               } );
-                                       } )( arguments );
-
-                                       if ( memory && !firing ) {
-                                               fire();
+                                               });
+                                       })( arguments );
+                                       // Do we need to add the callbacks to the
+                                       // current firing batch?
+                                       if ( firing ) {
+                                               firingLength = list.length;
+                                       // With memory, if we're not firing then
+                                       // we should call right away
+                                       } else if ( memory ) {
+                                               firingStart = start;
+                                               fire( memory );
                                        }
                                }
                                return this;
                        },
-
                        // Remove a callback from the list
                        remove: function() {
-                               jQuery.each( arguments, function( _, arg ) {
-                                       var index;
-                                       while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
-                                               list.splice( index, 1 );
-
-                                               // Handle firing indexes
-                                               if ( index <= firingIndex ) {
-                                                       firingIndex--;
+                               if ( list ) {
+                                       jQuery.each( arguments, function( _, arg ) {
+                                               var index;
+                                               while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+                                                       list.splice( index, 1 );
+                                                       // Handle firing indexes
+                                                       if ( firing ) {
+                                                               if ( index <= firingLength ) {
+                                                                       firingLength--;
+                                                               }
+                                                               if ( index <= firingIndex ) {
+                                                                       firingIndex--;
+                                                               }
+                                                       }
                                                }
-                                       }
-                               } );
+                                       });
+                               }
                                return this;
                        },
-
                        // Check if a given callback is in the list.
                        // If no argument is given, return whether or not list has callbacks attached.
                        has: function( fn ) {
-                               return fn ?
-                                       jQuery.inArray( fn, list ) > -1 :
-                                       list.length > 0;
+                               return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
                        },
-
                        // Remove all callbacks from the list
                        empty: function() {
-                               if ( list ) {
-                                       list = [];
-                               }
+                               list = [];
+                               firingLength = 0;
                                return this;
                        },
-
-                       // Disable .fire and .add
-                       // Abort any current/pending executions
-                       // Clear all callbacks and values
+                       // Have the list do nothing anymore
                        disable: function() {
-                               locked = queue = [];
-                               list = memory = "";
+                               list = stack = memory = undefined;
                                return this;
                        },
+                       // Is it disabled?
                        disabled: function() {
                                return !list;
                        },
-
-                       // Disable .fire
-                       // Also disable .add unless we have memory (since it would have no effect)
-                       // Abort any pending executions
+                       // Lock the list in its current state
                        lock: function() {
-                               locked = queue = [];
-                               if ( !memory && !firing ) {
-                                       list = memory = "";
+                               stack = undefined;
+                               if ( !memory ) {
+                                       self.disable();
                                }
                                return this;
                        },
+                       // Is it locked?
                        locked: function() {
-                               return !!locked;
+                               return !stack;
                        },
-
                        // Call all callbacks with the given context and arguments
                        fireWith: function( context, args ) {
-                               if ( !locked ) {
+                               if ( list && ( !fired || stack ) ) {
                                        args = args || [];
                                        args = [ context, args.slice ? args.slice() : args ];
-                                       queue.push( args );
-                                       if ( !firing ) {
-                                               fire();
+                                       if ( firing ) {
+                                               stack.push( args );
+                                       } else {
+                                               fire( args );
                                        }
                                }
                                return this;
                        },
-
                        // Call all the callbacks with the given arguments
                        fire: function() {
                                self.fireWith( this, arguments );
                                return this;
                        },
-
                        // To know if the callbacks have already been called at least once
                        fired: function() {
                                return !!fired;
@@ -3463,59 +3202,14 @@ jQuery.Callbacks = function( options ) {
 };
 
 
-function Identity( v ) {
-       return v;
-}
-function Thrower( ex ) {
-       throw ex;
-}
-
-function adoptValue( value, resolve, reject, noValue ) {
-       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 {
-
-                       // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
-                       // * false: [ value ].slice( 0 ) => resolve( value )
-                       // * true: [ value ].slice( 1 ) => resolve()
-                       resolve.apply( undefined, [ value ].slice( noValue ) );
-               }
-
-       // 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.apply( undefined, [ value ] );
-       }
-}
-
-jQuery.extend( {
+jQuery.extend({
 
        Deferred: function( func ) {
                var tuples = [
-
-                               // 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" ]
+                               // action, add listener, listener list, final state
+                               [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+                               [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+                               [ "notify", "progress", jQuery.Callbacks("memory") ]
                        ],
                        state = "pending",
                        promise = {
@@ -3526,206 +3220,27 @@ jQuery.extend( {
                                        deferred.done( arguments ).fail( arguments );
                                        return this;
                                },
-                               "catch": function( fn ) {
-                                       return promise.then( null, fn );
-                               },
-
-                               // Keep pipe for back-compat
-                               pipe: function( /* fnDone, fnFail, fnProgress */ ) {
+                               then: function( /* fnDone, fnFail, fnProgress */ ) {
                                        var fns = arguments;
-
-                                       return jQuery.Deferred( function( newDefer ) {
+                                       return jQuery.Deferred(function( newDefer ) {
                                                jQuery.each( tuples, function( i, tuple ) {
-
-                                                       // 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 fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+                                                       // deferred[ done | fail | progress ] for forwarding actions to newDefer
+                                                       deferred[ tuple[1] ](function() {
                                                                var returned = fn && fn.apply( this, arguments );
                                                                if ( returned && jQuery.isFunction( returned.promise ) ) {
                                                                        returned.promise()
-                                                                               .progress( newDefer.notify )
                                                                                .done( newDefer.resolve )
-                                                                               .fail( newDefer.reject );
+                                                                               .fail( newDefer.reject )
+                                                                               .progress( newDefer.notify );
                                                                } else {
-                                                                       newDefer[ tuple[ 0 ] + "With" ](
-                                                                               this,
-                                                                               fn ? [ returned ] : arguments
-                                                                       );
+                                                                       newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
                                                                }
-                                                       } );
-                                               } );
+                                                       });
+                                               });
                                                fns = null;
-                                       } ).promise();
+                                       }).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
                                promise: function( obj ) {
@@ -3734,53 +3249,34 @@ 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[ 5 ];
+                               stateString = tuple[ 3 ];
 
-                       // promise.progress = list.add
-                       // promise.done = list.add
-                       // promise.fail = list.add
-                       promise[ tuple[ 1 ] ] = list.add;
+                       // promise[ done | fail | progress ] = list.add
+                       promise[ tuple[1] ] = list.add;
 
                        // Handle state
                        if ( stateString ) {
-                               list.add(
-                                       function() {
-
-                                               // state = "resolved" (i.e., fulfilled)
-                                               // state = "rejected"
-                                               state = stateString;
-                                       },
-
-                                       // rejected_callbacks.disable
-                                       // fulfilled_callbacks.disable
-                                       tuples[ 3 - i ][ 2 ].disable,
+                               list.add(function() {
+                                       // state = [ resolved | rejected ]
+                                       state = stateString;
 
-                                       // progress_callbacks.lock
-                                       tuples[ 0 ][ 2 ].lock
-                               );
+                               // [ reject_list | resolve_list ].disable; progress_list.lock
+                               }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
                        }
 
-                       // 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 ? undefined : this, arguments );
+                       // deferred[ resolve | reject | notify ]
+                       deferred[ tuple[0] ] = function() {
+                               deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
                                return this;
                        };
-
-                       // deferred.notifyWith = list.fireWith
-                       // deferred.resolveWith = list.fireWith
-                       // deferred.rejectWith = list.fireWith
-                       deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
-               } );
+                       deferred[ tuple[0] + "With" ] = list.fireWith;
+               });
 
                // Make the deferred a promise
                promise.promise( deferred );
@@ -3795,101 +3291,70 @@ jQuery.extend( {
        },
 
        // Deferred helper
-       when: function( singleValue ) {
-               var
-
-                       // count of uncompleted subordinates
-                       remaining = arguments.length,
-
-                       // count of unprocessed arguments
-                       i = remaining,
-
-                       // subordinate fulfillment data
-                       resolveContexts = Array( i ),
+       when: function( subordinate /* , ..., subordinateN */ ) {
+               var i = 0,
                        resolveValues = slice.call( arguments ),
+                       length = resolveValues.length,
 
-                       // the master Deferred
-                       master = jQuery.Deferred(),
+                       // the count of uncompleted subordinates
+                       remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
 
-                       // subordinate callback factory
-                       updateFunc = function( i ) {
+                       // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+                       deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+                       // Update function for both resolve and progress values
+                       updateFunc = function( i, contexts, values ) {
                                return function( value ) {
-                                       resolveContexts[ i ] = this;
-                                       resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
-                                       if ( !( --remaining ) ) {
-                                               master.resolveWith( resolveContexts, resolveValues );
+                                       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 );
                                        }
                                };
-                       };
-
-               // Single- and empty arguments are adopted like Promise.resolve
-               if ( remaining <= 1 ) {
-                       adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
-                               !remaining );
+                       },
 
-                       // Use .then() to unwrap secondary thenables (cf. gh-3000)
-                       if ( master.state() === "pending" ||
-                               jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
+                       progressValues, progressContexts, resolveContexts;
 
-                               return master.then();
+               // add listeners to Deferred subordinates; treat others as resolved
+               if ( length > 1 ) {
+                       progressValues = new Array( length );
+                       progressContexts = new Array( length );
+                       resolveContexts = new Array( length );
+                       for ( ; i < length; i++ ) {
+                               if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+                                       resolveValues[ i ].promise()
+                                               .done( updateFunc( i, resolveContexts, resolveValues ) )
+                                               .fail( deferred.reject )
+                                               .progress( updateFunc( i, progressContexts, progressValues ) );
+                               } else {
+                                       --remaining;
+                               }
                        }
                }
 
-               // Multiple arguments are aggregated like Promise.all array elements
-               while ( i-- ) {
-                       adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
+               // if we're not waiting on anything, resolve the master
+               if ( !remaining ) {
+                       deferred.resolveWith( resolveContexts, resolveValues );
                }
 
-               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 );
+               return deferred.promise();
        }
-};
-
-
-
-
-jQuery.readyException = function( error ) {
-       window.setTimeout( function() {
-               throw error;
-       } );
-};
-
-
+});
 
 
 // The deferred used on DOM ready
-var readyList = jQuery.Deferred();
+var readyList;
 
 jQuery.fn.ready = function( 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 );
-               } );
+       // Add the callback
+       jQuery.ready.promise().done( fn );
 
        return this;
 };
 
-jQuery.extend( {
-
+jQuery.extend({
        // Is the DOM ready to be used? Set to true once it occurs.
        isReady: false,
 
@@ -3897,6 +3362,15 @@ jQuery.extend( {
        // the ready event fires. See #6781
        readyWait: 1,
 
+       // Hold (or release) the ready event
+       holdReady: function( hold ) {
+               if ( hold ) {
+                       jQuery.readyWait++;
+               } else {
+                       jQuery.ready( true );
+               }
+       },
+
        // Handle when the DOM is ready
        ready: function( wait ) {
 
@@ -3915,43 +3389,57 @@ jQuery.extend( {
 
                // If there are functions bound, to execute
                readyList.resolveWith( document, [ jQuery ] );
-       }
-} );
 
-jQuery.ready.then = readyList.then;
+               // 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
+/**
+ * The ready event handler and self cleanup method
+ */
 function completed() {
-       document.removeEventListener( "DOMContentLoaded", completed );
-       window.removeEventListener( "load", completed );
+       document.removeEventListener( "DOMContentLoaded", completed, false );
+       window.removeEventListener( "load", completed, false );
        jQuery.ready();
 }
 
-// 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 ) ) {
+jQuery.ready.promise = function( obj ) {
+       if ( !readyList ) {
 
-       // Handle it asynchronously to allow scripts the opportunity to delay ready
-       window.setTimeout( jQuery.ready );
+               readyList = jQuery.Deferred();
 
-} else {
+               // Catch cases where $(document).ready() is called after the browser event has already occurred.
+               // we once tried to use readyState "interactive" here, but it caused issues like the one
+               // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+               if ( document.readyState === "complete" ) {
+                       // Handle it asynchronously to allow scripts the opportunity to delay ready
+                       setTimeout( jQuery.ready );
 
-       // Use the handy event callback
-       document.addEventListener( "DOMContentLoaded", completed );
+               } else {
 
-       // A fallback to window.onload, that will always work
-       window.addEventListener( "load", completed );
-}
+                       // Use the handy event callback
+                       document.addEventListener( "DOMContentLoaded", completed, false );
+
+                       // A fallback to window.onload, that will always work
+                       window.addEventListener( "load", completed, false );
+               }
+       }
+       return readyList.promise( obj );
+};
+
+// Kick off the DOM ready check even if the user does not
+jQuery.ready.promise();
 
 
 
 
 // Multifunctional method to get and set values of a collection
 // The value/s can optionally be executed if it's a function
-var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
+var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
        var i = 0,
                len = elems.length,
                bulk = key == null;
@@ -3960,7 +3448,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
        if ( jQuery.type( key ) === "object" ) {
                chainable = true;
                for ( i in key ) {
-                       access( elems, fn, i, key[ i ], true, emptyGet, raw );
+                       jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
                }
 
        // Sets one value
@@ -3972,7 +3460,6 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
                }
 
                if ( bulk ) {
-
                        // Bulk operations run against the entire set
                        if ( raw ) {
                                fn.call( elems, value );
@@ -3989,109 +3476,127 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
 
                if ( fn ) {
                        for ( ; i < len; i++ ) {
-                               fn(
-                                       elems[ i ], key, raw ?
-                                       value :
-                                       value.call( elems[ i ], i, fn( elems[ i ], key ) )
-                               );
+                               fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
                        }
                }
        }
 
-       if ( chainable ) {
-               return elems;
-       }
-
-       // Gets
-       if ( bulk ) {
-               return fn.call( elems );
-       }
+       return chainable ?
+               elems :
 
-       return len ? fn( elems[ 0 ], key ) : emptyGet;
+               // Gets
+               bulk ?
+                       fn.call( elems ) :
+                       len ? fn( elems[0], key ) : emptyGet;
 };
-var acceptData = function( owner ) {
 
+
+/**
+ * Determines whether an object can have data
+ */
+jQuery.acceptData = function( owner ) {
        // Accepts only:
        //  - Node
        //    - Node.ELEMENT_NODE
        //    - Node.DOCUMENT_NODE
        //  - Object
        //    - Any
+       /* jshint -W018 */
        return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
 };
 
 
-
-
 function Data() {
-       this.expando = jQuery.expando + Data.uid++;
+       // Support: Android < 4,
+       // Old WebKit does not have Object.preventExtensions/freeze method,
+       // return new empty object instead with no [[set]] accessor
+       Object.defineProperty( this.cache = {}, 0, {
+               get: function() {
+                       return {};
+               }
+       });
+
+       this.expando = jQuery.expando + Math.random();
 }
 
 Data.uid = 1;
+Data.accepts = jQuery.acceptData;
 
 Data.prototype = {
+       key: function( owner ) {
+               // We can accept data for non-element nodes in modern browsers,
+               // but we should not, see #8335.
+               // Always return the key for a frozen object.
+               if ( !Data.accepts( owner ) ) {
+                       return 0;
+               }
 
-       cache: function( owner ) {
-
-               // Check if the owner object already has a cache
-               var value = owner[ this.expando ];
+               var descriptor = {},
+                       // Check if the owner object already has a cache key
+                       unlock = owner[ this.expando ];
 
                // If not, create one
-               if ( !value ) {
-                       value = {};
-
-                       // 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 ) ) {
-
-                               // 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 property
-                               // configurable must be true to allow the property to be
-                               // deleted when data is removed
-                               } else {
-                                       Object.defineProperty( owner, this.expando, {
-                                               value: value,
-                                               configurable: true
-                                       } );
-                               }
+               if ( !unlock ) {
+                       unlock = Data.uid++;
+
+                       // Secure it in a non-enumerable, non-writable property
+                       try {
+                               descriptor[ this.expando ] = { value: unlock };
+                               Object.defineProperties( owner, descriptor );
+
+                       // Support: Android < 4
+                       // Fallback to a less secure definition
+                       } catch ( e ) {
+                               descriptor[ this.expando ] = unlock;
+                               jQuery.extend( owner, descriptor );
                        }
                }
 
-               return value;
+               // Ensure the cache object
+               if ( !this.cache[ unlock ] ) {
+                       this.cache[ unlock ] = {};
+               }
+
+               return unlock;
        },
        set: function( owner, data, value ) {
                var prop,
-                       cache = this.cache( owner );
+                       // There may be an unlock assigned to this node,
+                       // if there is no entry for this "owner", create one inline
+                       // and set the unlock as though an owner entry had always existed
+                       unlock = this.key( owner ),
+                       cache = this.cache[ unlock ];
 
                // Handle: [ owner, key, value ] args
-               // Always use camelCase key (gh-2257)
                if ( typeof data === "string" ) {
-                       cache[ jQuery.camelCase( data ) ] = value;
+                       cache[ data ] = value;
 
                // Handle: [ owner, { properties } ] args
                } else {
-
-                       // Copy the properties one-by-one to the cache object
-                       for ( prop in data ) {
-                               cache[ jQuery.camelCase( prop ) ] = data[ prop ];
+                       // Fresh assignments by object are shallow copied
+                       if ( jQuery.isEmptyObject( cache ) ) {
+                               jQuery.extend( this.cache[ unlock ], data );
+                       // Otherwise, copy the properties one-by-one to the cache object
+                       } else {
+                               for ( prop in data ) {
+                                       cache[ prop ] = data[ prop ];
+                               }
                        }
                }
                return cache;
        },
        get: function( owner, key ) {
-               return key === undefined ?
-                       this.cache( owner ) :
+               // Either a valid cache is found, or will be created.
+               // New caches will be created and the unlock returned,
+               // allowing direct access to the newly created
+               // empty data object. A valid owner object must be provided.
+               var cache = this.cache[ this.key( owner ) ];
 
-                       // Always use camelCase key (gh-2257)
-                       owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
+               return key === undefined ?
+                       cache : cache[ key ];
        },
        access: function( owner, key, value ) {
-
+               var stored;
                // In cases where either:
                //
                //   1. No key was specified
@@ -4104,12 +3609,15 @@ Data.prototype = {
                //   2. The data stored at the key
                //
                if ( key === undefined ||
-                               ( ( key && typeof key === "string" ) && value === undefined ) ) {
+                               ((key && typeof key === "string") && value === undefined) ) {
 
-                       return this.get( owner, key );
+                       stored = this.get( owner, key );
+
+                       return stored !== undefined ?
+                               stored : this.get( owner, jQuery.camelCase(key) );
                }
 
-               // When the key is not a string, or both a key and value
+               // [*]When the key is not a string, or both a key and value
                // are specified, set or extend (existing objects) with either:
                //
                //   1. An object of properties
@@ -4122,100 +3630,73 @@ Data.prototype = {
                return value !== undefined ? value : key;
        },
        remove: function( owner, key ) {
-               var i,
-                       cache = owner[ this.expando ];
+               var i, name, camel,
+                       unlock = this.key( owner ),
+                       cache = this.cache[ unlock ];
 
-               if ( cache === undefined ) {
-                       return;
-               }
-
-               if ( key !== undefined ) {
+               if ( key === undefined ) {
+                       this.cache[ unlock ] = {};
 
+               } else {
                        // Support array or space separated string of keys
-                       if ( Array.isArray( key ) ) {
-
-                               // If key is an array of keys...
-                               // We always set camelCase keys, so remove that.
-                               key = key.map( jQuery.camelCase );
+                       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 ) );
                        } else {
-                               key = jQuery.camelCase( key );
-
-                               // 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 ) || [] );
+                               camel = 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 ) || [] );
+                               }
                        }
 
-                       i = key.length;
-
+                       i = name.length;
                        while ( i-- ) {
-                               delete cache[ key[ i ] ];
-                       }
-               }
-
-               // Remove the expando if there's no more data
-               if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
-
-                       // Support: Chrome <=35 - 45
-                       // Webkit & Blink performance suffers when deleting properties
-                       // from DOM nodes, so set to undefined instead
-                       // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
-                       if ( owner.nodeType ) {
-                               owner[ this.expando ] = undefined;
-                       } else {
-                               delete owner[ this.expando ];
+                               delete cache[ name[ i ] ];
                        }
                }
        },
        hasData: function( owner ) {
-               var cache = owner[ this.expando ];
-               return cache !== undefined && !jQuery.isEmptyObject( cache );
+               return !jQuery.isEmptyObject(
+                       this.cache[ owner[ this.expando ] ] || {}
+               );
+       },
+       discard: function( owner ) {
+               if ( owner[ this.expando ] ) {
+                       delete this.cache[ owner[ this.expando ] ];
+               }
        }
 };
-var dataPriv = new Data();
+var data_priv = new Data();
 
-var dataUser = new Data();
+var data_user = new Data();
 
 
 
-//     Implementation Summary
-//
-//     1. Enforce API surface and semantic compatibility with 1.9.x branch
-//     2. Improve the module's maintainability by reducing the storage
-//             paths to a single mechanism.
-//     3. Use the same single mechanism to support "private" and "user" data.
-//     4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
-//     5. Avoid exposing implementation details on user objects (eg. expando properties)
-//     6. Provide a clear path for implementation upgrade to WeakMap in 2014
-
+/*
+       Implementation Summary
+
+       1. Enforce API surface and semantic compatibility with 1.9.x branch
+       2. Improve the module's maintainability by reducing the storage
+               paths to a single mechanism.
+       3. Use the same single mechanism to support "private" and "user" data.
+       4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
+       5. Avoid exposing implementation details on user objects (eg. expando properties)
+       6. Provide a clear path for implementation upgrade to WeakMap in 2014
+*/
 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;
-}
+       rmultiDash = /([A-Z])/g;
 
 function dataAttr( elem, key, data ) {
        var name;
@@ -4223,16 +3704,22 @@ function dataAttr( elem, key, data ) {
        // If nothing was found internally, try to fetch any
        // data from the HTML5 data-* attribute
        if ( data === undefined && elem.nodeType === 1 ) {
-               name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
+               name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
                data = elem.getAttribute( name );
 
                if ( typeof data === "string" ) {
                        try {
-                               data = getData( data );
-                       } catch ( e ) {}
+                               data = data === "true" ? true :
+                                       data === "false" ? false :
+                                       data === "null" ? null :
+                                       // Only convert to a number if it doesn't change the string
+                                       +data + "" === data ? +data :
+                                       rbrace.test( data ) ? jQuery.parseJSON( data ) :
+                                       data;
+                       } catch( e ) {}
 
                        // Make sure we set the data so it isn't changed later
-                       dataUser.set( elem, key, data );
+                       data_user.set( elem, key, data );
                } else {
                        data = undefined;
                }
@@ -4240,31 +3727,31 @@ function dataAttr( elem, key, data ) {
        return data;
 }
 
-jQuery.extend( {
+jQuery.extend({
        hasData: function( elem ) {
-               return dataUser.hasData( elem ) || dataPriv.hasData( elem );
+               return data_user.hasData( elem ) || data_priv.hasData( elem );
        },
 
        data: function( elem, name, data ) {
-               return dataUser.access( elem, name, data );
+               return data_user.access( elem, name, data );
        },
 
        removeData: function( elem, name ) {
-               dataUser.remove( elem, name );
+               data_user.remove( elem, name );
        },
 
        // TODO: Now that all calls to _data and _removeData have been replaced
-       // with direct calls to dataPriv methods, these can be deprecated.
+       // with direct calls to data_priv methods, these can be deprecated.
        _data: function( elem, name, data ) {
-               return dataPriv.access( elem, name, data );
+               return data_priv.access( elem, name, data );
        },
 
        _removeData: function( elem, name ) {
-               dataPriv.remove( elem, name );
+               data_priv.remove( elem, name );
        }
-} );
+});
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        data: function( key, value ) {
                var i, name, data,
                        elem = this[ 0 ],
@@ -4273,23 +3760,23 @@ jQuery.fn.extend( {
                // Gets all values
                if ( key === undefined ) {
                        if ( this.length ) {
-                               data = dataUser.get( elem );
+                               data = data_user.get( elem );
 
-                               if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
+                               if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
                                        i = attrs.length;
                                        while ( i-- ) {
 
-                                               // Support: IE 11 only
+                                               // Support: IE11+
                                                // The attrs elements can be null (#14894)
                                                if ( attrs[ i ] ) {
                                                        name = attrs[ i ].name;
                                                        if ( name.indexOf( "data-" ) === 0 ) {
-                                                               name = jQuery.camelCase( name.slice( 5 ) );
+                                                               name = jQuery.camelCase( name.slice(5) );
                                                                dataAttr( elem, name, data[ name ] );
                                                        }
                                                }
                                        }
-                                       dataPriv.set( elem, "hasDataAttrs", true );
+                                       data_priv.set( elem, "hasDataAttrs", true );
                                }
                        }
 
@@ -4298,13 +3785,14 @@ jQuery.fn.extend( {
 
                // Sets multiple values
                if ( typeof key === "object" ) {
-                       return this.each( function() {
-                               dataUser.set( this, key );
-                       } );
+                       return this.each(function() {
+                               data_user.set( this, key );
+                       });
                }
 
                return access( this, function( value ) {
-                       var data;
+                       var data,
+                               camelKey = jQuery.camelCase( key );
 
                        // The calling jQuery object (element matches) is not empty
                        // (and therefore has an element appears at this[ 0 ]) and the
@@ -4312,17 +3800,23 @@ jQuery.fn.extend( {
                        // will result in `undefined` for elem = this[ 0 ] which will
                        // throw an exception if an attempt to read a data cache is made.
                        if ( elem && value === undefined ) {
+                               // Attempt to get data from the cache
+                               // with the key as-is
+                               data = data_user.get( elem, key );
+                               if ( data !== undefined ) {
+                                       return data;
+                               }
 
                                // Attempt to get data from the cache
-                               // The key will always be camelCased in Data
-                               data = dataUser.get( elem, key );
+                               // with the key camelized
+                               data = data_user.get( elem, camelKey );
                                if ( data !== undefined ) {
                                        return data;
                                }
 
                                // Attempt to "discover" the data in
                                // HTML5 custom data-* attrs
-                               data = dataAttr( elem, key );
+                               data = dataAttr( elem, camelKey, undefined );
                                if ( data !== undefined ) {
                                        return data;
                                }
@@ -4332,34 +3826,46 @@ jQuery.fn.extend( {
                        }
 
                        // Set the data...
-                       this.each( function() {
-
-                               // We always store the camelCased key
-                               dataUser.set( this, key, value );
-                       } );
+                       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 = data_user.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...*
+                               data_user.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 ) {
+                                       data_user.set( this, key, value );
+                               }
+                       });
                }, null, value, arguments.length > 1, null, true );
        },
 
        removeData: function( key ) {
-               return this.each( function() {
-                       dataUser.remove( this, key );
-               } );
+               return this.each(function() {
+                       data_user.remove( this, key );
+               });
        }
-} );
+});
 
 
-jQuery.extend( {
+jQuery.extend({
        queue: function( elem, type, data ) {
                var queue;
 
                if ( elem ) {
                        type = ( type || "fx" ) + "queue";
-                       queue = dataPriv.get( elem, type );
+                       queue = data_priv.get( elem, type );
 
                        // Speed up dequeue by getting out quickly if this is just a lookup
                        if ( data ) {
-                               if ( !queue || Array.isArray( data ) ) {
-                                       queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
+                               if ( !queue || jQuery.isArray( data ) ) {
+                                       queue = data_priv.access( elem, type, jQuery.makeArray(data) );
                                } else {
                                        queue.push( data );
                                }
@@ -4393,7 +3899,7 @@ jQuery.extend( {
                                queue.unshift( "inprogress" );
                        }
 
-                       // Clear up the last queue stop function
+                       // clear up the last queue stop function
                        delete hooks.stop;
                        fn.call( elem, next, hooks );
                }
@@ -4403,18 +3909,18 @@ jQuery.extend( {
                }
        },
 
-       // Not public - generate a queueHooks object, or return the current one
+       // not intended for public consumption - generates a queueHooks object, or returns the current one
        _queueHooks: function( elem, type ) {
                var key = type + "queueHooks";
-               return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
-                       empty: jQuery.Callbacks( "once memory" ).add( function() {
-                               dataPriv.remove( elem, [ type + "queue", key ] );
-                       } )
-               } );
+               return data_priv.get( elem, key ) || data_priv.access( elem, key, {
+                       empty: jQuery.Callbacks("once memory").add(function() {
+                               data_priv.remove( elem, [ type + "queue", key ] );
+                       })
+               });
        }
-} );
+});
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        queue: function( type, data ) {
                var setter = 2;
 
@@ -4425,31 +3931,30 @@ jQuery.fn.extend( {
                }
 
                if ( arguments.length < setter ) {
-                       return jQuery.queue( this[ 0 ], type );
+                       return jQuery.queue( this[0], type );
                }
 
                return data === undefined ?
                        this :
-                       this.each( function() {
+                       this.each(function() {
                                var queue = jQuery.queue( this, type, data );
 
-                               // Ensure a hooks for this queue
+                               // ensure a hooks for this queue
                                jQuery._queueHooks( this, type );
 
-                               if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
+                               if ( type === "fx" && queue[0] !== "inprogress" ) {
                                        jQuery.dequeue( this, type );
                                }
-                       } );
+                       });
        },
        dequeue: function( type ) {
-               return this.each( function() {
+               return this.each(function() {
                        jQuery.dequeue( this, type );
-               } );
+               });
        },
        clearQueue: function( type ) {
                return this.queue( type || "fx", [] );
        },
-
        // Get a promise resolved when queues of a certain type
        // are emptied (fx is the type by default)
        promise: function( type, obj ) {
@@ -4471,7 +3976,7 @@ jQuery.fn.extend( {
                type = type || "fx";
 
                while ( i-- ) {
-                       tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
+                       tmp = data_priv.get( elements[ i ], type + "queueHooks" );
                        if ( tmp && tmp.empty ) {
                                count++;
                                tmp.empty.add( resolve );
@@ -4480,408 +3985,57 @@ jQuery.fn.extend( {
                resolve();
                return defer.promise( obj );
        }
-} );
-var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
-
-var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
-
+});
+var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
 
 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
 
-var isHiddenWithinTree = function( elem, el ) {
-
-               // isHiddenWithinTree might be called from jQuery#filter function;
+var isHidden = function( elem, el ) {
+               // isHidden might be called from jQuery#filter function;
                // in that case, element will be second argument
                elem = el || 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";
+               return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
        };
 
-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 ) {
-       var adjusted,
-               scale = 1,
-               maxIterations = 20,
-               currentValue = tween ?
-                       function() {
-                               return tween.cur();
-                       } :
-                       function() {
-                               return jQuery.css( elem, prop, "" );
-                       },
-               initial = currentValue(),
-               unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
-
-               // Starting value computation is required for potential unit mismatches
-               initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
-                       rcssNum.exec( jQuery.css( elem, prop ) );
-
-       if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
-
-               // Trust units reported by jQuery.css
-               unit = unit || initialInUnit[ 3 ];
-
-               // Make sure we update the tween properties later on
-               valueParts = valueParts || [];
-
-               // Iteratively approximate from a nonzero starting point
-               initialInUnit = +initial || 1;
-
-               do {
-
-                       // If previous iteration zeroed out, double until we get *something*.
-                       // Use string for doubling so we don't accidentally see scale as unchanged below
-                       scale = scale || ".5";
-
-                       // Adjust and apply
-                       initialInUnit = initialInUnit / scale;
-                       jQuery.style( elem, prop, initialInUnit + unit );
-
-               // Update scale, tolerating zero or NaN from tween.cur()
-               // Break the loop if scale is unchanged or perfect, or if we've just had enough.
-               } while (
-                       scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
-               );
-       }
-
-       if ( valueParts ) {
-               initialInUnit = +initialInUnit || +initial || 0;
-
-               // Apply relative offset (+=/-=) if specified
-               adjusted = valueParts[ 1 ] ?
-                       initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
-                       +valueParts[ 2 ];
-               if ( tween ) {
-                       tween.unit = unit;
-                       tween.start = initialInUnit;
-                       tween.end = adjusted;
-               }
-       }
-       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 = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
-
-var rscriptType = ( /^$|\/(?:java|ecma)script/i );
-
-
-
-// We have to close these tags to support XHTML (#13200)
-var wrapMap = {
-
-       // Support: IE <=9 only
-       option: [ 1, "<select multiple='multiple'>", "</select>" ],
+var rcheckableType = (/^(?:checkbox|radio)$/i);
 
-       // XHTML parsers do not magically insert elements in the
-       // same way that tag soup parsers do. So we cannot shorten
-       // this by omitting <tbody> or other required elements.
-       thead: [ 1, "<table>", "</table>" ],
-       col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
-       tr: [ 2, "<table><tbody>", "</tbody></table>" ],
-       td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
 
-       _default: [ 0, "", "" ]
-};
-
-// Support: IE <=9 only
-wrapMap.optgroup = wrapMap.option;
-
-wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
-wrapMap.th = wrapMap.td;
-
-
-function getAll( context, tag ) {
-
-       // Support: IE <=9 - 11 only
-       // Use typeof to avoid zero-argument method invocation on host objects (#15151)
-       var 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 && nodeName( context, tag ) ) {
-               return jQuery.merge( [ context ], ret );
-       }
-
-       return ret;
-}
-
-
-// Mark scripts as having already been evaluated
-function setGlobalEval( elems, refElements ) {
-       var i = 0,
-               l = elems.length;
-
-       for ( ; i < l; i++ ) {
-               dataPriv.set(
-                       elems[ i ],
-                       "globalEval",
-                       !refElements || dataPriv.get( refElements[ i ], "globalEval" )
-               );
-       }
-}
-
-
-var rhtml = /<|&#?\w+;/;
-
-function buildFragment( elems, context, scripts, selection, ignored ) {
-       var elem, tmp, tag, wrap, contains, j,
-               fragment = context.createDocumentFragment(),
-               nodes = [],
-               i = 0,
-               l = elems.length;
-
-       for ( ; i < l; i++ ) {
-               elem = elems[ i ];
-
-               if ( elem || elem === 0 ) {
-
-                       // Add nodes directly
-                       if ( jQuery.type( elem ) === "object" ) {
-
-                               // Support: Android <=4.0 only, PhantomJS 1 only
-                               // push.apply(_, arraylike) throws on ancient WebKit
-                               jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
-
-                       // Convert non-html into a text node
-                       } else if ( !rhtml.test( elem ) ) {
-                               nodes.push( context.createTextNode( elem ) );
-
-                       // Convert html into DOM nodes
-                       } else {
-                               tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
-
-                               // Deserialize a standard representation
-                               tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
-                               wrap = wrapMap[ tag ] || wrapMap._default;
-                               tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
-
-                               // Descend through wrappers to the right content
-                               j = wrap[ 0 ];
-                               while ( j-- ) {
-                                       tmp = tmp.lastChild;
-                               }
-
-                               // Support: Android <=4.0 only, PhantomJS 1 only
-                               // push.apply(_, arraylike) throws on ancient WebKit
-                               jQuery.merge( nodes, tmp.childNodes );
-
-                               // Remember the top-level container
-                               tmp = fragment.firstChild;
-
-                               // Ensure the created nodes are orphaned (#12392)
-                               tmp.textContent = "";
-                       }
-               }
-       }
-
-       // Remove wrapper from fragment
-       fragment.textContent = "";
-
-       i = 0;
-       while ( ( elem = nodes[ i++ ] ) ) {
-
-               // Skip elements already in the context collection (trac-4087)
-               if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
-                       if ( ignored ) {
-                               ignored.push( elem );
-                       }
-                       continue;
-               }
-
-               contains = jQuery.contains( elem.ownerDocument, elem );
-
-               // Append to fragment
-               tmp = getAll( fragment.appendChild( elem ), "script" );
-
-               // Preserve script evaluation history
-               if ( contains ) {
-                       setGlobalEval( tmp );
-               }
-
-               // Capture executables
-               if ( scripts ) {
-                       j = 0;
-                       while ( ( elem = tmp[ j++ ] ) ) {
-                               if ( rscriptType.test( elem.type || "" ) ) {
-                                       scripts.push( elem );
-                               }
-                       }
-               }
-       }
 
-       return fragment;
-}
-
-
-( function() {
+(function() {
        var fragment = document.createDocumentFragment(),
                div = fragment.appendChild( document.createElement( "div" ) ),
                input = document.createElement( "input" );
 
-       // Support: Android 4.0 - 4.3 only
-       // Check state lost if the name is set (#11217)
+       // #11217 - WebKit loses check when the name is after the checked attribute
        // Support: Windows Web Apps (WWA)
-       // `name` and `type` must use .setAttribute for WWA (#14901)
+       // `name` and `type` need .setAttribute for WWA
        input.setAttribute( "type", "radio" );
        input.setAttribute( "checked", "checked" );
        input.setAttribute( "name", "t" );
 
        div.appendChild( input );
 
-       // Support: Android <=4.1 only
-       // Older WebKit doesn't clone checked state correctly in fragments
+       // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
+       // old WebKit doesn't clone checked state correctly in fragments
        support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
 
-       // Support: IE <=11 only
        // Make sure textarea (and checkbox) defaultValue is properly cloned
+       // Support: IE9-IE11+
        div.innerHTML = "<textarea>x</textarea>";
        support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
-} )();
-var documentElement = document.documentElement;
+})();
+var strundefined = typeof undefined;
+
+
 
+support.focusinBubbles = "onfocusin" in window;
 
 
 var
        rkeyEvent = /^key/,
-       rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
-       rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
+       rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
+       rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+       rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
 
 function returnTrue() {
        return true;
@@ -4891,75 +4045,12 @@ function returnFalse() {
        return false;
 }
 
-// Support: IE <=9 only
-// See #13393 for more info
 function safeActiveElement() {
        try {
                return document.activeElement;
        } catch ( err ) { }
 }
 
-function on( elem, types, selector, data, fn, one ) {
-       var origFn, type;
-
-       // Types can be a map of types/handlers
-       if ( typeof types === "object" ) {
-
-               // ( types-Object, selector, data )
-               if ( typeof selector !== "string" ) {
-
-                       // ( types-Object, data )
-                       data = data || selector;
-                       selector = undefined;
-               }
-               for ( type in types ) {
-                       on( elem, type, selector, data, types[ type ], one );
-               }
-               return elem;
-       }
-
-       if ( data == null && fn == null ) {
-
-               // ( types, fn )
-               fn = selector;
-               data = selector = undefined;
-       } else if ( fn == null ) {
-               if ( typeof selector === "string" ) {
-
-                       // ( types, selector, fn )
-                       fn = data;
-                       data = undefined;
-               } else {
-
-                       // ( types, data, fn )
-                       fn = data;
-                       data = selector;
-                       selector = undefined;
-               }
-       }
-       if ( fn === false ) {
-               fn = returnFalse;
-       } else if ( !fn ) {
-               return elem;
-       }
-
-       if ( one === 1 ) {
-               origFn = fn;
-               fn = function( event ) {
-
-                       // Can use an empty set, since event contains the info
-                       jQuery().off( event );
-                       return origFn.apply( this, arguments );
-               };
-
-               // Use same guid so caller can remove using origFn
-               fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
-       }
-       return elem.each( function() {
-               jQuery.event.add( this, types, fn, data, selector );
-       } );
-}
-
 /*
  * Helper functions for managing events -- not part of the public interface.
  * Props to Dean Edwards' addEvent library for many of the ideas.
@@ -4973,7 +4064,7 @@ jQuery.event = {
                var handleObjIn, eventHandle, tmp,
                        events, t, handleObj,
                        special, handlers, type, namespaces, origType,
-                       elemData = dataPriv.get( elem );
+                       elemData = data_priv.get( elem );
 
                // Don't attach events to noData or text/comment nodes (but allow plain objects)
                if ( !elemData ) {
@@ -4987,38 +4078,31 @@ 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++;
                }
 
                // Init the element's event structure and main handler, if this is the first
-               if ( !( events = elemData.events ) ) {
+               if ( !(events = elemData.events) ) {
                        events = elemData.events = {};
                }
-               if ( !( eventHandle = elemData.handle ) ) {
+               if ( !(eventHandle = elemData.handle) ) {
                        eventHandle = elemData.handle = function( e ) {
-
                                // Discard the second event of a jQuery.event.trigger() and
                                // when an event is called after a page has unloaded
-                               return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
+                               return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
                                        jQuery.event.dispatch.apply( elem, arguments ) : undefined;
                        };
                }
 
                // Handle multiple events separated by a space
-               types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
+               types = ( types || "" ).match( rnotwhite ) || [ "" ];
                t = types.length;
                while ( t-- ) {
-                       tmp = rtypenamespace.exec( types[ t ] ) || [];
-                       type = origType = tmp[ 1 ];
-                       namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
+                       tmp = rtypenamespace.exec( types[t] ) || [];
+                       type = origType = tmp[1];
+                       namespaces = ( tmp[2] || "" ).split( "." ).sort();
 
                        // There *must* be a type, no attaching namespace-only handlers
                        if ( !type ) {
@@ -5035,7 +4119,7 @@ jQuery.event = {
                        special = jQuery.event.special[ type ] || {};
 
                        // handleObj is passed to all event handlers
-                       handleObj = jQuery.extend( {
+                       handleObj = jQuery.extend({
                                type: type,
                                origType: origType,
                                data: data,
@@ -5043,20 +4127,18 @@ jQuery.event = {
                                guid: handler.guid,
                                selector: selector,
                                needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
-                               namespace: namespaces.join( "." )
+                               namespace: namespaces.join(".")
                        }, handleObjIn );
 
                        // Init the event handler queue if we're the first
-                       if ( !( handlers = events[ type ] ) ) {
+                       if ( !(handlers = events[ type ]) ) {
                                handlers = events[ type ] = [];
                                handlers.delegateCount = 0;
 
                                // Only use addEventListener if the special events handler returns false
-                               if ( !special.setup ||
-                                       special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
-
+                               if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
                                        if ( elem.addEventListener ) {
-                                               elem.addEventListener( type, eventHandle );
+                                               elem.addEventListener( type, eventHandle, false );
                                        }
                                }
                        }
@@ -5088,19 +4170,19 @@ jQuery.event = {
                var j, origCount, tmp,
                        events, t, handleObj,
                        special, handlers, type, namespaces, origType,
-                       elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
+                       elemData = data_priv.hasData( elem ) && data_priv.get( elem );
 
-               if ( !elemData || !( events = elemData.events ) ) {
+               if ( !elemData || !(events = elemData.events) ) {
                        return;
                }
 
                // Once for each type.namespace in types; type may be omitted
-               types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
+               types = ( types || "" ).match( rnotwhite ) || [ "" ];
                t = types.length;
                while ( t-- ) {
-                       tmp = rtypenamespace.exec( types[ t ] ) || [];
-                       type = origType = tmp[ 1 ];
-                       namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
+                       tmp = rtypenamespace.exec( types[t] ) || [];
+                       type = origType = tmp[1];
+                       namespaces = ( tmp[2] || "" ).split( "." ).sort();
 
                        // Unbind all events (on this namespace, if provided) for the element
                        if ( !type ) {
@@ -5113,8 +4195,7 @@ jQuery.event = {
                        special = jQuery.event.special[ type ] || {};
                        type = ( selector ? special.delegateType : special.bindType ) || type;
                        handlers = events[ type ] || [];
-                       tmp = tmp[ 2 ] &&
-                               new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
+                       tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
 
                        // Remove matching events
                        origCount = j = handlers.length;
@@ -5124,8 +4205,7 @@ jQuery.event = {
                                if ( ( mappedTypes || origType === handleObj.origType ) &&
                                        ( !handler || handler.guid === handleObj.guid ) &&
                                        ( !tmp || tmp.test( handleObj.namespace ) ) &&
-                                       ( !selector || selector === handleObj.selector ||
-                                               selector === "**" && handleObj.selector ) ) {
+                                       ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
                                        handlers.splice( j, 1 );
 
                                        if ( handleObj.selector ) {
@@ -5140,9 +4220,7 @@ jQuery.event = {
                        // Remove generic event handler if we removed something and no more handlers exist
                        // (avoids potential for endless recursion during removal of special event handlers)
                        if ( origCount && !handlers.length ) {
-                               if ( !special.teardown ||
-                                       special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
-
+                               if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
                                        jQuery.removeEvent( elem, type, elemData.handle );
                                }
 
@@ -5150,29 +4228,158 @@ jQuery.event = {
                        }
                }
 
-               // Remove data and the expando if it's no longer used
+               // Remove the expando if it's no longer used
                if ( jQuery.isEmptyObject( events ) ) {
-                       dataPriv.remove( elem, "handle events" );
+                       delete elemData.handle;
+                       data_priv.remove( elem, "events" );
                }
        },
 
-       dispatch: function( nativeEvent ) {
+       trigger: function( event, data, elem, onlyHandlers ) {
 
-               // Make a writable jQuery.Event from the native event object
-               var event = jQuery.event.fix( nativeEvent );
+               var i, cur, tmp, bubbleType, ontype, handle, special,
+                       eventPath = [ elem || document ],
+                       type = hasOwn.call( event, "type" ) ? event.type : event,
+                       namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
 
-               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 ] || {};
+               cur = tmp = elem = elem || document;
 
-               // Use the fix-ed jQuery.Event rather than the (read-only) native event
-               args[ 0 ] = event;
+               // Don't do events on text and comment nodes
+               if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+                       return;
+               }
+
+               // focus/blur morphs to focusin/out; ensure we're not firing them right now
+               if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+                       return;
+               }
+
+               if ( type.indexOf(".") >= 0 ) {
+                       // Namespaced trigger; create a regexp to match event type in handle()
+                       namespaces = type.split(".");
+                       type = namespaces.shift();
+                       namespaces.sort();
+               }
+               ontype = type.indexOf(":") < 0 && "on" + type;
+
+               // Caller can pass in a jQuery.Event object, Object, or just an event type string
+               event = event[ jQuery.expando ] ?
+                       event :
+                       new jQuery.Event( type, typeof event === "object" && event );
+
+               // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
+               event.isTrigger = onlyHandlers ? 2 : 3;
+               event.namespace = namespaces.join(".");
+               event.namespace_re = event.namespace ?
+                       new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+                       null;
+
+               // Clean up the event in case it is being reused
+               event.result = undefined;
+               if ( !event.target ) {
+                       event.target = elem;
+               }
+
+               // Clone any incoming data and prepend the event, creating the handler arg list
+               data = data == null ?
+                       [ event ] :
+                       jQuery.makeArray( data, [ event ] );
+
+               // Allow special events to draw outside the lines
+               special = jQuery.event.special[ type ] || {};
+               if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
+                       return;
+               }
+
+               // Determine event propagation path in advance, per W3C events spec (#9951)
+               // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+               if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+                       bubbleType = special.delegateType || type;
+                       if ( !rfocusMorph.test( bubbleType + type ) ) {
+                               cur = cur.parentNode;
+                       }
+                       for ( ; cur; cur = cur.parentNode ) {
+                               eventPath.push( cur );
+                               tmp = cur;
+                       }
+
+                       // Only add window if we got to document (e.g., not plain obj or detached DOM)
+                       if ( tmp === (elem.ownerDocument || document) ) {
+                               eventPath.push( tmp.defaultView || tmp.parentWindow || window );
+                       }
+               }
+
+               // Fire handlers on the event path
+               i = 0;
+               while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+
+                       event.type = i > 1 ?
+                               bubbleType :
+                               special.bindType || type;
+
+                       // jQuery handler
+                       handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
+                       if ( handle ) {
+                               handle.apply( cur, data );
+                       }
+
+                       // Native handler
+                       handle = ontype && cur[ ontype ];
+                       if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
+                               event.result = handle.apply( cur, data );
+                               if ( event.result === false ) {
+                                       event.preventDefault();
+                               }
+                       }
+               }
+               event.type = type;
+
+               // If nobody prevented the default action, do it now
+               if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+                       if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
+                               jQuery.acceptData( elem ) ) {
+
+                               // Call a native DOM method on the target with the same name name as the event.
+                               // Don't do default actions on window, that's where global variables be (#6170)
+                               if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
+
+                                       // Don't re-trigger an onFOO event when we call its FOO() method
+                                       tmp = elem[ ontype ];
+
+                                       if ( tmp ) {
+                                               elem[ ontype ] = null;
+                                       }
+
+                                       // Prevent re-triggering of the same event, since we already bubbled it above
+                                       jQuery.event.triggered = type;
+                                       elem[ type ]();
+                                       jQuery.event.triggered = undefined;
 
-               for ( i = 1; i < arguments.length; i++ ) {
-                       args[ i ] = arguments[ i ];
+                                       if ( tmp ) {
+                                               elem[ ontype ] = tmp;
+                                       }
+                               }
+                       }
                }
 
+               return event.result;
+       },
+
+       dispatch: function( event ) {
+
+               // Make a writable jQuery.Event from the native event object
+               event = jQuery.event.fix( event );
+
+               var i, j, ret, matched, handleObj,
+                       handlerQueue = [],
+                       args = slice.call( arguments ),
+                       handlers = ( data_priv.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;
                event.delegateTarget = this;
 
                // Call the preDispatch hook for the mapped type, and let it bail if desired
@@ -5185,25 +4392,24 @@ jQuery.event = {
 
                // Run delegates first; they may want to stop propagation beneath us
                i = 0;
-               while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
+               while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
                        event.currentTarget = matched.elem;
 
                        j = 0;
-                       while ( ( handleObj = matched.handlers[ j++ ] ) &&
-                               !event.isImmediatePropagationStopped() ) {
+                       while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
 
-                               // Triggered event must either 1) have no namespace, or 2) have namespace(s)
-                               // a subset or equal to those in the bound event (both can have no namespace).
-                               if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
+                               // Triggered event must either 1) have no namespace, or
+                               // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+                               if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
 
                                        event.handleObj = handleObj;
                                        event.data = handleObj.data;
 
-                                       ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
-                                               handleObj.handler ).apply( matched.elem, args );
+                                       ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+                                                       .apply( matched.elem, args );
 
                                        if ( ret !== undefined ) {
-                                               if ( ( event.result = ret ) === false ) {
+                                               if ( (event.result = ret) === false ) {
                                                        event.preventDefault();
                                                        event.stopPropagation();
                                                }
@@ -5221,105 +4427,143 @@ jQuery.event = {
        },
 
        handlers: function( event, handlers ) {
-               var i, handleObj, sel, matchedHandlers, matchedSelectors,
+               var i, matches, sel, handleObj,
                        handlerQueue = [],
                        delegateCount = handlers.delegateCount,
                        cur = event.target;
 
                // Find delegate handlers
-               if ( delegateCount &&
-
-                       // Support: IE <=9
-                       // Black-hole SVG <use> 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 ) ) {
+               // Black-hole SVG <use> instance trees (#13180)
+               // Avoid non-left-click bubbling in Firefox (#3861)
+               if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
 
                        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 && !( event.type === "click" && cur.disabled === true ) ) {
-                                       matchedHandlers = [];
-                                       matchedSelectors = {};
+                               if ( cur.disabled !== true || event.type !== "click" ) {
+                                       matches = [];
                                        for ( i = 0; i < delegateCount; i++ ) {
                                                handleObj = handlers[ i ];
 
                                                // Don't conflict with Object.prototype properties (#13203)
                                                sel = handleObj.selector + " ";
 
-                                               if ( matchedSelectors[ sel ] === undefined ) {
-                                                       matchedSelectors[ sel ] = handleObj.needsContext ?
-                                                               jQuery( sel, this ).index( cur ) > -1 :
+                                               if ( matches[ sel ] === undefined ) {
+                                                       matches[ sel ] = handleObj.needsContext ?
+                                                               jQuery( sel, this ).index( cur ) >= 0 :
                                                                jQuery.find( sel, this, null, [ cur ] ).length;
                                                }
-                                               if ( matchedSelectors[ sel ] ) {
-                                                       matchedHandlers.push( handleObj );
+                                               if ( matches[ sel ] ) {
+                                                       matches.push( handleObj );
                                                }
                                        }
-                                       if ( matchedHandlers.length ) {
-                                               handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
+                                       if ( matches.length ) {
+                                               handlerQueue.push({ elem: cur, handlers: matches });
                                        }
                                }
                        }
                }
 
                // Add the remaining (directly-bound) handlers
-               cur = this;
                if ( delegateCount < handlers.length ) {
-                       handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
+                       handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
                }
 
                return handlerQueue;
        },
 
-       addProp: function( name, hook ) {
-               Object.defineProperty( jQuery.Event.prototype, name, {
-                       enumerable: true,
-                       configurable: true,
+       // Includes some event props shared by KeyEvent and MouseEvent
+       props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
 
-                       get: jQuery.isFunction( hook ) ?
-                               function() {
-                                       if ( this.originalEvent ) {
-                                                       return hook( this.originalEvent );
-                                       }
-                               } :
-                               function() {
-                                       if ( this.originalEvent ) {
-                                                       return this.originalEvent[ name ];
-                                       }
-                               },
+       fixHooks: {},
+
+       keyHooks: {
+               props: "char charCode key keyCode".split(" "),
+               filter: function( event, original ) {
+
+                       // Add which for key events
+                       if ( event.which == null ) {
+                               event.which = original.charCode != null ? original.charCode : original.keyCode;
+                       }
+
+                       return event;
+               }
+       },
+
+       mouseHooks: {
+               props: "button buttons clientX clientY 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 );
+                       }
 
-                       set: function( value ) {
-                               Object.defineProperty( this, name, {
-                                       enumerable: true,
-                                       configurable: true,
-                                       writable: true,
-                                       value: value
-                               } );
+                       // 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( originalEvent ) {
-               return originalEvent[ jQuery.expando ] ?
-                       originalEvent :
-                       new jQuery.Event( originalEvent );
+       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;
        },
 
        special: {
                load: {
-
                        // Prevent triggered image.load events from bubbling to window.load
                        noBubble: true
                },
                focus: {
-
                        // Fire native event if possible so blur/focus sequence is correct
                        trigger: function() {
                                if ( this !== safeActiveElement() && this.focus ) {
@@ -5339,10 +4583,9 @@ jQuery.event = {
                        delegateType: "focusout"
                },
                click: {
-
                        // For checkbox, fire native event so checked state will be right
                        trigger: function() {
-                               if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
+                               if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
                                        this.click();
                                        return false;
                                }
@@ -5350,7 +4593,7 @@ jQuery.event = {
 
                        // For cross-browser consistency, don't fire native .click() on links
                        _default: function( event ) {
-                               return nodeName( event.target, "a" );
+                               return jQuery.nodeName( event.target, "a" );
                        }
                },
 
@@ -5364,21 +4607,41 @@ jQuery.event = {
                                }
                        }
                }
+       },
+
+       simulate: function( type, elem, event, bubble ) {
+               // Piggyback on a donor event to simulate a different one.
+               // Fake originalEvent to avoid donor's stopPropagation, but if the
+               // simulated event prevents default then we do the same on the donor.
+               var e = jQuery.extend(
+                       new jQuery.Event(),
+                       event,
+                       {
+                               type: type,
+                               isSimulated: true,
+                               originalEvent: {}
+                       }
+               );
+               if ( bubble ) {
+                       jQuery.event.trigger( e, null, elem );
+               } else {
+                       jQuery.event.dispatch.call( elem, e );
+               }
+               if ( e.isDefaultPrevented() ) {
+                       event.preventDefault();
+               }
        }
 };
 
 jQuery.removeEvent = function( elem, type, handle ) {
-
-       // This "if" is needed for plain objects
        if ( elem.removeEventListener ) {
-               elem.removeEventListener( type, handle );
+               elem.removeEventListener( type, handle, false );
        }
 };
 
 jQuery.Event = function( src, props ) {
-
        // Allow instantiation without the 'new' keyword
-       if ( !( this instanceof jQuery.Event ) ) {
+       if ( !(this instanceof jQuery.Event) ) {
                return new jQuery.Event( src, props );
        }
 
@@ -5391,22 +4654,11 @@ jQuery.Event = function( src, props ) {
                // by a handler lower down the tree; reflect the correct value.
                this.isDefaultPrevented = src.defaultPrevented ||
                                src.defaultPrevented === undefined &&
-
-                               // Support: Android <=2.3 only
+                               // Support: Android < 4.0
                                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;
@@ -5425,20 +4677,18 @@ jQuery.Event = function( src, props ) {
 };
 
 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
 jQuery.Event.prototype = {
-       constructor: jQuery.Event,
        isDefaultPrevented: returnFalse,
        isPropagationStopped: returnFalse,
        isImmediatePropagationStopped: returnFalse,
-       isSimulated: false,
 
        preventDefault: function() {
                var e = this.originalEvent;
 
                this.isDefaultPrevented = returnTrue;
 
-               if ( e && !this.isSimulated ) {
+               if ( e && e.preventDefault ) {
                        e.preventDefault();
                }
        },
@@ -5447,7 +4697,7 @@ jQuery.Event.prototype = {
 
                this.isPropagationStopped = returnTrue;
 
-               if ( e && !this.isSimulated ) {
+               if ( e && e.stopPropagation ) {
                        e.stopPropagation();
                }
        },
@@ -5456,7 +4706,7 @@ jQuery.Event.prototype = {
 
                this.isImmediatePropagationStopped = returnTrue;
 
-               if ( e && !this.isSimulated ) {
+               if ( e && e.stopImmediatePropagation ) {
                        e.stopImmediatePropagation();
                }
 
@@ -5464,76 +4714,9 @@ 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://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( {
+// Support: Chrome 15+
+jQuery.each({
        mouseenter: "mouseover",
        mouseleave: "mouseout",
        pointerenter: "pointerover",
@@ -5549,9 +4732,9 @@ jQuery.each( {
                                related = event.relatedTarget,
                                handleObj = event.handleObj;
 
-                       // For mouseenter/leave call the handler if related is outside the target.
+                       // For mousenter/leave call the handler if related is outside the target.
                        // NB: No relatedTarget if the mouse left/entered the browser window
-                       if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
+                       if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
                                event.type = handleObj.origType;
                                ret = handleObj.handler.apply( this, arguments );
                                event.type = fix;
@@ -5559,33 +4742,115 @@ jQuery.each( {
                        return ret;
                }
        };
-} );
+});
+
+// Create "bubbling" focus and blur events
+// Support: Firefox, Chrome, Safari
+if ( !support.focusinBubbles ) {
+       jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+               // Attach a single capturing handler on the document while someone wants focusin/focusout
+               var handler = function( event ) {
+                               jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+                       };
+
+               jQuery.event.special[ fix ] = {
+                       setup: function() {
+                               var doc = this.ownerDocument || this,
+                                       attaches = data_priv.access( doc, fix );
+
+                               if ( !attaches ) {
+                                       doc.addEventListener( orig, handler, true );
+                               }
+                               data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
+                       },
+                       teardown: function() {
+                               var doc = this.ownerDocument || this,
+                                       attaches = data_priv.access( doc, fix ) - 1;
+
+                               if ( !attaches ) {
+                                       doc.removeEventListener( orig, handler, true );
+                                       data_priv.remove( doc, fix );
+
+                               } else {
+                                       data_priv.access( doc, fix, attaches );
+                               }
+                       }
+               };
+       });
+}
+
+jQuery.fn.extend({
 
-jQuery.fn.extend( {
+       on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+               var origFn, type;
 
-       on: function( types, selector, data, fn ) {
-               return on( this, types, selector, data, fn );
+               // Types can be a map of types/handlers
+               if ( typeof types === "object" ) {
+                       // ( types-Object, selector, data )
+                       if ( typeof selector !== "string" ) {
+                               // ( types-Object, data )
+                               data = data || selector;
+                               selector = undefined;
+                       }
+                       for ( type in types ) {
+                               this.on( type, selector, data, types[ type ], one );
+                       }
+                       return this;
+               }
+
+               if ( data == null && fn == null ) {
+                       // ( types, fn )
+                       fn = selector;
+                       data = selector = undefined;
+               } else if ( fn == null ) {
+                       if ( typeof selector === "string" ) {
+                               // ( types, selector, fn )
+                               fn = data;
+                               data = undefined;
+                       } else {
+                               // ( types, data, fn )
+                               fn = data;
+                               data = selector;
+                               selector = undefined;
+                       }
+               }
+               if ( fn === false ) {
+                       fn = returnFalse;
+               } else if ( !fn ) {
+                       return this;
+               }
+
+               if ( one === 1 ) {
+                       origFn = fn;
+                       fn = function( event ) {
+                               // Can use an empty set, since event contains the info
+                               jQuery().off( event );
+                               return origFn.apply( this, arguments );
+                       };
+                       // Use same guid so caller can remove using origFn
+                       fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+               }
+               return this.each( function() {
+                       jQuery.event.add( this, types, fn, data, selector );
+               });
        },
        one: function( types, selector, data, fn ) {
-               return on( this, types, selector, data, fn, 1 );
+               return this.on( types, selector, data, fn, 1 );
        },
        off: function( types, selector, fn ) {
                var handleObj, type;
                if ( types && types.preventDefault && types.handleObj ) {
-
                        // ( event )  dispatched jQuery.Event
                        handleObj = types.handleObj;
                        jQuery( types.delegateTarget ).off(
-                               handleObj.namespace ?
-                                       handleObj.origType + "." + handleObj.namespace :
-                                       handleObj.origType,
+                               handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
                                handleObj.selector,
                                handleObj.handler
                        );
                        return this;
                }
                if ( typeof types === "object" ) {
-
                        // ( types-object [, selector] )
                        for ( type in types ) {
                                this.off( type, selector, types[ type ] );
@@ -5593,7 +4858,6 @@ jQuery.fn.extend( {
                        return this;
                }
                if ( selector === false || typeof selector === "function" ) {
-
                        // ( types [, fn] )
                        fn = selector;
                        selector = undefined;
@@ -5601,46 +4865,70 @@ jQuery.fn.extend( {
                if ( fn === false ) {
                        fn = returnFalse;
                }
-               return this.each( function() {
+               return this.each(function() {
                        jQuery.event.remove( this, types, fn, selector );
-               } );
+               });
+       },
+
+       trigger: function( type, data ) {
+               return this.each(function() {
+                       jQuery.event.trigger( type, data, this );
+               });
+       },
+       triggerHandler: function( type, data ) {
+               var elem = this[0];
+               if ( elem ) {
+                       return jQuery.event.trigger( type, data, elem, true );
+               }
        }
-} );
+});
 
 
 var
+       rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+       rtagName = /<([\w:]+)/,
+       rhtml = /<|&#?\w+;/,
+       rnoInnerhtml = /<(?:script|style|link)/i,
+       // checked="checked" or checked
+       rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+       rscriptType = /^$|\/(?:java|ecma)script/i,
+       rscriptTypeMasked = /^true\/(.*)/,
+       rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
 
-       /* eslint-disable max-len */
+       // We have to close these tags to support XHTML (#13200)
+       wrapMap = {
 
-       // 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,
+               // Support: IE 9
+               option: [ 1, "<select multiple='multiple'>", "</select>" ],
 
-       /* eslint-enable */
+               thead: [ 1, "<table>", "</table>" ],
+               col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
+               tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+               td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
 
-       // 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 = /<script|<style|<link/i,
+               _default: [ 0, "", "" ]
+       };
 
-       // checked="checked" or checked
-       rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
-       rscriptTypeMasked = /^true\/(.*)/,
-       rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
+// Support: IE 9
+wrapMap.optgroup = wrapMap.option;
 
-// Prefer a tbody over its parent table for containing new rows
-function manipulationTarget( elem, content ) {
-       if ( nodeName( elem, "table" ) &&
-               nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
 
-               return jQuery( ">tbody", elem )[ 0 ] || elem;
-       }
+// Support: 1.x compatibility
+// Manipulating tables requires a tbody
+function manipulationTarget( elem, content ) {
+       return jQuery.nodeName( elem, "table" ) &&
+               jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
 
-       return elem;
+               elem.getElementsByTagName("tbody")[0] ||
+                       elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
+               elem;
 }
 
 // Replace/restore the type attribute of script elements for safe DOM manipulation
 function disableScript( elem ) {
-       elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
+       elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
        return elem;
 }
 function restoreScript( elem ) {
@@ -5649,12 +4937,24 @@ function restoreScript( elem ) {
        if ( match ) {
                elem.type = match[ 1 ];
        } else {
-               elem.removeAttribute( "type" );
+               elem.removeAttribute("type");
        }
 
        return elem;
 }
 
+// Mark scripts as having already been evaluated
+function setGlobalEval( elems, refElements ) {
+       var i = 0,
+               l = elems.length;
+
+       for ( ; i < l; i++ ) {
+               data_priv.set(
+                       elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
+               );
+       }
+}
+
 function cloneCopyEvent( src, dest ) {
        var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
 
@@ -5663,9 +4963,9 @@ function cloneCopyEvent( src, dest ) {
        }
 
        // 1. Copy private data: events, handlers, etc.
-       if ( dataPriv.hasData( src ) ) {
-               pdataOld = dataPriv.access( src );
-               pdataCur = dataPriv.set( dest, pdataOld );
+       if ( data_priv.hasData( src ) ) {
+               pdataOld = data_priv.access( src );
+               pdataCur = data_priv.set( dest, pdataOld );
                events = pdataOld.events;
 
                if ( events ) {
@@ -5681,15 +4981,25 @@ function cloneCopyEvent( src, dest ) {
        }
 
        // 2. Copy user data
-       if ( dataUser.hasData( src ) ) {
-               udataOld = dataUser.access( src );
+       if ( data_user.hasData( src ) ) {
+               udataOld = data_user.access( src );
                udataCur = jQuery.extend( {}, udataOld );
 
-               dataUser.set( dest, udataCur );
+               data_user.set( dest, udataCur );
        }
 }
 
-// Fix IE bugs, see support tests
+function getAll( context, tag ) {
+       var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
+                       context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
+                       [];
+
+       return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
+               jQuery.merge( [ context ], ret ) :
+               ret;
+}
+
+// Support: IE >= 9
 function fixInput( src, dest ) {
        var nodeName = dest.nodeName.toLowerCase();
 
@@ -5703,132 +5013,18 @@ function fixInput( src, dest ) {
        }
 }
 
-function domManip( collection, args, callback, ignored ) {
-
-       // Flatten any nested arrays
-       args = concat.apply( [], args );
-
-       var fragment, first, scripts, hasScripts, node, doc,
-               i = 0,
-               l = collection.length,
-               iNoClone = l - 1,
-               value = args[ 0 ],
-               isFunction = jQuery.isFunction( value );
-
-       // We can't cloneNode fragments that contain checked, in WebKit
-       if ( isFunction ||
-                       ( l > 1 && typeof value === "string" &&
-                               !support.checkClone && rchecked.test( value ) ) ) {
-               return collection.each( function( index ) {
-                       var self = collection.eq( index );
-                       if ( isFunction ) {
-                               args[ 0 ] = value.call( this, index, self.html() );
-                       }
-                       domManip( self, args, callback, ignored );
-               } );
-       }
-
-       if ( l ) {
-               fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
-               first = fragment.firstChild;
-
-               if ( fragment.childNodes.length === 1 ) {
-                       fragment = first;
-               }
-
-               // Require either new content or an interest in ignored elements to invoke the callback
-               if ( first || ignored ) {
-                       scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
-                       hasScripts = scripts.length;
-
-                       // Use the original fragment for the last item
-                       // instead of the first because it can end up
-                       // being emptied incorrectly in certain situations (#8070).
-                       for ( ; i < l; i++ ) {
-                               node = fragment;
-
-                               if ( i !== iNoClone ) {
-                                       node = jQuery.clone( node, true, true );
-
-                                       // Keep references to cloned scripts for later restoration
-                                       if ( hasScripts ) {
-
-                                               // Support: Android <=4.0 only, PhantomJS 1 only
-                                               // push.apply(_, arraylike) throws on ancient WebKit
-                                               jQuery.merge( scripts, getAll( node, "script" ) );
-                                       }
-                               }
-
-                               callback.call( collection[ i ], node, i );
-                       }
-
-                       if ( hasScripts ) {
-                               doc = scripts[ scripts.length - 1 ].ownerDocument;
-
-                               // Reenable scripts
-                               jQuery.map( scripts, restoreScript );
-
-                               // Evaluate executable scripts on first document insertion
-                               for ( i = 0; i < hasScripts; i++ ) {
-                                       node = scripts[ i ];
-                                       if ( rscriptType.test( node.type || "" ) &&
-                                               !dataPriv.access( node, "globalEval" ) &&
-                                               jQuery.contains( doc, node ) ) {
-
-                                               if ( node.src ) {
-
-                                                       // Optional AJAX dependency, but won't run scripts if not present
-                                                       if ( jQuery._evalUrl ) {
-                                                               jQuery._evalUrl( node.src );
-                                                       }
-                                               } else {
-                                                       DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-
-       return collection;
-}
-
-function remove( elem, selector, keepData ) {
-       var node,
-               nodes = selector ? jQuery.filter( selector, elem ) : elem,
-               i = 0;
-
-       for ( ; ( node = nodes[ i ] ) != null; i++ ) {
-               if ( !keepData && node.nodeType === 1 ) {
-                       jQuery.cleanData( getAll( node ) );
-               }
-
-               if ( node.parentNode ) {
-                       if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
-                               setGlobalEval( getAll( node, "script" ) );
-                       }
-                       node.parentNode.removeChild( node );
-               }
-       }
-
-       return elem;
-}
-
-jQuery.extend( {
-       htmlPrefilter: function( html ) {
-               return html.replace( rxhtmlTag, "<$1></$2>" );
-       },
-
+jQuery.extend({
        clone: function( elem, dataAndEvents, deepDataAndEvents ) {
                var i, l, srcElements, destElements,
                        clone = elem.cloneNode( true ),
                        inPage = jQuery.contains( elem.ownerDocument, elem );
 
-               // Fix IE cloning issues
+               // Support: IE >= 9
+               // Fix Cloning issues
                if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
                                !jQuery.isXMLDoc( elem ) ) {
 
-                       // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
+                       // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
                        destElements = getAll( clone );
                        srcElements = getAll( elem );
 
@@ -5861,14 +5057,103 @@ jQuery.extend( {
                return clone;
        },
 
+       buildFragment: function( elems, context, scripts, selection ) {
+               var elem, tmp, tag, wrap, contains, j,
+                       fragment = context.createDocumentFragment(),
+                       nodes = [],
+                       i = 0,
+                       l = elems.length;
+
+               for ( ; i < l; i++ ) {
+                       elem = elems[ i ];
+
+                       if ( elem || elem === 0 ) {
+
+                               // Add nodes directly
+                               if ( jQuery.type( elem ) === "object" ) {
+                                       // Support: QtWebKit
+                                       // jQuery.merge because push.apply(_, arraylike) throws
+                                       jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
+
+                               // Convert non-html into a text node
+                               } else if ( !rhtml.test( elem ) ) {
+                                       nodes.push( context.createTextNode( elem ) );
+
+                               // Convert html into DOM nodes
+                               } else {
+                                       tmp = tmp || fragment.appendChild( context.createElement("div") );
+
+                                       // Deserialize a standard representation
+                                       tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
+                                       wrap = wrapMap[ tag ] || wrapMap._default;
+                                       tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
+
+                                       // Descend through wrappers to the right content
+                                       j = wrap[ 0 ];
+                                       while ( j-- ) {
+                                               tmp = tmp.lastChild;
+                                       }
+
+                                       // Support: QtWebKit
+                                       // jQuery.merge because push.apply(_, arraylike) throws
+                                       jQuery.merge( nodes, tmp.childNodes );
+
+                                       // Remember the top-level container
+                                       tmp = fragment.firstChild;
+
+                                       // Fixes #12346
+                                       // Support: Webkit, IE
+                                       tmp.textContent = "";
+                               }
+                       }
+               }
+
+               // Remove wrapper from fragment
+               fragment.textContent = "";
+
+               i = 0;
+               while ( (elem = nodes[ i++ ]) ) {
+
+                       // #4087 - If origin and destination elements are the same, and this is
+                       // that element, do not do anything
+                       if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
+                               continue;
+                       }
+
+                       contains = jQuery.contains( elem.ownerDocument, elem );
+
+                       // Append to fragment
+                       tmp = getAll( fragment.appendChild( elem ), "script" );
+
+                       // Preserve script evaluation history
+                       if ( contains ) {
+                               setGlobalEval( tmp );
+                       }
+
+                       // Capture executables
+                       if ( scripts ) {
+                               j = 0;
+                               while ( (elem = tmp[ j++ ]) ) {
+                                       if ( rscriptType.test( elem.type || "" ) ) {
+                                               scripts.push( elem );
+                                       }
+                               }
+                       }
+               }
+
+               return fragment;
+       },
+
        cleanData: function( elems ) {
-               var data, elem, type,
+               var data, elem, type, key,
                        special = jQuery.event.special,
                        i = 0;
 
-               for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
-                       if ( acceptData( elem ) ) {
-                               if ( ( data = elem[ dataPriv.expando ] ) ) {
+               for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
+                       if ( jQuery.acceptData( elem ) ) {
+                               key = elem[ data_priv.expando ];
+
+                               if ( key && (data = data_priv.cache[ key ]) ) {
                                        if ( data.events ) {
                                                for ( type in data.events ) {
                                                        if ( special[ type ] ) {
@@ -5880,82 +5165,91 @@ jQuery.extend( {
                                                        }
                                                }
                                        }
-
-                                       // 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+
-                                       // Assign undefined instead of using delete, see Data#remove
-                                       elem[ dataUser.expando ] = undefined;
+                                       if ( data_priv.cache[ key ] ) {
+                                               // Discard any remaining `private` data
+                                               delete data_priv.cache[ key ];
+                                       }
                                }
                        }
+                       // Discard any remaining `user` data
+                       delete data_user.cache[ elem[ data_user.expando ] ];
                }
        }
-} );
-
-jQuery.fn.extend( {
-       detach: function( selector ) {
-               return remove( this, selector, true );
-       },
-
-       remove: function( selector ) {
-               return remove( this, selector );
-       },
+});
 
+jQuery.fn.extend({
        text: function( value ) {
                return access( this, function( value ) {
                        return value === undefined ?
                                jQuery.text( this ) :
-                               this.empty().each( function() {
+                               this.empty().each(function() {
                                        if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
                                                this.textContent = value;
                                        }
-                               } );
+                               });
                }, null, value, arguments.length );
        },
 
        append: function() {
-               return domManip( this, arguments, function( elem ) {
+               return this.domManip( arguments, function( elem ) {
                        if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
                                var target = manipulationTarget( this, elem );
                                target.appendChild( elem );
                        }
-               } );
+               });
        },
 
        prepend: function() {
-               return domManip( this, arguments, function( elem ) {
+               return this.domManip( arguments, function( elem ) {
                        if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
                                var target = manipulationTarget( this, elem );
                                target.insertBefore( elem, target.firstChild );
                        }
-               } );
+               });
        },
 
        before: function() {
-               return domManip( this, arguments, function( elem ) {
+               return this.domManip( arguments, function( elem ) {
                        if ( this.parentNode ) {
                                this.parentNode.insertBefore( elem, this );
                        }
-               } );
+               });
        },
 
        after: function() {
-               return domManip( this, arguments, function( elem ) {
+               return this.domManip( arguments, function( elem ) {
                        if ( this.parentNode ) {
                                this.parentNode.insertBefore( elem, this.nextSibling );
                        }
-               } );
+               });
+       },
+
+       remove: function( selector, keepData /* Internal Use Only */ ) {
+               var elem,
+                       elems = selector ? jQuery.filter( selector, this ) : this,
+                       i = 0;
+
+               for ( ; (elem = elems[i]) != null; i++ ) {
+                       if ( !keepData && elem.nodeType === 1 ) {
+                               jQuery.cleanData( getAll( elem ) );
+                       }
+
+                       if ( elem.parentNode ) {
+                               if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
+                                       setGlobalEval( getAll( elem, "script" ) );
+                               }
+                               elem.parentNode.removeChild( elem );
+                       }
+               }
+
+               return this;
        },
 
        empty: function() {
                var elem,
                        i = 0;
 
-               for ( ; ( elem = this[ i ] ) != null; i++ ) {
+               for ( ; (elem = this[i]) != null; i++ ) {
                        if ( elem.nodeType === 1 ) {
 
                                // Prevent memory leaks
@@ -5973,9 +5267,9 @@ jQuery.fn.extend( {
                dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
                deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
 
-               return this.map( function() {
+               return this.map(function() {
                        return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
-               } );
+               });
        },
 
        html: function( value ) {
@@ -5992,7 +5286,7 @@ jQuery.fn.extend( {
                        if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
                                !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
 
-                               value = jQuery.htmlPrefilter( value );
+                               value = value.replace( rxhtmlTag, "<$1></$2>" );
 
                                try {
                                        for ( ; i < l; i++ ) {
@@ -6008,7 +5302,7 @@ jQuery.fn.extend( {
                                        elem = 0;
 
                                // If using innerHTML throws an exception, use the fallback method
-                               } catch ( e ) {}
+                               } catch( e ) {}
                        }
 
                        if ( elem ) {
@@ -6018,25 +5312,115 @@ jQuery.fn.extend( {
        },
 
        replaceWith: function() {
-               var ignored = [];
+               var arg = arguments[ 0 ];
+
+               // Make the changes, replacing each context element with the new content
+               this.domManip( arguments, function( elem ) {
+                       arg = this.parentNode;
+
+                       jQuery.cleanData( getAll( this ) );
+
+                       if ( arg ) {
+                               arg.replaceChild( elem, this );
+                       }
+               });
+
+               // Force removal if there was no new content (e.g., from empty arguments)
+               return arg && (arg.length || arg.nodeType) ? this : this.remove();
+       },
+
+       detach: function( selector ) {
+               return this.remove( selector, true );
+       },
+
+       domManip: function( args, callback ) {
+
+               // Flatten any nested arrays
+               args = concat.apply( [], args );
+
+               var fragment, first, scripts, hasScripts, node, doc,
+                       i = 0,
+                       l = this.length,
+                       set = this,
+                       iNoClone = l - 1,
+                       value = args[ 0 ],
+                       isFunction = jQuery.isFunction( value );
+
+               // We can't cloneNode fragments that contain checked, in WebKit
+               if ( isFunction ||
+                               ( l > 1 && typeof value === "string" &&
+                                       !support.checkClone && rchecked.test( value ) ) ) {
+                       return this.each(function( index ) {
+                               var self = set.eq( index );
+                               if ( isFunction ) {
+                                       args[ 0 ] = value.call( this, index, self.html() );
+                               }
+                               self.domManip( args, callback );
+                       });
+               }
 
-               // Make the changes, replacing each non-ignored context element with the new content
-               return domManip( this, arguments, function( elem ) {
-                       var parent = this.parentNode;
+               if ( l ) {
+                       fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
+                       first = fragment.firstChild;
 
-                       if ( jQuery.inArray( this, ignored ) < 0 ) {
-                               jQuery.cleanData( getAll( this ) );
-                               if ( parent ) {
-                                       parent.replaceChild( elem, this );
+                       if ( fragment.childNodes.length === 1 ) {
+                               fragment = first;
+                       }
+
+                       if ( first ) {
+                               scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
+                               hasScripts = scripts.length;
+
+                               // Use the original fragment for the last item instead of the first because it can end up
+                               // being emptied incorrectly in certain situations (#8070).
+                               for ( ; i < l; i++ ) {
+                                       node = fragment;
+
+                                       if ( i !== iNoClone ) {
+                                               node = jQuery.clone( node, true, true );
+
+                                               // Keep references to cloned scripts for later restoration
+                                               if ( hasScripts ) {
+                                                       // Support: QtWebKit
+                                                       // jQuery.merge because push.apply(_, arraylike) throws
+                                                       jQuery.merge( scripts, getAll( node, "script" ) );
+                                               }
+                                       }
+
+                                       callback.call( this[ i ], node, i );
+                               }
+
+                               if ( hasScripts ) {
+                                       doc = scripts[ scripts.length - 1 ].ownerDocument;
+
+                                       // Reenable scripts
+                                       jQuery.map( scripts, restoreScript );
+
+                                       // Evaluate executable scripts on first document insertion
+                                       for ( i = 0; i < hasScripts; i++ ) {
+                                               node = scripts[ i ];
+                                               if ( rscriptType.test( node.type || "" ) &&
+                                                       !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
+
+                                                       if ( node.src ) {
+                                                               // Optional AJAX dependency, but won't run scripts if not present
+                                                               if ( jQuery._evalUrl ) {
+                                                                       jQuery._evalUrl( node.src );
+                                                               }
+                                                       } else {
+                                                               jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
+                                                       }
+                                               }
+                                       }
                                }
                        }
+               }
 
-               // Force callback invocation
-               }, ignored );
+               return this;
        }
-} );
+});
 
-jQuery.each( {
+jQuery.each({
        appendTo: "append",
        prependTo: "prepend",
        insertBefore: "before",
@@ -6054,139 +5438,110 @@ jQuery.each( {
                        elems = i === last ? this : this.clone( true );
                        jQuery( insert[ i ] )[ original ]( elems );
 
-                       // Support: Android <=4.0 only, PhantomJS 1 only
-                       // .get() because push.apply(_, arraylike) throws on ancient WebKit
+                       // Support: QtWebKit
+                       // .get() because push.apply(_, arraylike) throws
                        push.apply( ret, elems.get() );
                }
 
                return this.pushStack( ret );
        };
-} );
-var rmargin = ( /^margin/ );
-
-var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
+});
 
-var getStyles = function( elem ) {
 
-               // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
-               // IE throws on elements created in popups
-               // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
-               var view = elem.ownerDocument.defaultView;
+var iframe,
+       elemdisplay = {};
 
-               if ( !view || !view.opener ) {
-                       view = window;
-               }
+/**
+ * Retrieve the actual display of a element
+ * @param {String} name nodeName of the element
+ * @param {Object} doc Document object
+ */
+// Called only from within defaultDisplay
+function actualDisplay( name, doc ) {
+       var style,
+               elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
 
-               return view.getComputedStyle( elem );
-       };
+               // getDefaultComputedStyle might be reliably used only on attached element
+               display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
 
+                       // Use of this method is a temporary fix (more like optmization) until something better comes along,
+                       // since it was removed from specification and supported only in FF
+                       style.display : jQuery.css( elem[ 0 ], "display" );
 
+       // We don't have any data stored on the element,
+       // so use "detach" method as fast way to get rid of the element
+       elem.detach();
 
-( function() {
+       return display;
+}
 
-       // Executing both pixelPosition & boxSizingReliable tests require only one layout
-       // so they're executed at the same time to save the second computation.
-       function computeStyleTests() {
+/**
+ * Try to determine the default display value of an element
+ * @param {String} nodeName
+ */
+function defaultDisplay( nodeName ) {
+       var doc = document,
+               display = elemdisplay[ nodeName ];
 
-               // This is a singleton, we need to execute it only once
-               if ( !div ) {
-                       return;
-               }
+       if ( !display ) {
+               display = actualDisplay( nodeName, doc );
 
-               div.style.cssText =
-                       "box-sizing:border-box;" +
-                       "position:relative;display:block;" +
-                       "margin:auto;border:1px;padding:1px;" +
-                       "top:1%;width:50%";
-               div.innerHTML = "";
-               documentElement.appendChild( container );
+               // If the simple way fails, read from inside an iframe
+               if ( display === "none" || !display ) {
 
-               var divStyle = window.getComputedStyle( div );
-               pixelPositionVal = divStyle.top !== "1%";
+                       // Use the already-created iframe if possible
+                       iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
 
-               // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
-               reliableMarginLeftVal = divStyle.marginLeft === "2px";
-               boxSizingReliableVal = divStyle.width === "4px";
+                       // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
+                       doc = iframe[ 0 ].contentDocument;
 
-               // Support: Android 4.0 - 4.3 only
-               // Some styles come back with percentage values, even though they shouldn't
-               div.style.marginRight = "50%";
-               pixelMarginRightVal = divStyle.marginRight === "4px";
+                       // Support: IE
+                       doc.write();
+                       doc.close();
 
-               documentElement.removeChild( container );
+                       display = actualDisplay( nodeName, doc );
+                       iframe.detach();
+               }
 
-               // Nullify the div so it wouldn't be stored in the memory and
-               // it will also be a sign that checks already performed
-               div = null;
+               // Store the correct default display
+               elemdisplay[ nodeName ] = display;
        }
 
-       var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
-               container = document.createElement( "div" ),
-               div = document.createElement( "div" );
-
-       // Finish early in limited (non-browser) environments
-       if ( !div.style ) {
-               return;
-       }
+       return display;
+}
+var rmargin = (/^margin/);
 
-       // Support: IE <=9 - 11 only
-       // Style of cloned element affects source element cloned (#8908)
-       div.style.backgroundClip = "content-box";
-       div.cloneNode( true ).style.backgroundClip = "";
-       support.clearCloneStyle = div.style.backgroundClip === "content-box";
+var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
 
-       container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
-               "padding:0;margin-top:1px;position:absolute";
-       container.appendChild( div );
+var getStyles = function( elem ) {
+               return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
+       };
 
-       jQuery.extend( support, {
-               pixelPosition: function() {
-                       computeStyleTests();
-                       return pixelPositionVal;
-               },
-               boxSizingReliable: function() {
-                       computeStyleTests();
-                       return boxSizingReliableVal;
-               },
-               pixelMarginRight: function() {
-                       computeStyleTests();
-                       return pixelMarginRightVal;
-               },
-               reliableMarginLeft: function() {
-                       computeStyleTests();
-                       return reliableMarginLeftVal;
-               }
-       } );
-} )();
 
 
 function curCSS( elem, name, computed ) {
        var width, minWidth, maxWidth, ret,
-
-               // Support: Firefox 51+
-               // Retrieving style before computed somehow
-               // fixes an issue with getting wrong values
-               // on detached elements
                style = elem.style;
 
        computed = computed || getStyles( elem );
 
-       // getPropertyValue is needed for:
-       //   .css('filter') (IE 9 only, #12537)
-       //   .css('--customProperty) (#3144)
+       // Support: IE9
+       // getPropertyValue is only needed for .css('filter') in IE9, see #12537
        if ( computed ) {
                ret = computed.getPropertyValue( name ) || computed[ name ];
+       }
+
+       if ( computed ) {
 
                if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
                        ret = jQuery.style( elem, name );
                }
 
+               // Support: iOS < 6
                // A tribute to the "awesome hack by Dean Edwards"
-               // Android Browser returns percentage for some values,
-               // but width seems to be reliably pixels.
-               // This is against the CSSOM draft spec:
-               // https://drafts.csswg.org/cssom/#resolved-values
-               if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+               // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
+               // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+               if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
 
                        // Remember the original values
                        width = style.width;
@@ -6205,8 +5560,7 @@ function curCSS( elem, name, computed ) {
        }
 
        return ret !== undefined ?
-
-               // Support: IE <=9 - 11 only
+               // Support: IE
                // IE returns zIndex value as an integer.
                ret + "" :
                ret;
@@ -6214,120 +5568,207 @@ function curCSS( elem, name, computed ) {
 
 
 function addGetHookIf( conditionFn, hookFn ) {
-
        // Define the hook, we'll check on the first run if it's really needed.
        return {
                get: function() {
                        if ( conditionFn() ) {
-
-                               // Hook not needed (or it's not possible to use it due
-                               // to missing dependency), remove it.
+                               // Hook not needed (or it's not possible to use it due to missing dependency),
+                               // remove it.
+                               // Since there are no other hooks for marginRight, remove the whole object.
                                delete this.get;
                                return;
                        }
 
                        // Hook needed; redefine it so that the support test is not executed again.
-                       return ( this.get = hookFn ).apply( this, arguments );
+
+                       return (this.get = hookFn).apply( this, arguments );
                }
        };
 }
 
 
-var
+(function() {
+       var pixelPositionVal, boxSizingReliableVal,
+               docElem = document.documentElement,
+               container = document.createElement( "div" ),
+               div = document.createElement( "div" );
+
+       if ( !div.style ) {
+               return;
+       }
+
+       div.style.backgroundClip = "content-box";
+       div.cloneNode( true ).style.backgroundClip = "";
+       support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+       container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
+               "position:absolute";
+       container.appendChild( div );
+
+       // Executing both pixelPosition & boxSizingReliable tests require only one layout
+       // so they're executed at the same time to save the second computation.
+       function computePixelPositionAndBoxSizingReliable() {
+               div.style.cssText =
+                       // Support: Firefox<29, Android 2.3
+                       // Vendor-prefix box-sizing
+                       "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
+                       "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
+                       "border:1px;padding:1px;width:4px;position:absolute";
+               div.innerHTML = "";
+               docElem.appendChild( container );
 
-       // Swappable if display is none or starts with table
-       // except "table", "table-cell", or "table-caption"
-       // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+               var divStyle = window.getComputedStyle( div, null );
+               pixelPositionVal = divStyle.top !== "1%";
+               boxSizingReliableVal = divStyle.width === "4px";
+
+               docElem.removeChild( container );
+       }
+
+       // Support: node.js jsdom
+       // Don't assume that getComputedStyle is a property of the global object
+       if ( window.getComputedStyle ) {
+               jQuery.extend( support, {
+                       pixelPosition: function() {
+                               // This test is executed only once but we still do memoizing
+                               // since we can use the boxSizingReliable pre-computing.
+                               // No need to check if the test was already performed, though.
+                               computePixelPositionAndBoxSizingReliable();
+                               return pixelPositionVal;
+                       },
+                       boxSizingReliable: function() {
+                               if ( boxSizingReliableVal == null ) {
+                                       computePixelPositionAndBoxSizingReliable();
+                               }
+                               return boxSizingReliableVal;
+                       },
+                       reliableMarginRight: function() {
+                               // Support: Android 2.3
+                               // Check if div with explicit width and no margin-right incorrectly
+                               // gets computed margin-right based on width of container. (#3333)
+                               // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+                               // This support function is only executed once so no memoizing is needed.
+                               var ret,
+                                       marginDiv = div.appendChild( document.createElement( "div" ) );
+
+                               // Reset CSS: box-sizing; display; margin; border; padding
+                               marginDiv.style.cssText = div.style.cssText =
+                                       // Support: Firefox<29, Android 2.3
+                                       // Vendor-prefix box-sizing
+                                       "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
+                                       "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
+                               marginDiv.style.marginRight = marginDiv.style.width = "0";
+                               div.style.width = "1px";
+                               docElem.appendChild( container );
+
+                               ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
+
+                               docElem.removeChild( container );
+
+                               return ret;
+                       }
+               });
+       }
+})();
+
+
+// A method for quickly swapping in/out CSS properties to get correct calculations.
+jQuery.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;
+};
+
+
+var
+       // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+       // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
        rdisplayswap = /^(none|table(?!-c[ea]).+)/,
-       rcustomProp = /^--/,
+       rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
+       rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
+
        cssShow = { position: "absolute", visibility: "hidden", display: "block" },
        cssNormalTransform = {
                letterSpacing: "0",
                fontWeight: "400"
        },
 
-       cssPrefixes = [ "Webkit", "Moz", "ms" ],
-       emptyStyle = document.createElement( "div" ).style;
+       cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
 
-// Return a css property mapped to a potentially vendor prefixed property
-function vendorPropName( name ) {
+// return a css property mapped to a potentially vendor prefixed property
+function vendorPropName( style, name ) {
 
-       // Shortcut for names that are not vendor prefixed
-       if ( name in emptyStyle ) {
+       // shortcut for names that are not vendor prefixed
+       if ( name in style ) {
                return name;
        }
 
-       // Check for vendor prefixed names
-       var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
+       // check for vendor prefixed names
+       var capName = name[0].toUpperCase() + name.slice(1),
+               origName = name,
                i = cssPrefixes.length;
 
        while ( i-- ) {
                name = cssPrefixes[ i ] + capName;
-               if ( name in emptyStyle ) {
+               if ( name in style ) {
                        return name;
                }
        }
-}
 
-// Return a property mapped along what jQuery.cssProps suggests or to
-// a vendor prefixed property.
-function finalPropName( name ) {
-       var ret = jQuery.cssProps[ name ];
-       if ( !ret ) {
-               ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
-       }
-       return ret;
+       return origName;
 }
 
 function setPositiveNumber( elem, value, subtract ) {
-
-       // Any relative (+/-) values have already been
-       // normalized at this point
-       var matches = rcssNum.exec( value );
+       var matches = rnumsplit.exec( value );
        return matches ?
-
                // Guard against undefined "subtract", e.g., when used as in cssHooks
-               Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
+               Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
                value;
 }
 
 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
-       var i,
-               val = 0;
+       var i = extra === ( isBorderBox ? "border" : "content" ) ?
+               // If we already have the right measurement, avoid augmentation
+               4 :
+               // Otherwise initialize for horizontal or vertical properties
+               name === "width" ? 1 : 0,
 
-       // If we already have the right measurement, avoid augmentation
-       if ( extra === ( isBorderBox ? "border" : "content" ) ) {
-               i = 4;
-
-       // Otherwise initialize for horizontal or vertical properties
-       } else {
-               i = name === "width" ? 1 : 0;
-       }
+               val = 0;
 
        for ( ; i < 4; i += 2 ) {
-
-               // Both box models exclude margin, so add it if we want it
+               // both box models exclude margin, so add it if we want it
                if ( extra === "margin" ) {
                        val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
                }
 
                if ( isBorderBox ) {
-
                        // border-box includes padding, so remove it if we want content
                        if ( extra === "content" ) {
                                val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
                        }
 
-                       // At this point, extra isn't border nor margin, so remove border
+                       // at this point, extra isn't border nor margin, so remove border
                        if ( extra !== "margin" ) {
                                val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
                        }
                } else {
-
-                       // At this point, extra isn't content, so add padding
+                       // at this point, extra isn't content, so add padding
                        val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
 
-                       // At this point, extra isn't content nor padding, so add border
+                       // at this point, extra isn't content nor padding, so add border
                        if ( extra !== "padding" ) {
                                val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
                        }
@@ -6339,32 +5780,37 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
 
 function getWidthOrHeight( elem, name, extra ) {
 
-       // Start with computed style
-       var valueIsBorderBox,
+       // Start with offset property, which is equivalent to the border-box value
+       var valueIsBorderBox = true,
+               val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
                styles = getStyles( elem ),
-               val = curCSS( elem, name, styles ),
                isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
 
-       // Computed unit is not pixels. Stop here and return.
-       if ( rnumnonpx.test( val ) ) {
-               return val;
-       }
+       // some non-html elements return undefined for offsetWidth, so check for null/undefined
+       // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+       // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+       if ( val <= 0 || val == null ) {
+               // Fall back to computed then uncomputed css if necessary
+               val = curCSS( elem, name, styles );
+               if ( val < 0 || val == null ) {
+                       val = elem.style[ name ];
+               }
 
-       // Check for style in case a browser which returns unreliable values
-       // for getComputedStyle silently falls back to the reliable elem.style
-       valueIsBorderBox = isBorderBox &&
-               ( support.boxSizingReliable() || val === elem.style[ name ] );
+               // Computed unit is not pixels. Stop here and return.
+               if ( rnumnonpx.test(val) ) {
+                       return val;
+               }
 
-       // Fall back to offsetWidth/Height when value is "auto"
-       // This happens for inline elements with no explicit setting (gh-3571)
-       if ( val === "auto" ) {
-               val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
-       }
+               // we need the check for style in case a browser which returns unreliable values
+               // for getComputedStyle silently falls back to the reliable elem.style
+               valueIsBorderBox = isBorderBox &&
+                       ( support.boxSizingReliable() || val === elem.style[ name ] );
 
-       // Normalize "", auto, and prepare for extra
-       val = parseFloat( val ) || 0;
+               // Normalize "", auto, and prepare for extra
+               val = parseFloat( val ) || 0;
+       }
 
-       // Use the active box-sizing model to add/subtract irrelevant styles
+       // use the active box-sizing model to add/subtract irrelevant styles
        return ( val +
                augmentWidthOrHeight(
                        elem,
@@ -6376,15 +5822,64 @@ function getWidthOrHeight( elem, name, extra ) {
        ) + "px";
 }
 
-jQuery.extend( {
+function showHide( elements, show ) {
+       var display, elem, hidden,
+               values = [],
+               index = 0,
+               length = elements.length;
+
+       for ( ; index < length; index++ ) {
+               elem = elements[ index ];
+               if ( !elem.style ) {
+                       continue;
+               }
 
+               values[ index ] = data_priv.get( elem, "olddisplay" );
+               display = elem.style.display;
+               if ( show ) {
+                       // Reset the inline display of this element to learn if it is
+                       // being hidden by cascaded rules or not
+                       if ( !values[ index ] && display === "none" ) {
+                               elem.style.display = "";
+                       }
+
+                       // Set elements which have been overridden with display: none
+                       // in a stylesheet to whatever the default browser style is
+                       // for such an element
+                       if ( elem.style.display === "" && isHidden( elem ) ) {
+                               values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
+                       }
+               } else {
+                       hidden = isHidden( elem );
+
+                       if ( display !== "none" || !hidden ) {
+                               data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
+                       }
+               }
+       }
+
+       // Set the display of most of the elements in a second loop
+       // to avoid the constant reflow
+       for ( index = 0; index < length; index++ ) {
+               elem = elements[ index ];
+               if ( !elem.style ) {
+                       continue;
+               }
+               if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
+                       elem.style.display = show ? values[ index ] || "" : "none";
+               }
+       }
+
+       return elements;
+}
+
+jQuery.extend({
        // Add in style property hooks for overriding the default
        // behavior of getting and setting a style property
        cssHooks: {
                opacity: {
                        get: function( elem, computed ) {
                                if ( computed ) {
-
                                        // We should always get a number back from opacity
                                        var ret = curCSS( elem, "opacity" );
                                        return ret === "" ? "1" : ret;
@@ -6395,7 +5890,6 @@ jQuery.extend( {
 
        // Don't automatically add "px" to these possibly-unitless properties
        cssNumber: {
-               "animationIterationCount": true,
                "columnCount": true,
                "fillOpacity": true,
                "flexGrow": true,
@@ -6413,12 +5907,12 @@ jQuery.extend( {
        // Add in properties whose names you wish to fix before
        // setting or getting the value
        cssProps: {
+               // normalize float css property
                "float": "cssFloat"
        },
 
        // Get and set the style property on a DOM Node
        style: function( elem, name, value, extra ) {
-
                // Don't set styles on text and comment nodes
                if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
                        return;
@@ -6427,63 +5921,49 @@ jQuery.extend( {
                // Make sure that we're working with the right name
                var ret, type, hooks,
                        origName = jQuery.camelCase( name ),
-                       isCustomProp = rcustomProp.test( name ),
                        style = elem.style;
 
-               // Make sure that we're working with the right name. We don't
-               // want to query the value if it is a CSS custom property
-               // since they are user-defined.
-               if ( !isCustomProp ) {
-                       name = finalPropName( origName );
-               }
+               name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
 
-               // Gets hook for the prefixed version, then unprefixed version
+               // gets hook for the prefixed version
+               // followed by the unprefixed version
                hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
 
                // Check if we're setting a value
                if ( value !== undefined ) {
                        type = typeof value;
 
-                       // Convert "+=" or "-=" to relative numbers (#7345)
-                       if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
-                               value = adjustCSS( elem, name, ret );
-
+                       // convert relative number strings (+= or -=) to relative numbers. #7345
+                       if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+                               value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
                                // Fixes bug #9237
                                type = "number";
                        }
 
-                       // Make sure that null and NaN values aren't set (#7116)
+                       // Make sure that null and NaN values aren't set. See: #7116
                        if ( value == null || value !== value ) {
                                return;
                        }
 
-                       // If a number was passed in, add the unit (except for certain CSS properties)
-                       if ( type === "number" ) {
-                               value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
+                       // If a number was passed in, add 'px' to the (except for certain CSS properties)
+                       if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+                               value += "px";
                        }
 
-                       // background-* props affect original clone's values
+                       // Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
+                       // but it would mean to define eight (for every problematic property) identical functions
                        if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
                                style[ name ] = "inherit";
                        }
 
                        // If a hook was provided, use that value, otherwise just set the specified value
-                       if ( !hooks || !( "set" in hooks ) ||
-                               ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
-
-                               if ( isCustomProp ) {
-                                       style.setProperty( name, value );
-                               } else {
-                                       style[ name ] = value;
-                               }
+                       if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+                               style[ name ] = value;
                        }
 
                } else {
-
                        // If a hook was provided get the non-computed value from there
-                       if ( hooks && "get" in hooks &&
-                               ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
-
+                       if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
                                return ret;
                        }
 
@@ -6494,17 +5974,13 @@ jQuery.extend( {
 
        css: function( elem, name, extra, styles ) {
                var val, num, hooks,
-                       origName = jQuery.camelCase( name ),
-                       isCustomProp = rcustomProp.test( name );
+                       origName = jQuery.camelCase( name );
 
-               // Make sure that we're working with the right name. We don't
-               // want to modify the value if it is a CSS custom property
-               // since they are user-defined.
-               if ( !isCustomProp ) {
-                       name = finalPropName( origName );
-               }
+               // Make sure that we're working with the right name
+               name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
 
-               // Try prefixed name followed by the unprefixed name
+               // gets hook for the prefixed version
+               // followed by the unprefixed version
                hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
 
                // If a hook was provided get the computed value from there
@@ -6517,83 +5993,63 @@ jQuery.extend( {
                        val = curCSS( elem, name, styles );
                }
 
-               // Convert "normal" to computed value
+               //convert "normal" to computed value
                if ( val === "normal" && name in cssNormalTransform ) {
                        val = cssNormalTransform[ name ];
                }
 
-               // Make numeric if forced or a qualifier was provided and val looks numeric
+               // Return, converting to number if forced or a qualifier was provided and val looks numeric
                if ( extra === "" || extra ) {
                        num = parseFloat( val );
-                       return extra === true || isFinite( num ) ? num || 0 : val;
+                       return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
                }
-
                return val;
        }
-} );
+});
 
-jQuery.each( [ "height", "width" ], function( i, name ) {
+jQuery.each([ "height", "width" ], function( i, name ) {
        jQuery.cssHooks[ name ] = {
                get: function( elem, computed, extra ) {
                        if ( computed ) {
-
-                               // Certain elements can have dimension info if we invisibly show them
-                               // but it must have a current display style that would benefit
-                               return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
-
-                                       // Support: Safari 8+
-                                       // Table columns in Safari have non-zero offsetWidth & zero
-                                       // getBoundingClientRect().width unless display is changed.
-                                       // Support: IE <=11 only
-                                       // Running getBoundingClientRect on a disconnected node
-                                       // in IE throws an error.
-                                       ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
-                                               swap( elem, cssShow, function() {
-                                                       return getWidthOrHeight( elem, name, extra );
-                                               } ) :
-                                               getWidthOrHeight( elem, name, extra );
+                               // certain elements can have dimension info if we invisibly show them
+                               // however, it must have a current display style that would benefit from this
+                               return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
+                                       jQuery.swap( elem, cssShow, function() {
+                                               return getWidthOrHeight( elem, name, extra );
+                                       }) :
+                                       getWidthOrHeight( elem, name, extra );
                        }
                },
 
                set: function( elem, value, extra ) {
-                       var matches,
-                               styles = extra && getStyles( elem ),
-                               subtract = extra && augmentWidthOrHeight(
+                       var styles = extra && getStyles( elem );
+                       return setPositiveNumber( elem, value, extra ?
+                               augmentWidthOrHeight(
                                        elem,
                                        name,
                                        extra,
                                        jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
                                        styles
-                               );
-
-                       // Convert to pixels if value adjustment is needed
-                       if ( subtract && ( matches = rcssNum.exec( value ) ) &&
-                               ( matches[ 3 ] || "px" ) !== "px" ) {
-
-                               elem.style[ name ] = value;
-                               value = jQuery.css( elem, name );
-                       }
-
-                       return setPositiveNumber( elem, value, subtract );
+                               ) : 0
+                       );
                }
        };
-} );
+});
 
-jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
+// Support: Android 2.3
+jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
        function( elem, computed ) {
                if ( computed ) {
-                       return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
-                               elem.getBoundingClientRect().left -
-                                       swap( elem, { marginLeft: 0 }, function() {
-                                               return elem.getBoundingClientRect().left;
-                                       } )
-                               ) + "px";
+                       // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+                       // Work around by temporarily setting element display to inline-block
+                       return jQuery.swap( elem, { "display": "inline-block" },
+                               curCSS, [ elem, "marginRight" ] );
                }
        }
 );
 
 // These hooks are used by animate to expand properties
-jQuery.each( {
+jQuery.each({
        margin: "",
        padding: "",
        border: "Width"
@@ -6603,8 +6059,8 @@ jQuery.each( {
                        var i = 0,
                                expanded = {},
 
-                               // Assumes a single number if not a string
-                               parts = typeof value === "string" ? value.split( " " ) : [ value ];
+                               // assumes a single number if not a string
+                               parts = typeof value === "string" ? value.split(" ") : [ value ];
 
                        for ( ; i < 4; i++ ) {
                                expanded[ prefix + cssExpand[ i ] + suffix ] =
@@ -6618,16 +6074,16 @@ jQuery.each( {
        if ( !rmargin.test( prefix ) ) {
                jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
        }
-} );
+});
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        css: function( name, value ) {
                return access( this, function( elem, name, value ) {
                        var styles, len,
                                map = {},
                                i = 0;
 
-                       if ( Array.isArray( name ) ) {
+                       if ( jQuery.isArray( name ) ) {
                                styles = getStyles( elem );
                                len = name.length;
 
@@ -6642,8 +6098,27 @@ jQuery.fn.extend( {
                                jQuery.style( elem, name, value ) :
                                jQuery.css( elem, name );
                }, name, value, arguments.length > 1 );
+       },
+       show: function() {
+               return showHide( this, true );
+       },
+       hide: function() {
+               return showHide( this );
+       },
+       toggle: function( state ) {
+               if ( typeof state === "boolean" ) {
+                       return state ? this.show() : this.hide();
+               }
+
+               return this.each(function() {
+                       if ( isHidden( this ) ) {
+                               jQuery( this ).show();
+                       } else {
+                               jQuery( this ).hide();
+                       }
+               });
        }
-} );
+});
 
 
 function Tween( elem, options, prop, end, easing ) {
@@ -6656,7 +6131,7 @@ Tween.prototype = {
        init: function( elem, options, prop, end, easing, unit ) {
                this.elem = elem;
                this.prop = prop;
-               this.easing = easing || jQuery.easing._default;
+               this.easing = easing || "swing";
                this.options = options;
                this.start = this.now = this.cur();
                this.end = end;
@@ -6702,32 +6177,25 @@ Tween.propHooks = {
                get: function( tween ) {
                        var result;
 
-                       // Use a property on the element directly when it is not a DOM element,
-                       // or when there is no matching style property that exists.
-                       if ( tween.elem.nodeType !== 1 ||
-                               tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
+                       if ( tween.elem[ tween.prop ] != null &&
+                               (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
                                return tween.elem[ tween.prop ];
                        }
 
-                       // Passing an empty string as a 3rd parameter to .css will automatically
-                       // attempt a parseFloat and fallback to a string if the parse fails.
-                       // Simple values such as "10px" are parsed to Float;
-                       // complex values such as "rotate(1rad)" are returned as-is.
+                       // passing an empty string as a 3rd parameter to .css will automatically
+                       // attempt a parseFloat and fallback to a string if the parse fails
+                       // so, simple values such as "10px" are parsed to Float.
+                       // complex values such as "rotate(1rad)" are returned as is.
                        result = jQuery.css( tween.elem, tween.prop, "" );
-
                        // Empty strings, null, undefined and "auto" are converted to 0.
                        return !result || result === "auto" ? 0 : result;
                },
                set: function( tween ) {
-
-                       // Use step hook for back compat.
-                       // Use cssHook if its there.
-                       // Use .style if available and use plain properties where available.
+                       // use step hook for back compat - use cssHook if its there - use .style if its
+                       // available and use plain properties where available
                        if ( jQuery.fx.step[ tween.prop ] ) {
                                jQuery.fx.step[ tween.prop ]( tween );
-                       } else if ( tween.elem.nodeType === 1 &&
-                               ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
-                                       jQuery.cssHooks[ tween.prop ] ) ) {
+                       } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
                                jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
                        } else {
                                tween.elem[ tween.prop ] = tween.now;
@@ -6736,8 +6204,9 @@ Tween.propHooks = {
        }
 };
 
-// Support: IE <=9 only
+// Support: IE9
 // Panic based approach to setting things on disconnected nodes
+
 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
        set: function( tween ) {
                if ( tween.elem.nodeType && tween.elem.parentNode ) {
@@ -6752,40 +6221,79 @@ jQuery.easing = {
        },
        swing: function( p ) {
                return 0.5 - Math.cos( p * Math.PI ) / 2;
-       },
-       _default: "swing"
+       }
 };
 
 jQuery.fx = Tween.prototype.init;
 
-// Back compat <1.8 extension point
+// Back Compat <1.8 extension point
 jQuery.fx.step = {};
 
 
 
 
 var
-       fxNow, inProgress,
+       fxNow, timerId,
        rfxtypes = /^(?:toggle|show|hide)$/,
-       rrun = /queueHooks$/;
+       rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
+       rrun = /queueHooks$/,
+       animationPrefilters = [ defaultPrefilter ],
+       tweeners = {
+               "*": [ function( prop, value ) {
+                       var tween = this.createTween( prop, value ),
+                               target = tween.cur(),
+                               parts = rfxnum.exec( value ),
+                               unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
 
-function schedule() {
-       if ( inProgress ) {
-               if ( document.hidden === false && window.requestAnimationFrame ) {
-                       window.requestAnimationFrame( schedule );
-               } else {
-                       window.setTimeout( schedule, jQuery.fx.interval );
-               }
+                               // Starting value computation is required for potential unit mismatches
+                               start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
+                                       rfxnum.exec( jQuery.css( tween.elem, prop ) ),
+                               scale = 1,
+                               maxIterations = 20;
 
-               jQuery.fx.tick();
-       }
-}
+                       if ( start && start[ 3 ] !== unit ) {
+                               // Trust units reported by jQuery.css
+                               unit = unit || start[ 3 ];
+
+                               // Make sure we update the tween properties later on
+                               parts = parts || [];
+
+                               // Iteratively approximate from a nonzero starting point
+                               start = +target || 1;
+
+                               do {
+                                       // If previous iteration zeroed out, double until we get *something*
+                                       // Use a string for doubling factor so we don't accidentally see scale as unchanged below
+                                       scale = scale || ".5";
+
+                                       // Adjust and apply
+                                       start = start / scale;
+                                       jQuery.style( tween.elem, prop, start + unit );
+
+                               // Update scale, tolerating zero or NaN from tween.cur()
+                               // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
+                               } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+                       }
+
+                       // Update tween properties
+                       if ( parts ) {
+                               start = tween.start = +start || +target || 0;
+                               tween.unit = unit;
+                               // If a +=/-= token was provided, we're doing a relative animation
+                               tween.end = parts[ 1 ] ?
+                                       start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
+                                       +parts[ 2 ];
+                       }
+
+                       return tween;
+               } ]
+       };
 
 // Animations created synchronously will run synchronously
 function createFxNow() {
-       window.setTimeout( function() {
+       setTimeout(function() {
                fxNow = undefined;
-       } );
+       });
        return ( fxNow = jQuery.now() );
 }
 
@@ -6795,10 +6303,10 @@ function genFx( type, includeWidth ) {
                i = 0,
                attrs = { height: type };
 
-       // If we include width, step value is 1 to do all cssExpand values,
-       // otherwise step value is 2 to skip over Left and Right
+       // if we include width, step value is 1 to do all cssExpand values,
+       // if we don't include width, step value is 2 to skip over Left and Right
        includeWidth = includeWidth ? 1 : 0;
-       for ( ; i < 4; i += 2 - includeWidth ) {
+       for ( ; i < 4 ; i += 2 - includeWidth ) {
                which = cssExpand[ i ];
                attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
        }
@@ -6812,28 +6320,28 @@ function genFx( type, includeWidth ) {
 
 function createTween( value, prop, animation ) {
        var tween,
-               collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
+               collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
                index = 0,
                length = collection.length;
        for ( ; index < length; index++ ) {
-               if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
+               if ( (tween = collection[ index ].call( animation, prop, value )) ) {
 
-                       // We're done with this property
+                       // we're done with this property
                        return tween;
                }
        }
 }
 
 function defaultPrefilter( elem, props, opts ) {
-       var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
-               isBox = "width" in props || "height" in props,
+       /* jshint validthis: true */
+       var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
                anim = this,
                orig = {},
                style = elem.style,
-               hidden = elem.nodeType && isHiddenWithinTree( elem ),
-               dataShow = dataPriv.get( elem, "fxshow" );
+               hidden = elem.nodeType && isHidden( elem ),
+               dataShow = data_priv.get( elem, "fxshow" );
 
-       // Queue-skipping animations hijack the fx hooks
+       // handle queue: false promises
        if ( !opts.queue ) {
                hooks = jQuery._queueHooks( elem, "fx" );
                if ( hooks.unqueued == null ) {
@@ -6847,151 +6355,114 @@ function defaultPrefilter( elem, props, opts ) {
                }
                hooks.unqueued++;
 
-               anim.always( function() {
-
-                       // Ensure the complete handler is called before this completes
-                       anim.always( function() {
+               anim.always(function() {
+                       // doing this makes sure that the complete handler will be called
+                       // before this completes
+                       anim.always(function() {
                                hooks.unqueued--;
                                if ( !jQuery.queue( elem, "fx" ).length ) {
                                        hooks.empty.fire();
                                }
-                       } );
-               } );
-       }
-
-       // Detect show/hide animations
-       for ( prop in props ) {
-               value = props[ prop ];
-               if ( rfxtypes.test( value ) ) {
-                       delete props[ prop ];
-                       toggle = toggle || value === "toggle";
-                       if ( value === ( hidden ? "hide" : "show" ) ) {
-
-                               // Pretend to be hidden if this is a "show" and
-                               // there is still data from a stopped show/hide
-                               if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
-                                       hidden = true;
-
-                               // Ignore all other no-op show/hide data
-                               } else {
-                                       continue;
-                               }
-                       }
-                       orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
-               }
-       }
-
-       // Bail out if this is a no-op like .hide().hide()
-       propTween = !jQuery.isEmptyObject( props );
-       if ( !propTween && jQuery.isEmptyObject( orig ) ) {
-               return;
+                       });
+               });
        }
 
-       // Restrict "overflow" and "display" styles during box animations
-       if ( isBox && elem.nodeType === 1 ) {
-
-               // Support: IE <=9 - 11, Edge 12 - 13
-               // Record all 3 overflow attributes because IE does not infer the shorthand
-               // from identically-valued overflowX and overflowY
+       // height/width overflow pass
+       if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+               // Make sure that nothing sneaks out
+               // Record all 3 overflow attributes because IE9-10 do not
+               // change the overflow attribute when overflowX and
+               // overflowY are set to the same value
                opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
 
-               // Identify a display type, preferring old show/hide data over the CSS cascade
-               restoreDisplay = dataShow && dataShow.display;
-               if ( restoreDisplay == null ) {
-                       restoreDisplay = dataPriv.get( elem, "display" );
-               }
+               // Set display property to inline-block for height/width
+               // animations on inline elements that are having width/height animated
                display = jQuery.css( elem, "display" );
-               if ( display === "none" ) {
-                       if ( restoreDisplay ) {
-                               display = restoreDisplay;
-                       } else {
 
-                               // Get nonempty value(s) by temporarily forcing visibility
-                               showHide( [ elem ], true );
-                               restoreDisplay = elem.style.display || restoreDisplay;
-                               display = jQuery.css( elem, "display" );
-                               showHide( [ elem ] );
-                       }
-               }
+               // Test default display if display is currently "none"
+               checkDisplay = display === "none" ?
+                       data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
 
-               // Animate inline elements as inline-block
-               if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
-                       if ( jQuery.css( elem, "float" ) === "none" ) {
-
-                               // Restore the original display value at the end of pure show/hide animations
-                               if ( !propTween ) {
-                                       anim.done( function() {
-                                               style.display = restoreDisplay;
-                                       } );
-                                       if ( restoreDisplay == null ) {
-                                               display = style.display;
-                                               restoreDisplay = display === "none" ? "" : display;
-                                       }
-                               }
-                               style.display = "inline-block";
-                       }
+               if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
+                       style.display = "inline-block";
                }
        }
 
        if ( opts.overflow ) {
                style.overflow = "hidden";
-               anim.always( function() {
+               anim.always(function() {
                        style.overflow = opts.overflow[ 0 ];
                        style.overflowX = opts.overflow[ 1 ];
                        style.overflowY = opts.overflow[ 2 ];
-               } );
+               });
        }
 
-       // Implement show/hide animations
-       propTween = false;
-       for ( prop in orig ) {
+       // show/hide pass
+       for ( prop in props ) {
+               value = props[ prop ];
+               if ( rfxtypes.exec( value ) ) {
+                       delete props[ prop ];
+                       toggle = toggle || value === "toggle";
+                       if ( value === ( hidden ? "hide" : "show" ) ) {
 
-               // General show/hide setup for this element animation
-               if ( !propTween ) {
-                       if ( dataShow ) {
-                               if ( "hidden" in dataShow ) {
-                                       hidden = dataShow.hidden;
+                               // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
+                               if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
+                                       hidden = true;
+                               } else {
+                                       continue;
                                }
-                       } else {
-                               dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
                        }
+                       orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
 
-                       // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
-                       if ( toggle ) {
-                               dataShow.hidden = !hidden;
-                       }
+               // Any non-fx value stops us from restoring the original display value
+               } else {
+                       display = undefined;
+               }
+       }
 
-                       // Show elements before animating them
-                       if ( hidden ) {
-                               showHide( [ elem ], true );
+       if ( !jQuery.isEmptyObject( orig ) ) {
+               if ( dataShow ) {
+                       if ( "hidden" in dataShow ) {
+                               hidden = dataShow.hidden;
                        }
+               } else {
+                       dataShow = data_priv.access( elem, "fxshow", {} );
+               }
 
-                       /* eslint-disable no-loop-func */
-
-                       anim.done( function() {
-
-                       /* eslint-enable no-loop-func */
-
-                               // The final step of a "hide" animation is actually hiding the element
-                               if ( !hidden ) {
-                                       showHide( [ elem ] );
-                               }
-                               dataPriv.remove( elem, "fxshow" );
-                               for ( prop in orig ) {
-                                       jQuery.style( elem, prop, orig[ prop ] );
-                               }
-                       } );
+               // store state if its toggle - enables .stop().toggle() to "reverse"
+               if ( toggle ) {
+                       dataShow.hidden = !hidden;
                }
+               if ( hidden ) {
+                       jQuery( elem ).show();
+               } else {
+                       anim.done(function() {
+                               jQuery( elem ).hide();
+                       });
+               }
+               anim.done(function() {
+                       var prop;
 
-               // Per-property setup
-               propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
-               if ( !( prop in dataShow ) ) {
-                       dataShow[ prop ] = propTween.start;
-                       if ( hidden ) {
-                               propTween.end = propTween.start;
-                               propTween.start = 0;
+                       data_priv.remove( elem, "fxshow" );
+                       for ( prop in orig ) {
+                               jQuery.style( elem, prop, orig[ prop ] );
+                       }
+               });
+               for ( prop in orig ) {
+                       tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
+
+                       if ( !( prop in dataShow ) ) {
+                               dataShow[ prop ] = tween.start;
+                               if ( hidden ) {
+                                       tween.end = tween.start;
+                                       tween.start = prop === "width" || prop === "height" ? 1 : 0;
+                               }
                        }
                }
+
+       // If this is a noop like .hide().hide(), restore an overwritten display value
+       } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
+               style.display = display;
        }
 }
 
@@ -7003,7 +6474,7 @@ function propFilter( props, specialEasing ) {
                name = jQuery.camelCase( index );
                easing = specialEasing[ name ];
                value = props[ index ];
-               if ( Array.isArray( value ) ) {
+               if ( jQuery.isArray( value ) ) {
                        easing = value[ 1 ];
                        value = props[ index ] = value[ 0 ];
                }
@@ -7018,8 +6489,8 @@ function propFilter( props, specialEasing ) {
                        value = hooks.expand( value );
                        delete props[ name ];
 
-                       // Not quite $.extend, this won't overwrite existing keys.
-                       // Reusing 'index' because we have the correct "name"
+                       // not quite $.extend, this wont overwrite keys already present.
+                       // also - reusing 'index' from above because we have the correct "name"
                        for ( index in value ) {
                                if ( !( index in props ) ) {
                                        props[ index ] = value[ index ];
@@ -7036,53 +6507,40 @@ function Animation( elem, properties, options ) {
        var result,
                stopped,
                index = 0,
-               length = Animation.prefilters.length,
+               length = animationPrefilters.length,
                deferred = jQuery.Deferred().always( function() {
-
-                       // Don't match elem in the :animated selector
+                       // don't match elem in the :animated selector
                        delete tick.elem;
-               } ),
+               }),
                tick = function() {
                        if ( stopped ) {
                                return false;
                        }
                        var currentTime = fxNow || createFxNow(),
                                remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
-
-                               // Support: Android 2.3 only
-                               // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
+                               // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
                                temp = remaining / animation.duration || 0,
                                percent = 1 - temp,
                                index = 0,
                                length = animation.tweens.length;
 
-                       for ( ; index < length; index++ ) {
+                       for ( ; index < length ; index++ ) {
                                animation.tweens[ index ].run( percent );
                        }
 
-                       deferred.notifyWith( elem, [ animation, percent, remaining ] );
+                       deferred.notifyWith( elem, [ animation, percent, remaining ]);
 
-                       // If there's more to do, yield
                        if ( percent < 1 && length ) {
                                return remaining;
+                       } else {
+                               deferred.resolveWith( elem, [ animation ] );
+                               return false;
                        }
-
-                       // If this was an empty animation, synthesize a final progress notification
-                       if ( !length ) {
-                               deferred.notifyWith( elem, [ animation, 1, 0 ] );
-                       }
-
-                       // Resolve the animation and report its conclusion
-                       deferred.resolveWith( elem, [ animation ] );
-                       return false;
                },
-               animation = deferred.promise( {
+               animation = deferred.promise({
                        elem: elem,
                        props: jQuery.extend( {}, properties ),
-                       opts: jQuery.extend( true, {
-                               specialEasing: {},
-                               easing: jQuery.easing._default
-                       }, options ),
+                       opts: jQuery.extend( true, { specialEasing: {} }, options ),
                        originalProperties: properties,
                        originalOptions: options,
                        startTime: fxNow || createFxNow(),
@@ -7096,39 +6554,34 @@ function Animation( elem, properties, options ) {
                        },
                        stop: function( gotoEnd ) {
                                var index = 0,
-
-                                       // If we are going to the end, we want to run all the tweens
+                                       // if we are going to the end, we want to run all the tweens
                                        // otherwise we skip this part
                                        length = gotoEnd ? animation.tweens.length : 0;
                                if ( stopped ) {
                                        return this;
                                }
                                stopped = true;
-                               for ( ; index < length; index++ ) {
+                               for ( ; index < length ; index++ ) {
                                        animation.tweens[ index ].run( 1 );
                                }
 
-                               // Resolve when we played the last frame; otherwise, reject
+                               // resolve when we played the last frame
+                               // otherwise, reject
                                if ( gotoEnd ) {
-                                       deferred.notifyWith( elem, [ animation, 1, 0 ] );
                                        deferred.resolveWith( elem, [ animation, gotoEnd ] );
                                } else {
                                        deferred.rejectWith( elem, [ animation, gotoEnd ] );
                                }
                                return this;
                        }
-               } ),
+               }),
                props = animation.props;
 
        propFilter( props, animation.opts.specialEasing );
 
-       for ( ; index < length; index++ ) {
-               result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
+       for ( ; index < length ; index++ ) {
+               result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
                if ( result ) {
-                       if ( jQuery.isFunction( result.stop ) ) {
-                               jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
-                                       jQuery.proxy( result.stop, result );
-                       }
                        return result;
                }
        }
@@ -7139,63 +6592,50 @@ function Animation( elem, properties, options ) {
                animation.opts.start.call( elem, animation );
        }
 
-       // Attach callbacks from options
-       animation
-               .progress( animation.opts.progress )
-               .done( animation.opts.done, animation.opts.complete )
-               .fail( animation.opts.fail )
-               .always( animation.opts.always );
-
        jQuery.fx.timer(
                jQuery.extend( tick, {
                        elem: elem,
                        anim: animation,
                        queue: animation.opts.queue
-               } )
+               })
        );
 
-       return animation;
+       // attach callbacks from options
+       return animation.progress( animation.opts.progress )
+               .done( animation.opts.done, animation.opts.complete )
+               .fail( animation.opts.fail )
+               .always( animation.opts.always );
 }
 
 jQuery.Animation = jQuery.extend( Animation, {
 
-       tweeners: {
-               "*": [ function( prop, value ) {
-                       var tween = this.createTween( prop, value );
-                       adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
-                       return tween;
-               } ]
-       },
-
        tweener: function( props, callback ) {
                if ( jQuery.isFunction( props ) ) {
                        callback = props;
                        props = [ "*" ];
                } else {
-                       props = props.match( rnothtmlwhite );
+                       props = props.split(" ");
                }
 
                var prop,
                        index = 0,
                        length = props.length;
 
-               for ( ; index < length; index++ ) {
+               for ( ; index < length ; index++ ) {
                        prop = props[ index ];
-                       Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
-                       Animation.tweeners[ prop ].unshift( callback );
+                       tweeners[ prop ] = tweeners[ prop ] || [];
+                       tweeners[ prop ].unshift( callback );
                }
        },
 
-       prefilters: [ defaultPrefilter ],
-
        prefilter: function( callback, prepend ) {
                if ( prepend ) {
-                       Animation.prefilters.unshift( callback );
+                       animationPrefilters.unshift( callback );
                } else {
-                       Animation.prefilters.push( callback );
+                       animationPrefilters.push( callback );
                }
        }
-} );
+});
 
 jQuery.speed = function( speed, easing, fn ) {
        var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
@@ -7205,22 +6645,10 @@ jQuery.speed = function( speed, easing, fn ) {
                easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
        };
 
-       // Go to the end state if fx are off
-       if ( jQuery.fx.off ) {
-               opt.duration = 0;
-
-       } else {
-               if ( typeof opt.duration !== "number" ) {
-                       if ( opt.duration in jQuery.fx.speeds ) {
-                               opt.duration = jQuery.fx.speeds[ opt.duration ];
+       opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+               opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
 
-                       } else {
-                               opt.duration = jQuery.fx.speeds._default;
-                       }
-               }
-       }
-
-       // Normalize opt.queue - true/undefined/null -> "fx"
+       // normalize opt.queue - true/undefined/null -> "fx"
        if ( opt.queue == null || opt.queue === true ) {
                opt.queue = "fx";
        }
@@ -7241,25 +6669,24 @@ jQuery.speed = function( speed, easing, fn ) {
        return opt;
 };
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        fadeTo: function( speed, to, easing, callback ) {
 
-               // Show any hidden elements after setting opacity to 0
-               return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
+               // show any hidden elements after setting opacity to 0
+               return this.filter( isHidden ).css( "opacity", 0 ).show()
 
-                       // Animate to the value specified
-                       .end().animate( { opacity: to }, speed, easing, callback );
+                       // animate to the value specified
+                       .end().animate({ opacity: to }, speed, easing, callback );
        },
        animate: function( prop, speed, easing, callback ) {
                var empty = jQuery.isEmptyObject( prop ),
                        optall = jQuery.speed( speed, easing, callback ),
                        doAnimation = function() {
-
                                // Operate on a copy of prop so per-property easing won't be lost
                                var anim = Animation( this, jQuery.extend( {}, prop ), optall );
 
                                // Empty animations, or finishing resolves immediately
-                               if ( empty || dataPriv.get( this, "finish" ) ) {
+                               if ( empty || data_priv.get( this, "finish" ) ) {
                                        anim.stop( true );
                                }
                        };
@@ -7285,11 +6712,11 @@ jQuery.fn.extend( {
                        this.queue( type || "fx", [] );
                }
 
-               return this.each( function() {
+               return this.each(function() {
                        var dequeue = true,
                                index = type != null && type + "queueHooks",
                                timers = jQuery.timers,
-                               data = dataPriv.get( this );
+                               data = data_priv.get( this );
 
                        if ( index ) {
                                if ( data[ index ] && data[ index ].stop ) {
@@ -7304,46 +6731,44 @@ jQuery.fn.extend( {
                        }
 
                        for ( index = timers.length; index--; ) {
-                               if ( timers[ index ].elem === this &&
-                                       ( type == null || timers[ index ].queue === type ) ) {
-
+                               if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
                                        timers[ index ].anim.stop( gotoEnd );
                                        dequeue = false;
                                        timers.splice( index, 1 );
                                }
                        }
 
-                       // Start the next in the queue if the last step wasn't forced.
-                       // Timers currently will call their complete callbacks, which
-                       // will dequeue but only if they were gotoEnd.
+                       // start the next in the queue if the last step wasn't forced
+                       // timers currently will call their complete callbacks, which will dequeue
+                       // but only if they were gotoEnd
                        if ( dequeue || !gotoEnd ) {
                                jQuery.dequeue( this, type );
                        }
-               } );
+               });
        },
        finish: function( type ) {
                if ( type !== false ) {
                        type = type || "fx";
                }
-               return this.each( function() {
+               return this.each(function() {
                        var index,
-                               data = dataPriv.get( this ),
+                               data = data_priv.get( this ),
                                queue = data[ type + "queue" ],
                                hooks = data[ type + "queueHooks" ],
                                timers = jQuery.timers,
                                length = queue ? queue.length : 0;
 
-                       // Enable finishing flag on private data
+                       // enable finishing flag on private data
                        data.finish = true;
 
-                       // Empty the queue first
+                       // empty the queue first
                        jQuery.queue( this, type, [] );
 
                        if ( hooks && hooks.stop ) {
                                hooks.stop.call( this, true );
                        }
 
-                       // Look for any active animations, and finish them
+                       // look for any active animations, and finish them
                        for ( index = timers.length; index--; ) {
                                if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
                                        timers[ index ].anim.stop( true );
@@ -7351,33 +6776,33 @@ jQuery.fn.extend( {
                                }
                        }
 
-                       // Look for any animations in the old queue and finish them
+                       // look for any animations in the old queue and finish them
                        for ( index = 0; index < length; index++ ) {
                                if ( queue[ index ] && queue[ index ].finish ) {
                                        queue[ index ].finish.call( this );
                                }
                        }
 
-                       // Turn off finishing flag
+                       // turn off finishing flag
                        delete data.finish;
-               } );
+               });
        }
-} );
+});
 
-jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
+jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
        var cssFn = jQuery.fn[ name ];
        jQuery.fn[ name ] = function( speed, easing, callback ) {
                return speed == null || typeof speed === "boolean" ?
                        cssFn.apply( this, arguments ) :
                        this.animate( genFx( name, true ), speed, easing, callback );
        };
-} );
+});
 
 // Generate shortcuts for custom animations
-jQuery.each( {
-       slideDown: genFx( "show" ),
-       slideUp: genFx( "hide" ),
-       slideToggle: genFx( "toggle" ),
+jQuery.each({
+       slideDown: genFx("show"),
+       slideUp: genFx("hide"),
+       slideToggle: genFx("toggle"),
        fadeIn: { opacity: "show" },
        fadeOut: { opacity: "hide" },
        fadeToggle: { opacity: "toggle" }
@@ -7385,7 +6810,7 @@ jQuery.each( {
        jQuery.fn[ name ] = function( speed, easing, callback ) {
                return this.animate( props, speed, easing, callback );
        };
-} );
+});
 
 jQuery.timers = [];
 jQuery.fx.tick = function() {
@@ -7397,8 +6822,7 @@ jQuery.fx.tick = function() {
 
        for ( ; i < timers.length; i++ ) {
                timer = timers[ i ];
-
-               // Run the timer and safely remove it when done (allowing for external removal)
+               // Checks the timer has not already been removed
                if ( !timer() && timers[ i ] === timer ) {
                        timers.splice( i--, 1 );
                }
@@ -7412,138 +6836,169 @@ jQuery.fx.tick = function() {
 
 jQuery.fx.timer = function( timer ) {
        jQuery.timers.push( timer );
-       jQuery.fx.start();
+       if ( timer() ) {
+               jQuery.fx.start();
+       } else {
+               jQuery.timers.pop();
+       }
 };
 
 jQuery.fx.interval = 13;
+
 jQuery.fx.start = function() {
-       if ( inProgress ) {
-               return;
+       if ( !timerId ) {
+               timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
        }
-
-       inProgress = true;
-       schedule();
 };
 
 jQuery.fx.stop = function() {
-       inProgress = null;
+       clearInterval( timerId );
+       timerId = null;
 };
 
 jQuery.fx.speeds = {
        slow: 600,
        fast: 200,
-
        // Default speed
        _default: 400
 };
 
 
 // Based off of the plugin by Clint Helfers, with permission.
-// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
+// http://blindsignals.com/index.php/2009/07/jquery-delay/
 jQuery.fn.delay = function( time, type ) {
        time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
        type = type || "fx";
 
        return this.queue( type, function( next, hooks ) {
-               var timeout = window.setTimeout( next, time );
+               var timeout = setTimeout( next, time );
                hooks.stop = function() {
-                       window.clearTimeout( timeout );
+                       clearTimeout( timeout );
                };
-       } );
+       });
 };
 
 
-( function() {
+(function() {
        var input = document.createElement( "input" ),
                select = document.createElement( "select" ),
                opt = select.appendChild( document.createElement( "option" ) );
 
        input.type = "checkbox";
 
-       // Support: Android <=4.3 only
-       // Default value for a checkbox should be "on"
+       // Support: iOS 5.1, Android 4.x, Android 2.3
+       // Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
        support.checkOn = input.value !== "";
 
-       // Support: IE <=11 only
-       // Must access selectedIndex to make default options select
+       // Must access the parent to make an option select properly
+       // Support: IE9, IE10
        support.optSelected = opt.selected;
 
-       // Support: IE <=11 only
-       // An input loses its value after becoming a radio
+       // Make sure that the options inside disabled selects aren't marked as disabled
+       // (WebKit marks them as disabled)
+       select.disabled = true;
+       support.optDisabled = !opt.disabled;
+
+       // Check if an input maintains its value after becoming a radio
+       // Support: IE9, IE10
        input = document.createElement( "input" );
        input.value = "t";
        input.type = "radio";
        support.radioValue = input.value === "t";
-} )();
+})();
 
 
-var boolHook,
+var nodeHook, boolHook,
        attrHandle = jQuery.expr.attrHandle;
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        attr: function( name, value ) {
                return access( this, jQuery.attr, name, value, arguments.length > 1 );
        },
 
        removeAttr: function( name ) {
-               return this.each( function() {
+               return this.each(function() {
                        jQuery.removeAttr( this, name );
-               } );
+               });
        }
-} );
+});
 
-jQuery.extend( {
+jQuery.extend({
        attr: function( elem, name, value ) {
-               var ret, hooks,
+               var hooks, ret,
                        nType = elem.nodeType;
 
-               // Don't get/set attributes on text, comment and attribute nodes
-               if ( nType === 3 || nType === 8 || nType === 2 ) {
+               // don't get/set attributes on text, comment and attribute nodes
+               if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
                        return;
                }
 
                // Fallback to prop when attributes are not supported
-               if ( typeof elem.getAttribute === "undefined" ) {
+               if ( typeof elem.getAttribute === strundefined ) {
                        return jQuery.prop( elem, name, value );
                }
 
-               // Attribute hooks are determined by the lowercase version
+               // All attributes are lowercase
                // Grab necessary hook if one is defined
                if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
-                       hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
-                               ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
+                       name = name.toLowerCase();
+                       hooks = jQuery.attrHooks[ name ] ||
+                               ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
                }
 
                if ( value !== undefined ) {
+
                        if ( value === null ) {
                                jQuery.removeAttr( elem, name );
-                               return;
-                       }
 
-                       if ( hooks && "set" in hooks &&
-                               ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
+                       } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
                                return ret;
-                       }
 
-                       elem.setAttribute( name, value + "" );
-                       return value;
-               }
+                       } else {
+                               elem.setAttribute( name, value + "" );
+                               return value;
+                       }
 
-               if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
+               } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
                        return ret;
+
+               } else {
+                       ret = jQuery.find.attr( elem, name );
+
+                       // Non-existent attributes return null, we normalize to undefined
+                       return ret == null ?
+                               undefined :
+                               ret;
                }
+       },
 
-               ret = jQuery.find.attr( elem, name );
+       removeAttr: function( elem, value ) {
+               var name, propName,
+                       i = 0,
+                       attrNames = value && value.match( rnotwhite );
+
+               if ( attrNames && elem.nodeType === 1 ) {
+                       while ( (name = attrNames[i++]) ) {
+                               propName = jQuery.propFix[ name ] || name;
 
-               // Non-existent attributes return null, we normalize to undefined
-               return ret == null ? undefined : ret;
+                               // Boolean attributes get special treatment (#10870)
+                               if ( jQuery.expr.match.bool.test( name ) ) {
+                                       // Set corresponding property to false
+                                       elem[ propName ] = false;
+                               }
+
+                               elem.removeAttribute( name );
+                       }
+               }
        },
 
        attrHooks: {
                type: {
                        set: function( elem, value ) {
                                if ( !support.radioValue && value === "radio" &&
-                                       nodeName( elem, "input" ) ) {
+                                       jQuery.nodeName( elem, "input" ) ) {
+                                       // Setting the type on a radio button after the value resets the value in IE6-9
+                                       // Reset value to default in case type is set after value during creation
                                        var val = elem.value;
                                        elem.setAttribute( "type", value );
                                        if ( val ) {
@@ -7553,29 +7008,13 @@ jQuery.extend( {
                                }
                        }
                }
-       },
-
-       removeAttr: function( elem, value ) {
-               var name,
-                       i = 0,
-
-                       // Attribute names can contain non-HTML whitespace characters
-                       // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
-                       attrNames = value && value.match( rnothtmlwhite );
-
-               if ( attrNames && elem.nodeType === 1 ) {
-                       while ( ( name = attrNames[ i++ ] ) ) {
-                               elem.removeAttribute( name );
-                       }
-               }
        }
-} );
+});
 
 // Hooks for boolean attributes
 boolHook = {
        set: function( elem, value, name ) {
                if ( value === false ) {
-
                        // Remove boolean attributes when set to false
                        jQuery.removeAttr( elem, name );
                } else {
@@ -7584,150 +7023,102 @@ boolHook = {
                return name;
        }
 };
-
 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
        var getter = attrHandle[ name ] || jQuery.find.attr;
 
        attrHandle[ name ] = function( elem, name, isXML ) {
-               var ret, handle,
-                       lowercaseName = name.toLowerCase();
-
+               var ret, handle;
                if ( !isXML ) {
-
                        // Avoid an infinite loop by temporarily removing this function from the getter
-                       handle = attrHandle[ lowercaseName ];
-                       attrHandle[ lowercaseName ] = ret;
+                       handle = attrHandle[ name ];
+                       attrHandle[ name ] = ret;
                        ret = getter( elem, name, isXML ) != null ?
-                               lowercaseName :
+                               name.toLowerCase() :
                                null;
-                       attrHandle[ lowercaseName ] = handle;
+                       attrHandle[ name ] = handle;
                }
                return ret;
        };
-} );
+});
 
 
 
 
-var rfocusable = /^(?:input|select|textarea|button)$/i,
-       rclickable = /^(?:a|area)$/i;
+var rfocusable = /^(?:input|select|textarea|button)$/i;
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        prop: function( name, value ) {
                return access( this, jQuery.prop, name, value, arguments.length > 1 );
        },
 
        removeProp: function( name ) {
-               return this.each( function() {
+               return this.each(function() {
                        delete this[ jQuery.propFix[ name ] || name ];
-               } );
+               });
        }
-} );
+});
+
+jQuery.extend({
+       propFix: {
+               "for": "htmlFor",
+               "class": "className"
+       },
 
-jQuery.extend( {
        prop: function( elem, name, value ) {
-               var ret, hooks,
+               var ret, hooks, notxml,
                        nType = elem.nodeType;
 
-               // Don't get/set properties on text, comment and attribute nodes
-               if ( nType === 3 || nType === 8 || nType === 2 ) {
+               // don't get/set properties on text, comment and attribute nodes
+               if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
                        return;
                }
 
-               if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
+               notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
 
+               if ( notxml ) {
                        // Fix name and attach hooks
                        name = jQuery.propFix[ name ] || name;
                        hooks = jQuery.propHooks[ name ];
                }
 
                if ( value !== undefined ) {
-                       if ( hooks && "set" in hooks &&
-                               ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
-                               return ret;
-                       }
-
-                       return ( elem[ name ] = value );
-               }
+                       return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
+                               ret :
+                               ( elem[ name ] = value );
 
-               if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
-                       return ret;
+               } else {
+                       return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
+                               ret :
+                               elem[ name ];
                }
-
-               return elem[ name ];
        },
 
        propHooks: {
                tabIndex: {
                        get: function( elem ) {
-
-                               // Support: IE <=9 - 11 only
-                               // elem.tabIndex doesn't always return the
-                               // correct value when it hasn't been explicitly set
-                               // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
-                               // Use proper attribute retrieval(#12072)
-                               var tabindex = jQuery.find.attr( elem, "tabindex" );
-
-                               if ( tabindex ) {
-                                       return parseInt( tabindex, 10 );
-                               }
-
-                               if (
-                                       rfocusable.test( elem.nodeName ) ||
-                                       rclickable.test( elem.nodeName ) &&
-                                       elem.href
-                               ) {
-                                       return 0;
-                               }
-
-                               return -1;
+                               return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
+                                       elem.tabIndex :
+                                       -1;
                        }
                }
-       },
-
-       propFix: {
-               "for": "htmlFor",
-               "class": "className"
        }
-} );
-
-// Support: IE <=11 only
-// Accessing the selectedIndex property
-// forces the browser to respect setting selected
-// on the option
-// The getter ensures a default option is selected
-// when in an optgroup
-// eslint rule "no-unused-expressions" is disabled for this code
-// since it considers such accessions noop
+});
+
+// Support: IE9+
+// Selectedness for an option in an optgroup can be inaccurate
 if ( !support.optSelected ) {
        jQuery.propHooks.selected = {
                get: function( elem ) {
-
-                       /* eslint no-unused-expressions: "off" */
-
                        var parent = elem.parentNode;
                        if ( parent && parent.parentNode ) {
                                parent.parentNode.selectedIndex;
                        }
                        return null;
-               },
-               set: function( elem ) {
-
-                       /* eslint no-unused-expressions: "off" */
-
-                       var parent = elem.parentNode;
-                       if ( parent ) {
-                               parent.selectedIndex;
-
-                               if ( parent.parentNode ) {
-                                       parent.parentNode.selectedIndex;
-                               }
-                       }
                }
        };
 }
 
-jQuery.each( [
+jQuery.each([
        "tabIndex",
        "readOnly",
        "maxLength",
@@ -7740,53 +7131,49 @@ jQuery.each( [
        "contentEditable"
 ], function() {
        jQuery.propFix[ this.toLowerCase() ] = this;
-} );
-
+});
 
 
 
-       // Strip and collapse whitespace according to HTML spec
-       // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
-       function stripAndCollapse( value ) {
-               var tokens = value.match( rnothtmlwhite ) || [];
-               return tokens.join( " " );
-       }
 
+var rclass = /[\t\r\n\f]/g;
 
-function getClass( elem ) {
-       return elem.getAttribute && elem.getAttribute( "class" ) || "";
-}
-
-jQuery.fn.extend( {
+jQuery.fn.extend({
        addClass: function( value ) {
-               var classes, elem, cur, curValue, clazz, j, finalValue,
-                       i = 0;
+               var classes, elem, cur, clazz, j, finalValue,
+                       proceed = typeof value === "string" && value,
+                       i = 0,
+                       len = this.length;
 
                if ( jQuery.isFunction( value ) ) {
-                       return this.each( function( j ) {
-                               jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
-                       } );
+                       return this.each(function( j ) {
+                               jQuery( this ).addClass( value.call( this, j, this.className ) );
+                       });
                }
 
-               if ( typeof value === "string" && value ) {
-                       classes = value.match( rnothtmlwhite ) || [];
+               if ( proceed ) {
+                       // The disjunction here is for better compressibility (see removeClass)
+                       classes = ( value || "" ).match( rnotwhite ) || [];
 
-                       while ( ( elem = this[ i++ ] ) ) {
-                               curValue = getClass( elem );
-                               cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
+                       for ( ; i < len; i++ ) {
+                               elem = this[ i ];
+                               cur = elem.nodeType === 1 && ( elem.className ?
+                                       ( " " + elem.className + " " ).replace( rclass, " " ) :
+                                       " "
+                               );
 
                                if ( cur ) {
                                        j = 0;
-                                       while ( ( clazz = classes[ j++ ] ) ) {
+                                       while ( (clazz = classes[j++]) ) {
                                                if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
                                                        cur += clazz + " ";
                                                }
                                        }
 
-                                       // Only assign if different to avoid unneeded rendering.
-                                       finalValue = stripAndCollapse( cur );
-                                       if ( curValue !== finalValue ) {
-                                               elem.setAttribute( "class", finalValue );
+                                       // only assign if different to avoid unneeded rendering.
+                                       finalValue = jQuery.trim( cur );
+                                       if ( elem.className !== finalValue ) {
+                                               elem.className = finalValue;
                                        }
                                }
                        }
@@ -7796,42 +7183,40 @@ jQuery.fn.extend( {
        },
 
        removeClass: function( value ) {
-               var classes, elem, cur, curValue, clazz, j, finalValue,
-                       i = 0;
+               var classes, elem, cur, clazz, j, finalValue,
+                       proceed = arguments.length === 0 || typeof value === "string" && value,
+                       i = 0,
+                       len = this.length;
 
                if ( jQuery.isFunction( value ) ) {
-                       return this.each( function( j ) {
-                               jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
-                       } );
-               }
-
-               if ( !arguments.length ) {
-                       return this.attr( "class", "" );
+                       return this.each(function( j ) {
+                               jQuery( this ).removeClass( value.call( this, j, this.className ) );
+                       });
                }
+               if ( proceed ) {
+                       classes = ( value || "" ).match( rnotwhite ) || [];
 
-               if ( typeof value === "string" && value ) {
-                       classes = value.match( rnothtmlwhite ) || [];
-
-                       while ( ( elem = this[ i++ ] ) ) {
-                               curValue = getClass( elem );
-
+                       for ( ; i < len; i++ ) {
+                               elem = this[ i ];
                                // This expression is here for better compressibility (see addClass)
-                               cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
+                               cur = elem.nodeType === 1 && ( elem.className ?
+                                       ( " " + elem.className + " " ).replace( rclass, " " ) :
+                                       ""
+                               );
 
                                if ( cur ) {
                                        j = 0;
-                                       while ( ( clazz = classes[ j++ ] ) ) {
-
+                                       while ( (clazz = classes[j++]) ) {
                                                // Remove *all* instances
-                                               while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
+                                               while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
                                                        cur = cur.replace( " " + clazz + " ", " " );
                                                }
                                        }
 
-                                       // Only assign if different to avoid unneeded rendering.
-                                       finalValue = stripAndCollapse( cur );
-                                       if ( curValue !== finalValue ) {
-                                               elem.setAttribute( "class", finalValue );
+                                       // only assign if different to avoid unneeded rendering.
+                                       finalValue = value ? jQuery.trim( cur ) : "";
+                                       if ( elem.className !== finalValue ) {
+                                               elem.className = finalValue;
                                        }
                                }
                        }
@@ -7848,27 +7233,21 @@ jQuery.fn.extend( {
                }
 
                if ( jQuery.isFunction( value ) ) {
-                       return this.each( function( i ) {
-                               jQuery( this ).toggleClass(
-                                       value.call( this, i, getClass( this ), stateVal ),
-                                       stateVal
-                               );
-                       } );
+                       return this.each(function( i ) {
+                               jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+                       });
                }
 
-               return this.each( function() {
-                       var className, i, self, classNames;
-
+               return this.each(function() {
                        if ( type === "string" ) {
-
-                               // Toggle individual class names
-                               i = 0;
-                               self = jQuery( this );
-                               classNames = value.match( rnothtmlwhite ) || [];
-
-                               while ( ( className = classNames[ i++ ] ) ) {
-
-                                       // Check each className given, space separated list
+                               // toggle individual class names
+                               var className,
+                                       i = 0,
+                                       self = jQuery( this ),
+                                       classNames = value.match( rnotwhite ) || [];
+
+                               while ( (className = classNames[ i++ ]) ) {
+                                       // check each className given, space separated list
                                        if ( self.hasClass( className ) ) {
                                                self.removeClass( className );
                                        } else {
@@ -7877,76 +7256,60 @@ jQuery.fn.extend( {
                                }
 
                        // Toggle whole class name
-                       } else if ( value === undefined || type === "boolean" ) {
-                               className = getClass( this );
-                               if ( className ) {
-
-                                       // Store className if set
-                                       dataPriv.set( this, "__className__", className );
+                       } else if ( type === strundefined || type === "boolean" ) {
+                               if ( this.className ) {
+                                       // store className if set
+                                       data_priv.set( this, "__className__", this.className );
                                }
 
-                               // If the element has a class name or if we're passed `false`,
+                               // If the element has a class name or if we're passed "false",
                                // then remove the whole classname (if there was one, the above saved it).
                                // Otherwise bring back whatever was previously saved (if anything),
                                // falling back to the empty string if nothing was stored.
-                               if ( this.setAttribute ) {
-                                       this.setAttribute( "class",
-                                               className || value === false ?
-                                               "" :
-                                               dataPriv.get( this, "__className__" ) || ""
-                                       );
-                               }
+                               this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
                        }
-               } );
+               });
        },
 
        hasClass: function( selector ) {
-               var className, elem,
-                       i = 0;
-
-               className = " " + selector + " ";
-               while ( ( elem = this[ i++ ] ) ) {
-                       if ( elem.nodeType === 1 &&
-                               ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
-                                       return true;
+               var className = " " + selector + " ",
+                       i = 0,
+                       l = this.length;
+               for ( ; i < l; i++ ) {
+                       if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+                               return true;
                        }
                }
 
                return false;
        }
-} );
+});
 
 
 
 
 var rreturn = /\r/g;
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        val: function( value ) {
                var hooks, ret, isFunction,
-                       elem = this[ 0 ];
+                       elem = this[0];
 
                if ( !arguments.length ) {
                        if ( elem ) {
-                               hooks = jQuery.valHooks[ elem.type ] ||
-                                       jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+                               hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
 
-                               if ( hooks &&
-                                       "get" in hooks &&
-                                       ( ret = hooks.get( elem, "value" ) ) !== undefined
-                               ) {
+                               if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
                                        return ret;
                                }
 
                                ret = elem.value;
 
-                               // Handle most common string cases
-                               if ( typeof ret === "string" ) {
-                                       return ret.replace( rreturn, "" );
-                               }
-
-                               // Handle cases where value is null/undef or number
-                               return ret == null ? "" : ret;
+                               return typeof ret === "string" ?
+                                       // handle most common string cases
+                                       ret.replace(rreturn, "") :
+                                       // handle cases where value is null/undef or number
+                                       ret == null ? "" : ret;
                        }
 
                        return;
@@ -7954,7 +7317,7 @@ jQuery.fn.extend( {
 
                isFunction = jQuery.isFunction( value );
 
-               return this.each( function( i ) {
+               return this.each(function( i ) {
                        var val;
 
                        if ( this.nodeType !== 1 ) {
@@ -7974,66 +7337,55 @@ jQuery.fn.extend( {
                        } else if ( typeof val === "number" ) {
                                val += "";
 
-                       } else if ( Array.isArray( val ) ) {
+                       } else if ( jQuery.isArray( val ) ) {
                                val = jQuery.map( val, function( value ) {
                                        return value == null ? "" : value + "";
-                               } );
+                               });
                        }
 
                        hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
 
                        // If set returns undefined, fall back to normal setting
-                       if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
+                       if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
                                this.value = val;
                        }
-               } );
+               });
        }
-} );
+});
 
-jQuery.extend( {
+jQuery.extend({
        valHooks: {
                option: {
                        get: function( elem ) {
-
                                var val = jQuery.find.attr( elem, "value" );
                                return val != null ?
                                        val :
-
-                                       // Support: IE <=10 - 11 only
+                                       // Support: IE10-11+
                                        // option.text throws exceptions (#14686, #14858)
-                                       // Strip and collapse whitespace
-                                       // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
-                                       stripAndCollapse( jQuery.text( elem ) );
+                                       jQuery.trim( jQuery.text( elem ) );
                        }
                },
                select: {
                        get: function( elem ) {
-                               var value, option, i,
+                               var value, option,
                                        options = elem.options,
                                        index = elem.selectedIndex,
-                                       one = elem.type === "select-one",
+                                       one = elem.type === "select-one" || index < 0,
                                        values = one ? null : [],
-                                       max = one ? index + 1 : options.length;
-
-                               if ( index < 0 ) {
-                                       i = max;
-
-                               } else {
-                                       i = one ? index : 0;
-                               }
+                                       max = one ? index + 1 : options.length,
+                                       i = index < 0 ?
+                                               max :
+                                               one ? index : 0;
 
                                // Loop through all the selected options
                                for ( ; i < max; i++ ) {
                                        option = options[ i ];
 
-                                       // Support: IE <=9 only
-                                       // IE8-9 doesn't update selected after form reset (#2551)
+                                       // IE6-9 doesn't update selected after form reset (#2551)
                                        if ( ( option.selected || i === index ) &&
-
                                                        // Don't return options that are disabled or in a disabled optgroup
-                                                       !option.disabled &&
-                                                       ( !option.parentNode.disabled ||
-                                                               !nodeName( option.parentNode, "optgroup" ) ) ) {
+                                                       ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
+                                                       ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
 
                                                // Get the specific value for the option
                                                value = jQuery( option ).val();
@@ -8059,19 +7411,12 @@ jQuery.extend( {
 
                                while ( i-- ) {
                                        option = options[ i ];
-
-                                       /* eslint-disable no-cond-assign */
-
-                                       if ( option.selected =
-                                               jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
-                                       ) {
+                                       if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
                                                optionSet = true;
                                        }
-
-                                       /* eslint-enable no-cond-assign */
                                }
 
-                               // Force browsers to behave consistently when non-matching value is set
+                               // force browsers to behave consistently when non-matching value is set
                                if ( !optionSet ) {
                                        elem.selectedIndex = -1;
                                }
@@ -8079,23 +7424,25 @@ jQuery.extend( {
                        }
                }
        }
-} );
+});
 
 // Radios and checkboxes getter/setter
-jQuery.each( [ "radio", "checkbox" ], function() {
+jQuery.each([ "radio", "checkbox" ], function() {
        jQuery.valHooks[ this ] = {
                set: function( elem, value ) {
-                       if ( Array.isArray( value ) ) {
-                               return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
+                       if ( jQuery.isArray( value ) ) {
+                               return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
                        }
                }
        };
        if ( !support.checkOn ) {
                jQuery.valHooks[ this ].get = function( elem ) {
-                       return elem.getAttribute( "value" ) === null ? "on" : elem.value;
+                       // Support: Webkit
+                       // "" is returned instead of "on" if a value isn't specified
+                       return elem.getAttribute("value") === null ? "on" : elem.value;
                };
        }
-} );
+});
 
 
 
@@ -8103,182 +7450,9 @@ jQuery.each( [ "radio", "checkbox" ], function() {
 // Return jQuery for attributes-only inclusion
 
 
-var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
-
-jQuery.extend( jQuery.event, {
-
-       trigger: function( event, data, elem, onlyHandlers ) {
-
-               var i, cur, tmp, bubbleType, ontype, handle, special,
-                       eventPath = [ elem || document ],
-                       type = hasOwn.call( event, "type" ) ? event.type : event,
-                       namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
-
-               cur = tmp = elem = elem || document;
-
-               // Don't do events on text and comment nodes
-               if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
-                       return;
-               }
-
-               // focus/blur morphs to focusin/out; ensure we're not firing them right now
-               if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
-                       return;
-               }
-
-               if ( type.indexOf( "." ) > -1 ) {
-
-                       // Namespaced trigger; create a regexp to match event type in handle()
-                       namespaces = type.split( "." );
-                       type = namespaces.shift();
-                       namespaces.sort();
-               }
-               ontype = type.indexOf( ":" ) < 0 && "on" + type;
-
-               // Caller can pass in a jQuery.Event object, Object, or just an event type string
-               event = event[ jQuery.expando ] ?
-                       event :
-                       new jQuery.Event( type, typeof event === "object" && event );
-
-               // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
-               event.isTrigger = onlyHandlers ? 2 : 3;
-               event.namespace = namespaces.join( "." );
-               event.rnamespace = event.namespace ?
-                       new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
-                       null;
-
-               // Clean up the event in case it is being reused
-               event.result = undefined;
-               if ( !event.target ) {
-                       event.target = elem;
-               }
-
-               // Clone any incoming data and prepend the event, creating the handler arg list
-               data = data == null ?
-                       [ event ] :
-                       jQuery.makeArray( data, [ event ] );
-
-               // Allow special events to draw outside the lines
-               special = jQuery.event.special[ type ] || {};
-               if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
-                       return;
-               }
-
-               // Determine event propagation path in advance, per W3C events spec (#9951)
-               // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
-               if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
-
-                       bubbleType = special.delegateType || type;
-                       if ( !rfocusMorph.test( bubbleType + type ) ) {
-                               cur = cur.parentNode;
-                       }
-                       for ( ; cur; cur = cur.parentNode ) {
-                               eventPath.push( cur );
-                               tmp = cur;
-                       }
-
-                       // Only add window if we got to document (e.g., not plain obj or detached DOM)
-                       if ( tmp === ( elem.ownerDocument || document ) ) {
-                               eventPath.push( tmp.defaultView || tmp.parentWindow || window );
-                       }
-               }
-
-               // Fire handlers on the event path
-               i = 0;
-               while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
-
-                       event.type = i > 1 ?
-                               bubbleType :
-                               special.bindType || type;
-
-                       // jQuery handler
-                       handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
-                               dataPriv.get( cur, "handle" );
-                       if ( handle ) {
-                               handle.apply( cur, data );
-                       }
-
-                       // Native handler
-                       handle = ontype && cur[ ontype ];
-                       if ( handle && handle.apply && acceptData( cur ) ) {
-                               event.result = handle.apply( cur, data );
-                               if ( event.result === false ) {
-                                       event.preventDefault();
-                               }
-                       }
-               }
-               event.type = type;
-
-               // If nobody prevented the default action, do it now
-               if ( !onlyHandlers && !event.isDefaultPrevented() ) {
-
-                       if ( ( !special._default ||
-                               special._default.apply( eventPath.pop(), data ) === false ) &&
-                               acceptData( elem ) ) {
-
-                               // Call a native DOM method on the target with the same name as the event.
-                               // Don't do default actions on window, that's where global variables be (#6170)
-                               if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
-
-                                       // Don't re-trigger an onFOO event when we call its FOO() method
-                                       tmp = elem[ ontype ];
-
-                                       if ( tmp ) {
-                                               elem[ ontype ] = null;
-                                       }
-
-                                       // Prevent re-triggering of the same event, since we already bubbled it above
-                                       jQuery.event.triggered = type;
-                                       elem[ type ]();
-                                       jQuery.event.triggered = undefined;
-
-                                       if ( tmp ) {
-                                               elem[ ontype ] = tmp;
-                                       }
-                               }
-                       }
-               }
-
-               return event.result;
-       },
-
-       // Piggyback on a donor event to simulate a different one
-       // Used only for `focus(in | out)` events
-       simulate: function( type, elem, event ) {
-               var e = jQuery.extend(
-                       new jQuery.Event(),
-                       event,
-                       {
-                               type: type,
-                               isSimulated: true
-                       }
-               );
-
-               jQuery.event.trigger( e, null, elem );
-       }
-
-} );
-
-jQuery.fn.extend( {
-
-       trigger: function( type, data ) {
-               return this.each( function() {
-                       jQuery.event.trigger( type, data, this );
-               } );
-       },
-       triggerHandler: function( type, data ) {
-               var elem = this[ 0 ];
-               if ( elem ) {
-                       return jQuery.event.trigger( type, data, elem, true );
-               }
-       }
-} );
-
-
-jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
        "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
-       "change select submit keydown keypress keyup contextmenu" ).split( " " ),
-       function( i, name ) {
+       "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
 
        // Handle event binding
        jQuery.fn[ name ] = function( data, fn ) {
@@ -8286,80 +7460,54 @@ jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
                        this.on( name, null, data, fn ) :
                        this.trigger( name );
        };
-} );
+});
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        hover: function( fnOver, fnOut ) {
                return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
-       }
-} );
-
-
-
-
-support.focusin = "onfocusin" in window;
-
-
-// Support: Firefox <=44
-// Firefox doesn't have focus(in | out) events
-// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
-//
-// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
-// focus(in | out) events fire after focus & blur events,
-// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
-// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
-if ( !support.focusin ) {
-       jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+       },
 
-               // Attach a single capturing handler on the document while someone wants focusin/focusout
-               var handler = function( event ) {
-                       jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
-               };
+       bind: function( types, data, fn ) {
+               return this.on( types, null, data, fn );
+       },
+       unbind: function( types, fn ) {
+               return this.off( types, null, fn );
+       },
 
-               jQuery.event.special[ fix ] = {
-                       setup: function() {
-                               var doc = this.ownerDocument || this,
-                                       attaches = dataPriv.access( doc, fix );
+       delegate: function( selector, types, data, fn ) {
+               return this.on( types, selector, data, fn );
+       },
+       undelegate: function( selector, types, fn ) {
+               // ( namespace ) or ( selector, types [, fn] )
+               return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+       }
+});
 
-                               if ( !attaches ) {
-                                       doc.addEventListener( orig, handler, true );
-                               }
-                               dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
-                       },
-                       teardown: function() {
-                               var doc = this.ownerDocument || this,
-                                       attaches = dataPriv.access( doc, fix ) - 1;
 
-                               if ( !attaches ) {
-                                       doc.removeEventListener( orig, handler, true );
-                                       dataPriv.remove( doc, fix );
+var nonce = jQuery.now();
 
-                               } else {
-                                       dataPriv.access( doc, fix, attaches );
-                               }
-                       }
-               };
-       } );
-}
-var location = window.location;
+var rquery = (/\?/);
 
-var nonce = jQuery.now();
 
-var rquery = ( /\?/ );
 
+// Support: Android 2.3
+// Workaround failure to string-cast null input
+jQuery.parseJSON = function( data ) {
+       return JSON.parse( data + "" );
+};
 
 
 // Cross-browser xml parsing
 jQuery.parseXML = function( data ) {
-       var xml;
+       var xml, tmp;
        if ( !data || typeof data !== "string" ) {
                return null;
        }
 
-       // Support: IE 9 - 11 only
-       // IE throws on parseFromString with invalid input.
+       // Support: IE9
        try {
-               xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
+               tmp = new DOMParser();
+               xml = tmp.parseFromString( data, "text/xml" );
        } catch ( e ) {
                xml = undefined;
        }
@@ -8372,134 +7520,18 @@ jQuery.parseXML = function( data ) {
 
 
 var
-       rbracket = /\[\]$/,
-       rCRLF = /\r?\n/g,
-       rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
-       rsubmittable = /^(?:input|select|textarea|keygen)/i;
-
-function buildParams( prefix, obj, traditional, add ) {
-       var name;
-
-       if ( Array.isArray( obj ) ) {
-
-               // Serialize array item.
-               jQuery.each( obj, function( i, v ) {
-                       if ( traditional || rbracket.test( prefix ) ) {
-
-                               // Treat each array item as a scalar.
-                               add( prefix, v );
-
-                       } else {
-
-                               // Item is non-scalar (array or object), encode its numeric index.
-                               buildParams(
-                                       prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
-                                       v,
-                                       traditional,
-                                       add
-                               );
-                       }
-               } );
-
-       } else if ( !traditional && jQuery.type( obj ) === "object" ) {
-
-               // Serialize object item.
-               for ( name in obj ) {
-                       buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
-               }
-
-       } else {
+       // Document location
+       ajaxLocParts,
+       ajaxLocation,
 
-               // Serialize scalar item.
-               add( prefix, obj );
-       }
-}
-
-// Serialize an array of form elements or a set of
-// key/values into a query string
-jQuery.param = function( a, traditional ) {
-       var prefix,
-               s = [],
-               add = function( key, valueOrFunction ) {
-
-                       // If value is a function, invoke it and use its return value
-                       var value = jQuery.isFunction( valueOrFunction ) ?
-                               valueOrFunction() :
-                               valueOrFunction;
-
-                       s[ s.length ] = encodeURIComponent( key ) + "=" +
-                               encodeURIComponent( value == null ? "" : value );
-               };
-
-       // If an array was passed in, assume that it is an array of form elements.
-       if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
-
-               // Serialize the form elements
-               jQuery.each( a, function() {
-                       add( this.name, this.value );
-               } );
-
-       } else {
-
-               // If traditional, encode the "old" way (the way 1.3.2 or older
-               // did it), otherwise encode params recursively.
-               for ( prefix in a ) {
-                       buildParams( prefix, a[ prefix ], traditional, add );
-               }
-       }
-
-       // Return the resulting serialization
-       return s.join( "&" );
-};
-
-jQuery.fn.extend( {
-       serialize: function() {
-               return jQuery.param( this.serializeArray() );
-       },
-       serializeArray: function() {
-               return this.map( function() {
-
-                       // Can add propHook for "elements" to filter or add form elements
-                       var elements = jQuery.prop( this, "elements" );
-                       return elements ? jQuery.makeArray( elements ) : this;
-               } )
-               .filter( function() {
-                       var type = this.type;
-
-                       // Use .is( ":disabled" ) so that fieldset[disabled] works
-                       return this.name && !jQuery( this ).is( ":disabled" ) &&
-                               rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
-                               ( this.checked || !rcheckableType.test( type ) );
-               } )
-               .map( function( i, elem ) {
-                       var val = jQuery( this ).val();
-
-                       if ( val == null ) {
-                               return null;
-                       }
-
-                       if ( Array.isArray( val ) ) {
-                               return jQuery.map( val, function( val ) {
-                                       return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
-                               } );
-                       }
-
-                       return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
-               } ).get();
-       }
-} );
-
-
-var
-       r20 = /%20/g,
        rhash = /#.*$/,
-       rantiCache = /([?&])_=[^&]*/,
+       rts = /([?&])_=[^&]*/,
        rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
-
        // #7653, #8125, #8152: local protocol detection
        rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
        rnoContent = /^(?:GET|HEAD)$/,
        rprotocol = /^\/\//,
+       rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
 
        /* Prefilters
         * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
@@ -8520,11 +7552,22 @@ var
        transports = {},
 
        // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
-       allTypes = "*/".concat( "*" ),
+       allTypes = "*/".concat("*");
 
-       // Anchor tag for parsing the document origin
-       originAnchor = document.createElement( "a" );
-       originAnchor.href = location.href;
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+       ajaxLocation = location.href;
+} catch( e ) {
+       // Use the href attribute of an A element
+       // since IE will modify it given document.location
+       ajaxLocation = document.createElement( "a" );
+       ajaxLocation.href = "";
+       ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
 
 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
 function addToPrefiltersOrTransports( structure ) {
@@ -8539,21 +7582,19 @@ function addToPrefiltersOrTransports( structure ) {
 
                var dataType,
                        i = 0,
-                       dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
+                       dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
 
                if ( jQuery.isFunction( func ) ) {
-
                        // For each dataType in the dataTypeExpression
-                       while ( ( dataType = dataTypes[ i++ ] ) ) {
-
+                       while ( (dataType = dataTypes[i++]) ) {
                                // Prepend if requested
-                               if ( dataType[ 0 ] === "+" ) {
+                               if ( dataType[0] === "+" ) {
                                        dataType = dataType.slice( 1 ) || "*";
-                                       ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
+                                       (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
 
                                // Otherwise append
                                } else {
-                                       ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
+                                       (structure[ dataType ] = structure[ dataType ] || []).push( func );
                                }
                        }
                }
@@ -8571,16 +7612,14 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
                inspected[ dataType ] = true;
                jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
                        var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
-                       if ( typeof dataTypeOrTransport === "string" &&
-                               !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
-
+                       if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
                                options.dataTypes.unshift( dataTypeOrTransport );
                                inspect( dataTypeOrTransport );
                                return false;
                        } else if ( seekingTransport ) {
                                return !( selected = dataTypeOrTransport );
                        }
-               } );
+               });
                return selected;
        }
 
@@ -8596,7 +7635,7 @@ function ajaxExtend( target, src ) {
 
        for ( key in src ) {
                if ( src[ key ] !== undefined ) {
-                       ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
+                       ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
                }
        }
        if ( deep ) {
@@ -8620,7 +7659,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
        while ( dataTypes[ 0 ] === "*" ) {
                dataTypes.shift();
                if ( ct === undefined ) {
-                       ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
+                       ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
                }
        }
 
@@ -8638,10 +7677,9 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
        if ( dataTypes[ 0 ] in responses ) {
                finalDataType = dataTypes[ 0 ];
        } else {
-
                // Try convertible dataTypes
                for ( type in responses ) {
-                       if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
+                       if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
                                finalDataType = type;
                                break;
                        }
@@ -8649,7 +7687,6 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
                                firstDataType = type;
                        }
                }
-
                // Or just use first one
                finalDataType = finalDataType || firstDataType;
        }
@@ -8671,7 +7708,6 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
 function ajaxConvert( s, response, jqXHR, isSuccess ) {
        var conv2, current, conv, tmp, prev,
                converters = {},
-
                // Work with a copy of dataTypes in case we need to modify it for conversion
                dataTypes = s.dataTypes.slice();
 
@@ -8701,7 +7737,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
 
                if ( current ) {
 
-                       // There's only work to do if current dataType is non-auto
+               // There's only work to do if current dataType is non-auto
                        if ( current === "*" ) {
 
                                current = prev;
@@ -8724,7 +7760,6 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
                                                        conv = converters[ prev + " " + tmp[ 0 ] ] ||
                                                                converters[ "* " + tmp[ 0 ] ];
                                                        if ( conv ) {
-
                                                                // Condense equivalence converters
                                                                if ( conv === true ) {
                                                                        conv = converters[ conv2 ];
@@ -8744,16 +7779,13 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
                                if ( conv !== true ) {
 
                                        // Unless errors are allowed to bubble, catch and return them
-                                       if ( conv && s.throws ) {
+                                       if ( conv && s[ "throws" ] ) {
                                                response = conv( response );
                                        } else {
                                                try {
                                                        response = conv( response );
                                                } catch ( e ) {
-                                                       return {
-                                                               state: "parsererror",
-                                                               error: conv ? e : "No conversion from " + prev + " to " + current
-                                                       };
+                                                       return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
                                                }
                                        }
                                }
@@ -8764,7 +7796,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
        return { state: "success", data: response };
 }
 
-jQuery.extend( {
+jQuery.extend({
 
        // Counter for holding the number of active queries
        active: 0,
@@ -8774,14 +7806,13 @@ jQuery.extend( {
        etag: {},
 
        ajaxSettings: {
-               url: location.href,
+               url: ajaxLocation,
                type: "GET",
-               isLocal: rlocalProtocol.test( location.protocol ),
+               isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
                global: true,
                processData: true,
                async: true,
                contentType: "application/x-www-form-urlencoded; charset=UTF-8",
-
                /*
                timeout: 0,
                data: null,
@@ -8803,9 +7834,9 @@ jQuery.extend( {
                },
 
                contents: {
-                       xml: /\bxml\b/,
-                       html: /\bhtml/,
-                       json: /\bjson\b/
+                       xml: /xml/,
+                       html: /html/,
+                       json: /json/
                },
 
                responseFields: {
@@ -8825,7 +7856,7 @@ jQuery.extend( {
                        "text html": true,
 
                        // Evaluate text as a json expression
-                       "text json": JSON.parse,
+                       "text json": jQuery.parseJSON,
 
                        // Parse text as xml
                        "text xml": jQuery.parseXML
@@ -8870,58 +7901,39 @@ jQuery.extend( {
                options = options || {};
 
                var transport,
-
                        // URL without anti-cache param
                        cacheURL,
-
                        // Response headers
                        responseHeadersString,
                        responseHeaders,
-
                        // timeout handle
                        timeoutTimer,
-
-                       // Url cleanup var
-                       urlAnchor,
-
-                       // Request state (becomes false upon send and true upon completion)
-                       completed,
-
+                       // Cross-domain detection vars
+                       parts,
                        // To know if global events are to be dispatched
                        fireGlobals,
-
                        // Loop variable
                        i,
-
-                       // uncached part of the url
-                       uncached,
-
                        // Create the final options object
                        s = jQuery.ajaxSetup( {}, options ),
-
                        // Callbacks context
                        callbackContext = s.context || s,
-
                        // Context for global events is callbackContext if it is a DOM node or jQuery collection
-                       globalEventContext = s.context &&
-                               ( callbackContext.nodeType || callbackContext.jquery ) ?
-                                       jQuery( callbackContext ) :
-                                       jQuery.event,
-
+                       globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
+                               jQuery( callbackContext ) :
+                               jQuery.event,
                        // Deferreds
                        deferred = jQuery.Deferred(),
-                       completeDeferred = jQuery.Callbacks( "once memory" ),
-
+                       completeDeferred = jQuery.Callbacks("once memory"),
                        // Status-dependent callbacks
                        statusCode = s.statusCode || {},
-
                        // Headers (they are sent all at once)
                        requestHeaders = {},
                        requestHeadersNames = {},
-
+                       // The jqXHR state
+                       state = 0,
                        // Default abort message
                        strAbort = "canceled",
-
                        // Fake xhr
                        jqXHR = {
                                readyState: 0,
@@ -8929,11 +7941,11 @@ jQuery.extend( {
                                // Builds headers hashtable if needed
                                getResponseHeader: function( key ) {
                                        var match;
-                                       if ( completed ) {
+                                       if ( state === 2 ) {
                                                if ( !responseHeaders ) {
                                                        responseHeaders = {};
-                                                       while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
-                                                               responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
+                                                       while ( (match = rheaders.exec( responseHeadersString )) ) {
+                                                               responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
                                                        }
                                                }
                                                match = responseHeaders[ key.toLowerCase() ];
@@ -8943,14 +7955,14 @@ jQuery.extend( {
 
                                // Raw string
                                getAllResponseHeaders: function() {
-                                       return completed ? responseHeadersString : null;
+                                       return state === 2 ? responseHeadersString : null;
                                },
 
                                // Caches the header
                                setRequestHeader: function( name, value ) {
-                                       if ( completed == null ) {
-                                               name = requestHeadersNames[ name.toLowerCase() ] =
-                                                       requestHeadersNames[ name.toLowerCase() ] || name;
+                                       var lname = name.toLowerCase();
+                                       if ( !state ) {
+                                               name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
                                                requestHeaders[ name ] = value;
                                        }
                                        return this;
@@ -8958,7 +7970,7 @@ jQuery.extend( {
 
                                // Overrides response content-type header
                                overrideMimeType: function( type ) {
-                                       if ( completed == null ) {
+                                       if ( !state ) {
                                                s.mimeType = type;
                                        }
                                        return this;
@@ -8968,16 +7980,14 @@ jQuery.extend( {
                                statusCode: function( map ) {
                                        var code;
                                        if ( map ) {
-                                               if ( completed ) {
-
-                                                       // Execute the appropriate callbacks
-                                                       jqXHR.always( map[ jqXHR.status ] );
-                                               } else {
-
-                                                       // Lazy-add the new callbacks in a way that preserves old ones
+                                               if ( state < 2 ) {
                                                        for ( code in map ) {
+                                                               // Lazy-add the new callback in a way that preserves old ones
                                                                statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
                                                        }
+                                               } else {
+                                                       // Execute the appropriate callbacks
+                                                       jqXHR.always( map[ jqXHR.status ] );
                                                }
                                        }
                                        return this;
@@ -8995,41 +8005,31 @@ jQuery.extend( {
                        };
 
                // Attach deferreds
-               deferred.promise( jqXHR );
+               deferred.promise( jqXHR ).complete = completeDeferred.add;
+               jqXHR.success = jqXHR.done;
+               jqXHR.error = jqXHR.fail;
 
+               // Remove hash character (#7531: and string promotion)
                // Add protocol if not provided (prefilters might expect it)
                // Handle falsy url in the settings object (#10093: consistency with old signature)
                // We also use the url parameter if available
-               s.url = ( ( url || s.url || location.href ) + "" )
-                       .replace( rprotocol, location.protocol + "//" );
+               s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
+                       .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
 
                // Alias method option to type as per ticket #12004
                s.type = options.method || options.type || s.method || s.type;
 
                // Extract dataTypes list
-               s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
+               s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
 
-               // A cross-domain request is in order when the origin doesn't match the current origin.
+               // A cross-domain request is in order when we have a protocol:host:port mismatch
                if ( s.crossDomain == null ) {
-                       urlAnchor = document.createElement( "a" );
-
-                       // Support: IE <=8 - 11, Edge 12 - 13
-                       // IE throws exception on accessing the href property if url is malformed,
-                       // e.g. http://example.com:80x/
-                       try {
-                               urlAnchor.href = s.url;
-
-                               // Support: IE <=8 - 11 only
-                               // Anchor's host property isn't correctly set when s.url is relative
-                               urlAnchor.href = urlAnchor.href;
-                               s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
-                                       urlAnchor.protocol + "//" + urlAnchor.host;
-                       } catch ( e ) {
-
-                               // If there is an error parsing the URL, assume it is crossDomain,
-                               // it can be rejected by the transport if it is invalid
-                               s.crossDomain = true;
-                       }
+                       parts = rurl.exec( s.url.toLowerCase() );
+                       s.crossDomain = !!( parts &&
+                               ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
+                                       ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
+                                               ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
+                       );
                }
 
                // Convert data if not already a string
@@ -9041,17 +8041,16 @@ jQuery.extend( {
                inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
 
                // If request was aborted inside a prefilter, stop there
-               if ( completed ) {
+               if ( state === 2 ) {
                        return jqXHR;
                }
 
                // We can fire global events as of now if asked to
-               // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
-               fireGlobals = jQuery.event && s.global;
+               fireGlobals = s.global;
 
                // Watch for a new set of requests
                if ( fireGlobals && jQuery.active++ === 0 ) {
-                       jQuery.event.trigger( "ajaxStart" );
+                       jQuery.event.trigger("ajaxStart");
                }
 
                // Uppercase the type
@@ -9062,36 +8061,28 @@ jQuery.extend( {
 
                // Save the URL in case we're toying with the If-Modified-Since
                // and/or If-None-Match header later on
-               // Remove hash to simplify url manipulation
-               cacheURL = s.url.replace( rhash, "" );
+               cacheURL = s.url;
 
                // More options handling for requests with no content
                if ( !s.hasContent ) {
 
-                       // Remember the hash so we can put it back
-                       uncached = s.url.slice( cacheURL.length );
-
                        // If data is available, append data to url
                        if ( s.data ) {
-                               cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
-
+                               cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
                                // #9682: remove data so that it's not used in an eventual retry
                                delete s.data;
                        }
 
-                       // Add or update anti-cache param if needed
+                       // Add anti-cache in url if needed
                        if ( s.cache === false ) {
-                               cacheURL = cacheURL.replace( rantiCache, "$1" );
-                               uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
-                       }
+                               s.url = rts.test( cacheURL ) ?
 
-                       // Put hash and anti-cache on the URL that will be requested (gh-1732)
-                       s.url = cacheURL + uncached;
+                                       // If there is already a '_' parameter, set its value
+                                       cacheURL.replace( rts, "$1_=" + nonce++ ) :
 
-               // Change '%20' to '+' if this is encoded form body content (gh-2658)
-               } else if ( s.data && s.processData &&
-                       ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
-                       s.data = s.data.replace( r20, "+" );
+                                       // Otherwise add one to the end
+                                       cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
+                       }
                }
 
                // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
@@ -9112,9 +8103,8 @@ jQuery.extend( {
                // Set the Accepts header for the server, depending on the dataType
                jqXHR.setRequestHeader(
                        "Accept",
-                       s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
-                               s.accepts[ s.dataTypes[ 0 ] ] +
-                                       ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+                       s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+                               s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
                                s.accepts[ "*" ]
                );
 
@@ -9124,20 +8114,18 @@ jQuery.extend( {
                }
 
                // Allow custom headers/mimetypes and early abort
-               if ( s.beforeSend &&
-                       ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
-
+               if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
                        // Abort if not done already and return
                        return jqXHR.abort();
                }
 
-               // Aborting is no longer a cancellation
+               // aborting is no longer a cancellation
                strAbort = "abort";
 
                // Install callbacks on deferreds
-               completeDeferred.add( s.complete );
-               jqXHR.done( s.success );
-               jqXHR.fail( s.error );
+               for ( i in { success: 1, error: 1, complete: 1 } ) {
+                       jqXHR[ i ]( s[ i ] );
+               }
 
                // Get transport
                transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
@@ -9152,31 +8140,24 @@ jQuery.extend( {
                        if ( fireGlobals ) {
                                globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
                        }
-
-                       // If request was aborted inside ajaxSend, stop there
-                       if ( completed ) {
-                               return jqXHR;
-                       }
-
                        // Timeout
                        if ( s.async && s.timeout > 0 ) {
-                               timeoutTimer = window.setTimeout( function() {
-                                       jqXHR.abort( "timeout" );
+                               timeoutTimer = setTimeout(function() {
+                                       jqXHR.abort("timeout");
                                }, s.timeout );
                        }
 
                        try {
-                               completed = false;
+                               state = 1;
                                transport.send( requestHeaders, done );
                        } catch ( e ) {
-
-                               // Rethrow post-completion exceptions
-                               if ( completed ) {
+                               // Propagate exception as error if not done
+                               if ( state < 2 ) {
+                                       done( -1, e );
+                               // Simply rethrow otherwise
+                               } else {
                                        throw e;
                                }
-
-                               // Propagate others as results
-                               done( -1, e );
                        }
                }
 
@@ -9185,16 +8166,17 @@ jQuery.extend( {
                        var isSuccess, success, error, response, modified,
                                statusText = nativeStatusText;
 
-                       // Ignore repeat invocations
-                       if ( completed ) {
+                       // Called once
+                       if ( state === 2 ) {
                                return;
                        }
 
-                       completed = true;
+                       // State is "done" now
+                       state = 2;
 
                        // Clear timeout if it exists
                        if ( timeoutTimer ) {
-                               window.clearTimeout( timeoutTimer );
+                               clearTimeout( timeoutTimer );
                        }
 
                        // Dereference transport for early garbage collection
@@ -9223,11 +8205,11 @@ jQuery.extend( {
 
                                // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
                                if ( s.ifModified ) {
-                                       modified = jqXHR.getResponseHeader( "Last-Modified" );
+                                       modified = jqXHR.getResponseHeader("Last-Modified");
                                        if ( modified ) {
                                                jQuery.lastModified[ cacheURL ] = modified;
                                        }
-                                       modified = jqXHR.getResponseHeader( "etag" );
+                                       modified = jqXHR.getResponseHeader("etag");
                                        if ( modified ) {
                                                jQuery.etag[ cacheURL ] = modified;
                                        }
@@ -9249,8 +8231,8 @@ jQuery.extend( {
                                        isSuccess = !error;
                                }
                        } else {
-
-                               // Extract error from statusText and normalize for non-aborts
+                               // We extract error from statusText
+                               // then normalize statusText and status for non-aborts
                                error = statusText;
                                if ( status || !statusText ) {
                                        statusText = "error";
@@ -9285,10 +8267,9 @@ jQuery.extend( {
 
                        if ( fireGlobals ) {
                                globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
-
                                // Handle the global AJAX counter
                                if ( !( --jQuery.active ) ) {
-                                       jQuery.event.trigger( "ajaxStop" );
+                                       jQuery.event.trigger("ajaxStop");
                                }
                        }
                }
@@ -9303,53 +8284,58 @@ jQuery.extend( {
        getScript: function( url, callback ) {
                return jQuery.get( url, undefined, callback, "script" );
        }
-} );
+});
 
 jQuery.each( [ "get", "post" ], function( i, method ) {
        jQuery[ method ] = function( url, data, callback, type ) {
-
-               // Shift arguments if data argument was omitted
+               // shift arguments if data argument was omitted
                if ( jQuery.isFunction( data ) ) {
                        type = type || callback;
                        callback = data;
                        data = undefined;
                }
 
-               // The url can be an options object (which then must have .url)
-               return jQuery.ajax( jQuery.extend( {
+               return jQuery.ajax({
                        url: url,
                        type: method,
                        dataType: type,
                        data: data,
                        success: callback
-               }, jQuery.isPlainObject( url ) && url ) );
+               });
        };
-} );
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
+       jQuery.fn[ type ] = function( fn ) {
+               return this.on( type, fn );
+       };
+});
 
 
 jQuery._evalUrl = function( url ) {
-       return jQuery.ajax( {
+       return jQuery.ajax({
                url: url,
-
-               // Make this explicit, since user can override this through ajaxSetup (#11264)
                type: "GET",
                dataType: "script",
-               cache: true,
                async: false,
                global: false,
                "throws": true
-       } );
+       });
 };
 
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        wrapAll: function( html ) {
                var wrap;
 
+               if ( jQuery.isFunction( html ) ) {
+                       return this.each(function( i ) {
+                               jQuery( this ).wrapAll( html.call(this, i) );
+                       });
+               }
+
                if ( this[ 0 ] ) {
-                       if ( jQuery.isFunction( html ) ) {
-                               html = html.call( this[ 0 ] );
-                       }
 
                        // The elements to wrap the target around
                        wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
@@ -9358,7 +8344,7 @@ jQuery.fn.extend( {
                                wrap.insertBefore( this[ 0 ] );
                        }
 
-                       wrap.map( function() {
+                       wrap.map(function() {
                                var elem = this;
 
                                while ( elem.firstElementChild ) {
@@ -9366,7 +8352,7 @@ jQuery.fn.extend( {
                                }
 
                                return elem;
-                       } ).append( this );
+                       }).append( this );
                }
 
                return this;
@@ -9374,12 +8360,12 @@ jQuery.fn.extend( {
 
        wrapInner: function( html ) {
                if ( jQuery.isFunction( html ) ) {
-                       return this.each( function( i ) {
-                               jQuery( this ).wrapInner( html.call( this, i ) );
-                       } );
+                       return this.each(function( i ) {
+                               jQuery( this ).wrapInner( html.call(this, i) );
+                       });
                }
 
-               return this.each( function() {
+               return this.each(function() {
                        var self = jQuery( this ),
                                contents = self.contents();
 
@@ -9389,73 +8375,183 @@ jQuery.fn.extend( {
                        } else {
                                self.append( html );
                        }
-               } );
+               });
        },
 
        wrap: function( html ) {
                var isFunction = jQuery.isFunction( html );
 
-               return this.each( function( i ) {
-                       jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
-               } );
+               return this.each(function( i ) {
+                       jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+               });
        },
 
-       unwrap: function( selector ) {
-               this.parent( selector ).not( "body" ).each( function() {
-                       jQuery( this ).replaceWith( this.childNodes );
-               } );
-               return this;
+       unwrap: function() {
+               return this.parent().each(function() {
+                       if ( !jQuery.nodeName( this, "body" ) ) {
+                               jQuery( this ).replaceWith( this.childNodes );
+                       }
+               }).end();
        }
-} );
+});
 
 
-jQuery.expr.pseudos.hidden = function( elem ) {
-       return !jQuery.expr.pseudos.visible( elem );
+jQuery.expr.filters.hidden = function( elem ) {
+       // Support: Opera <= 12.12
+       // Opera reports offsetWidths and offsetHeights less than zero on some elements
+       return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
 };
-jQuery.expr.pseudos.visible = function( elem ) {
-       return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
+jQuery.expr.filters.visible = function( elem ) {
+       return !jQuery.expr.filters.hidden( elem );
 };
 
 
 
 
+var r20 = /%20/g,
+       rbracket = /\[\]$/,
+       rCRLF = /\r?\n/g,
+       rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
+       rsubmittable = /^(?:input|select|textarea|keygen)/i;
+
+function buildParams( prefix, obj, traditional, add ) {
+       var name;
+
+       if ( jQuery.isArray( obj ) ) {
+               // Serialize array item.
+               jQuery.each( obj, function( i, v ) {
+                       if ( traditional || rbracket.test( prefix ) ) {
+                               // Treat each array item as a scalar.
+                               add( prefix, v );
+
+                       } else {
+                               // Item is non-scalar (array or object), encode its numeric index.
+                               buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+                       }
+               });
+
+       } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+               // Serialize object item.
+               for ( name in obj ) {
+                       buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+               }
+
+       } else {
+               // Serialize scalar item.
+               add( prefix, obj );
+       }
+}
+
+// Serialize an array of form elements or a set of
+// key/values into a query string
+jQuery.param = function( a, traditional ) {
+       var prefix,
+               s = [],
+               add = function( key, value ) {
+                       // If value is a function, invoke it and return its value
+                       value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
+                       s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+               };
+
+       // Set traditional to true for jQuery <= 1.3.2 behavior.
+       if ( traditional === undefined ) {
+               traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
+       }
+
+       // If an array was passed in, assume that it is an array of form elements.
+       if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+               // Serialize the form elements
+               jQuery.each( a, function() {
+                       add( this.name, this.value );
+               });
+
+       } else {
+               // If traditional, encode the "old" way (the way 1.3.2 or older
+               // did it), otherwise encode params recursively.
+               for ( prefix in a ) {
+                       buildParams( prefix, a[ prefix ], traditional, add );
+               }
+       }
+
+       // Return the resulting serialization
+       return s.join( "&" ).replace( r20, "+" );
+};
+
+jQuery.fn.extend({
+       serialize: function() {
+               return jQuery.param( this.serializeArray() );
+       },
+       serializeArray: function() {
+               return this.map(function() {
+                       // Can add propHook for "elements" to filter or add form elements
+                       var elements = jQuery.prop( this, "elements" );
+                       return elements ? jQuery.makeArray( elements ) : this;
+               })
+               .filter(function() {
+                       var type = this.type;
+
+                       // Use .is( ":disabled" ) so that fieldset[disabled] works
+                       return this.name && !jQuery( this ).is( ":disabled" ) &&
+                               rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
+                               ( this.checked || !rcheckableType.test( type ) );
+               })
+               .map(function( i, elem ) {
+                       var val = jQuery( this ).val();
+
+                       return val == null ?
+                               null :
+                               jQuery.isArray( val ) ?
+                                       jQuery.map( val, function( val ) {
+                                               return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+                                       }) :
+                                       { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+               }).get();
+       }
+});
+
+
 jQuery.ajaxSettings.xhr = function() {
        try {
-               return new window.XMLHttpRequest();
-       } catch ( e ) {}
+               return new XMLHttpRequest();
+       } catch( e ) {}
 };
 
-var xhrSuccessStatus = {
-
-               // File protocol always yields status code 0, assume 200
+var xhrId = 0,
+       xhrCallbacks = {},
+       xhrSuccessStatus = {
+               // file protocol always yields status code 0, assume 200
                0: 200,
-
-               // Support: IE <=9 only
+               // Support: IE9
                // #1450: sometimes IE returns 1223 when it should be 204
                1223: 204
        },
        xhrSupported = jQuery.ajaxSettings.xhr();
 
+// Support: IE9
+// Open requests must be manually aborted on unload (#5280)
+if ( window.ActiveXObject ) {
+       jQuery( window ).on( "unload", function() {
+               for ( var key in xhrCallbacks ) {
+                       xhrCallbacks[ key ]();
+               }
+       });
+}
+
 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
 support.ajax = xhrSupported = !!xhrSupported;
 
-jQuery.ajaxTransport( function( options ) {
-       var callback, errorCallback;
+jQuery.ajaxTransport(function( options ) {
+       var callback;
 
        // Cross domain only allowed if supported through XMLHttpRequest
        if ( support.cors || xhrSupported && !options.crossDomain ) {
                return {
                        send: function( headers, complete ) {
                                var i,
-                                       xhr = options.xhr();
-
-                               xhr.open(
-                                       options.type,
-                                       options.url,
-                                       options.async,
-                                       options.username,
-                                       options.password
-                               );
+                                       xhr = options.xhr(),
+                                       id = ++xhrId;
+
+                               xhr.open( options.type, options.url, options.async, options.username, options.password );
 
                                // Apply custom fields if provided
                                if ( options.xhrFields ) {
@@ -9474,8 +8570,8 @@ jQuery.ajaxTransport( function( options ) {
                                // akin to a jigsaw puzzle, we simply never set it to be sure.
                                // (it can always be set on a per-request basis or even using ajaxSetup)
                                // For same-domain requests, won't change header if already provided.
-                               if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
-                                       headers[ "X-Requested-With" ] = "XMLHttpRequest";
+                               if ( !options.crossDomain && !headers["X-Requested-With"] ) {
+                                       headers["X-Requested-With"] = "XMLHttpRequest";
                                }
 
                                // Set headers
@@ -9487,38 +8583,27 @@ jQuery.ajaxTransport( function( options ) {
                                callback = function( type ) {
                                        return function() {
                                                if ( callback ) {
-                                                       callback = errorCallback = xhr.onload =
-                                                               xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
+                                                       delete xhrCallbacks[ id ];
+                                                       callback = xhr.onload = xhr.onerror = null;
 
                                                        if ( type === "abort" ) {
                                                                xhr.abort();
                                                        } else if ( type === "error" ) {
-
-                                                               // Support: IE <=9 only
-                                                               // On a manual native abort, IE9 throws
-                                                               // errors on any property access that is not readyState
-                                                               if ( typeof xhr.status !== "number" ) {
-                                                                       complete( 0, "error" );
-                                                               } else {
-                                                                       complete(
-
-                                                                               // File: protocol always yields status 0; see #8605, #14207
-                                                                               xhr.status,
-                                                                               xhr.statusText
-                                                                       );
-                                                               }
+                                                               complete(
+                                                                       // file: protocol always yields status 0; see #8605, #14207
+                                                                       xhr.status,
+                                                                       xhr.statusText
+                                                               );
                                                        } else {
                                                                complete(
                                                                        xhrSuccessStatus[ xhr.status ] || xhr.status,
                                                                        xhr.statusText,
-
-                                                                       // Support: IE <=9 only
-                                                                       // IE9 has no XHR2 but throws on binary (trac-11426)
-                                                                       // For XHR2 non-text, let the caller handle it (gh-2498)
-                                                                       ( xhr.responseType || "text" ) !== "text"  ||
-                                                                       typeof xhr.responseText !== "string" ?
-                                                                               { binary: xhr.response } :
-                                                                               { text: xhr.responseText },
+                                                                       // Support: IE9
+                                                                       // Accessing binary-data responseText throws an exception
+                                                                       // (#11426)
+                                                                       typeof xhr.responseText === "string" ? {
+                                                                               text: xhr.responseText
+                                                                       } : undefined,
                                                                        xhr.getAllResponseHeaders()
                                                                );
                                                        }
@@ -9528,41 +8613,15 @@ jQuery.ajaxTransport( function( options ) {
 
                                // Listen to events
                                xhr.onload = callback();
-                               errorCallback = xhr.onerror = callback( "error" );
-
-                               // Support: IE 9 only
-                               // Use onreadystatechange to replace onabort
-                               // to handle uncaught aborts
-                               if ( xhr.onabort !== undefined ) {
-                                       xhr.onabort = errorCallback;
-                               } else {
-                                       xhr.onreadystatechange = function() {
-
-                                               // Check readyState before timeout as it changes
-                                               if ( xhr.readyState === 4 ) {
-
-                                                       // Allow onerror to be called first,
-                                                       // but that will not handle a native abort
-                                                       // Also, save errorCallback to a variable
-                                                       // as xhr.onerror cannot be accessed
-                                                       window.setTimeout( function() {
-                                                               if ( callback ) {
-                                                                       errorCallback();
-                                                               }
-                                                       } );
-                                               }
-                                       };
-                               }
+                               xhr.onerror = callback("error");
 
                                // Create the abort callback
-                               callback = callback( "abort" );
+                               callback = xhrCallbacks[ id ] = callback("abort");
 
                                try {
-
                                        // Do send the request (this may raise an exception)
                                        xhr.send( options.hasContent && options.data || null );
                                } catch ( e ) {
-
                                        // #14683: Only rethrow if this hasn't been notified as an error yet
                                        if ( callback ) {
                                                throw e;
@@ -9577,26 +8636,18 @@ jQuery.ajaxTransport( function( options ) {
                        }
                };
        }
-} );
+});
 
 
 
 
-// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
-jQuery.ajaxPrefilter( function( s ) {
-       if ( s.crossDomain ) {
-               s.contents.script = false;
-       }
-} );
-
 // Install script dataType
-jQuery.ajaxSetup( {
+jQuery.ajaxSetup({
        accepts: {
-               script: "text/javascript, application/javascript, " +
-                       "application/ecmascript, application/x-ecmascript"
+               script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
        },
        contents: {
-               script: /\b(?:java|ecma)script\b/
+               script: /(?:java|ecma)script/
        },
        converters: {
                "text script": function( text ) {
@@ -9604,7 +8655,7 @@ jQuery.ajaxSetup( {
                        return text;
                }
        }
-} );
+});
 
 // Handle cache's special case and crossDomain
 jQuery.ajaxPrefilter( "script", function( s ) {
@@ -9614,20 +8665,20 @@ jQuery.ajaxPrefilter( "script", function( s ) {
        if ( s.crossDomain ) {
                s.type = "GET";
        }
-} );
+});
 
 // Bind script tag hack transport
 jQuery.ajaxTransport( "script", function( s ) {
-
        // This transport only deals with cross domain requests
        if ( s.crossDomain ) {
                var script, callback;
                return {
                        send: function( _, complete ) {
-                               script = jQuery( "<script>" ).prop( {
+                               script = jQuery("<script>").prop({
+                                       async: true,
                                        charset: s.scriptCharset,
                                        src: s.url
-                               } ).on(
+                               }).on(
                                        "load error",
                                        callback = function( evt ) {
                                                script.remove();
@@ -9637,8 +8688,6 @@ jQuery.ajaxTransport( "script", function( s ) {
                                                }
                                        }
                                );
-
-                               // Use native DOM manipulation to avoid our domManip AJAX trickery
                                document.head.appendChild( script[ 0 ] );
                        },
                        abort: function() {
@@ -9648,7 +8697,7 @@ jQuery.ajaxTransport( "script", function( s ) {
                        }
                };
        }
-} );
+});
 
 
 
@@ -9657,14 +8706,14 @@ var oldCallbacks = [],
        rjsonp = /(=)\?(?=&|$)|\?\?/;
 
 // Default jsonp settings
-jQuery.ajaxSetup( {
+jQuery.ajaxSetup({
        jsonp: "callback",
        jsonpCallback: function() {
                var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
                this[ callback ] = true;
                return callback;
        }
-} );
+});
 
 // Detect, normalize options and install callbacks for jsonp requests
 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
@@ -9672,10 +8721,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
        var callbackName, overwritten, responseContainer,
                jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
                        "url" :
-                       typeof s.data === "string" &&
-                               ( s.contentType || "" )
-                                       .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
-                               rjsonp.test( s.data ) && "data"
+                       typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
                );
 
        // Handle iff the expected data type is "jsonp" or we have a parameter to set
@@ -9694,14 +8740,14 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
                }
 
                // Use data converter to retrieve json after script execution
-               s.converters[ "script json" ] = function() {
+               s.converters["script json"] = function() {
                        if ( !responseContainer ) {
                                jQuery.error( callbackName + " was not called" );
                        }
                        return responseContainer[ 0 ];
                };
 
-               // Force json dataType
+               // force json dataType
                s.dataTypes[ 0 ] = "json";
 
                // Install callback
@@ -9711,24 +8757,16 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
                };
 
                // Clean-up function (fires after converters)
-               jqXHR.always( function() {
-
-                       // If previous value didn't exist - remove it
-                       if ( overwritten === undefined ) {
-                               jQuery( window ).removeProp( callbackName );
-
-                       // Otherwise restore preexisting value
-                       } else {
-                               window[ callbackName ] = overwritten;
-                       }
+               jqXHR.always(function() {
+                       // Restore preexisting value
+                       window[ callbackName ] = overwritten;
 
                        // Save back as free
                        if ( s[ callbackName ] ) {
-
-                               // Make sure that re-using the options doesn't screw things around
+                               // make sure that re-using the options doesn't screw things around
                                s.jsonpCallback = originalSettings.jsonpCallback;
 
-                               // Save the callback name for future use
+                               // save the callback name for future use
                                oldCallbacks.push( callbackName );
                        }
 
@@ -9738,70 +8776,38 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
                        }
 
                        responseContainer = overwritten = undefined;
-               } );
+               });
 
                // Delegate to script
                return "script";
        }
-} );
-
-
+});
 
 
-// Support: Safari 8 only
-// In Safari 8 documents created via document.implementation.createHTMLDocument
-// collapse sibling forms: the second one becomes a child of the first one.
-// Because of that, this security measure has to be disabled in Safari 8.
-// https://bugs.webkit.org/show_bug.cgi?id=137337
-support.createHTMLDocument = ( function() {
-       var body = document.implementation.createHTMLDocument( "" ).body;
-       body.innerHTML = "<form></form><form></form>";
-       return body.childNodes.length === 2;
-} )();
 
 
-// Argument "data" should be string of html
-// context (optional): If specified, the fragment will be created in this context,
-// defaults to document
+// data: string of html
+// context (optional): If specified, the fragment will be created in this context, defaults to document
 // keepScripts (optional): If true, will include scripts passed in the html string
 jQuery.parseHTML = function( data, context, keepScripts ) {
-       if ( typeof data !== "string" ) {
-               return [];
+       if ( !data || typeof data !== "string" ) {
+               return null;
        }
        if ( typeof context === "boolean" ) {
                keepScripts = context;
                context = false;
        }
+       context = context || document;
 
-       var base, parsed, scripts;
-
-       if ( !context ) {
-
-               // Stop scripts or inline event handlers from being executed immediately
-               // by using document.implementation
-               if ( support.createHTMLDocument ) {
-                       context = document.implementation.createHTMLDocument( "" );
-
-                       // Set the base href for the created document
-                       // so any parsed elements with URLs
-                       // are based on the document's URL (gh-2965)
-                       base = context.createElement( "base" );
-                       base.href = document.location.href;
-                       context.head.appendChild( base );
-               } else {
-                       context = document;
-               }
-       }
-
-       parsed = rsingleTag.exec( data );
-       scripts = !keepScripts && [];
+       var parsed = rsingleTag.exec( data ),
+               scripts = !keepScripts && [];
 
        // Single tag
        if ( parsed ) {
-               return [ context.createElement( parsed[ 1 ] ) ];
+               return [ context.createElement( parsed[1] ) ];
        }
 
-       parsed = buildFragment( [ data ], context, scripts );
+       parsed = jQuery.buildFragment( [ data ], context, scripts );
 
        if ( scripts && scripts.length ) {
                jQuery( scripts ).remove();
@@ -9811,16 +8817,23 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
 };
 
 
+// Keep a copy of the old load method
+var _load = jQuery.fn.load;
+
 /**
  * Load a url into a page
  */
 jQuery.fn.load = function( url, params, callback ) {
+       if ( typeof url !== "string" && _load ) {
+               return _load.apply( this, arguments );
+       }
+
        var selector, type, response,
                self = this,
-               off = url.indexOf( " " );
+               off = url.indexOf(" ");
 
-       if ( off > -1 ) {
-               selector = stripAndCollapse( url.slice( off ) );
+       if ( off >= 0 ) {
+               selector = jQuery.trim( url.slice( off ) );
                url = url.slice( 0, off );
        }
 
@@ -9838,16 +8851,14 @@ jQuery.fn.load = function( url, params, callback ) {
 
        // If we have elements to modify, make the request
        if ( self.length > 0 ) {
-               jQuery.ajax( {
+               jQuery.ajax({
                        url: url,
 
-                       // If "type" variable is undefined, then "GET" method will be used.
-                       // Make value of this field explicit since
-                       // user can override it through ajaxSetup method
-                       type: type || "GET",
+                       // if "type" variable is undefined, then "GET" method will be used
+                       type: type,
                        dataType: "html",
                        data: params
-               } ).done( function( responseText ) {
+               }).done(function( responseText ) {
 
                        // Save response for use in complete callback
                        response = arguments;
@@ -9856,19 +8867,14 @@ jQuery.fn.load = function( url, params, callback ) {
 
                                // If a selector was specified, locate the right elements in a dummy div
                                // Exclude scripts to avoid IE 'Permission Denied' errors
-                               jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
+                               jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
 
                                // Otherwise use the full result
                                responseText );
 
-               // If the request succeeds, this function gets "data", "status", "jqXHR"
-               // but they are ignored because response was set above.
-               // If it fails, this function gets "jqXHR", "status", "error"
-               } ).always( callback && function( jqXHR, status ) {
-                       self.each( function() {
-                               callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
-                       } );
-               } );
+               }).complete( callback && function( jqXHR, status ) {
+                       self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
+               });
        }
 
        return this;
@@ -9877,32 +8883,24 @@ jQuery.fn.load = function( url, params, callback ) {
 
 
 
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( [
-       "ajaxStart",
-       "ajaxStop",
-       "ajaxComplete",
-       "ajaxError",
-       "ajaxSuccess",
-       "ajaxSend"
-], function( i, type ) {
-       jQuery.fn[ type ] = function( fn ) {
-               return this.on( type, fn );
-       };
-} );
-
-
-
-
-jQuery.expr.pseudos.animated = function( elem ) {
-       return jQuery.grep( jQuery.timers, function( fn ) {
+jQuery.expr.filters.animated = function( elem ) {
+       return jQuery.grep(jQuery.timers, function( fn ) {
                return elem === fn.elem;
-       } ).length;
+       }).length;
 };
 
 
 
 
+var docElem = window.document.documentElement;
+
+/**
+ * Gets a window from an element
+ */
+function getWindow( elem ) {
+       return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
+}
+
 jQuery.offset = {
        setOffset: function( elem, options, i ) {
                var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
@@ -9919,10 +8917,9 @@ jQuery.offset = {
                curCSSTop = jQuery.css( elem, "top" );
                curCSSLeft = jQuery.css( elem, "left" );
                calculatePosition = ( position === "absolute" || position === "fixed" ) &&
-                       ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
+                       ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
 
-               // Need to be able to calculate position if either
-               // top or left is auto and position is either absolute or fixed
+               // Need to be able to calculate position if either top or left is auto and position is either absolute or fixed
                if ( calculatePosition ) {
                        curPosition = curElem.position();
                        curTop = curPosition.top;
@@ -9934,9 +8931,7 @@ jQuery.offset = {
                }
 
                if ( jQuery.isFunction( options ) ) {
-
-                       // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
-                       options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
+                       options = options.call( elem, i, curOffset );
                }
 
                if ( options.top != null ) {
@@ -9955,42 +8950,41 @@ jQuery.offset = {
        }
 };
 
-jQuery.fn.extend( {
+jQuery.fn.extend({
        offset: function( options ) {
-
-               // Preserve chaining for setter
                if ( arguments.length ) {
                        return options === undefined ?
                                this :
-                               this.each( function( i ) {
+                               this.each(function( i ) {
                                        jQuery.offset.setOffset( this, options, i );
-                               } );
+                               });
                }
 
-               var doc, docElem, rect, win,
-                       elem = this[ 0 ];
+               var docElem, win,
+                       elem = this[ 0 ],
+                       box = { top: 0, left: 0 },
+                       doc = elem && elem.ownerDocument;
 
-               if ( !elem ) {
+               if ( !doc ) {
                        return;
                }
 
-               // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
-               // Support: IE <=11 only
-               // Running getBoundingClientRect on a
-               // disconnected node in IE throws an error
-               if ( !elem.getClientRects().length ) {
-                       return { top: 0, left: 0 };
-               }
-
-               rect = elem.getBoundingClientRect();
-
-               doc = elem.ownerDocument;
                docElem = doc.documentElement;
-               win = doc.defaultView;
 
+               // Make sure it's not a disconnected DOM node
+               if ( !jQuery.contains( docElem, elem ) ) {
+                       return box;
+               }
+
+               // If we don't have gBCR, just use 0,0 rather than error
+               // BlackBerry 5, iOS 3 (original iPhone)
+               if ( typeof elem.getBoundingClientRect !== strundefined ) {
+                       box = elem.getBoundingClientRect();
+               }
+               win = getWindow( doc );
                return {
-                       top: rect.top + win.pageYOffset - docElem.clientTop,
-                       left: rect.left + win.pageXOffset - docElem.clientLeft
+                       top: box.top + win.pageYOffset - docElem.clientTop,
+                       left: box.left + win.pageXOffset - docElem.clientLeft
                };
        },
 
@@ -10003,29 +8997,24 @@ jQuery.fn.extend( {
                        elem = this[ 0 ],
                        parentOffset = { top: 0, left: 0 };
 
-               // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
-               // because it is its only offset parent
+               // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
                if ( jQuery.css( elem, "position" ) === "fixed" ) {
-
-                       // Assume getBoundingClientRect is there when computed position is fixed
+                       // We assume that getBoundingClientRect is available when computed position is fixed
                        offset = elem.getBoundingClientRect();
 
                } else {
-
                        // Get *real* offsetParent
                        offsetParent = this.offsetParent();
 
                        // Get correct offsets
                        offset = this.offset();
-                       if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
+                       if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
                                parentOffset = offsetParent.offset();
                        }
 
                        // Add offsetParent borders
-                       parentOffset = {
-                               top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
-                               left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
-                       };
+                       parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
+                       parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
                }
 
                // Subtract parent offsets and element margins
@@ -10035,28 +9024,18 @@ jQuery.fn.extend( {
                };
        },
 
-       // This method will return documentElement in the following cases:
-       // 1) For the element inside the iframe without offsetParent, this method will return
-       //    documentElement of the parent window
-       // 2) For the hidden or detached element
-       // 3) For body or html element, i.e. in case of the html node - it will return itself
-       //
-       // but those exceptions were never presented as a real life use-cases
-       // and might be considered as more preferable results.
-       //
-       // This logic, however, is not guaranteed and can change at any point in the future
        offsetParent: function() {
-               return this.map( function() {
-                       var offsetParent = this.offsetParent;
+               return this.map(function() {
+                       var offsetParent = this.offsetParent || docElem;
 
-                       while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
+                       while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
                                offsetParent = offsetParent.offsetParent;
                        }
 
-                       return offsetParent || documentElement;
-               } );
+                       return offsetParent || docElem;
+               });
        }
-} );
+});
 
 // Create scrollLeft and scrollTop methods
 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
@@ -10064,14 +9043,7 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
 
        jQuery.fn[ method ] = function( val ) {
                return access( this, function( elem, method, val ) {
-
-                       // Coalesce documents and windows
-                       var win;
-                       if ( jQuery.isWindow( elem ) ) {
-                               win = elem;
-                       } else if ( elem.nodeType === 9 ) {
-                               win = elem.defaultView;
-                       }
+                       var win = getWindow( elem );
 
                        if ( val === undefined ) {
                                return win ? win[ prop ] : elem[ method ];
@@ -10079,45 +9051,40 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
 
                        if ( win ) {
                                win.scrollTo(
-                                       !top ? val : win.pageXOffset,
-                                       top ? val : win.pageYOffset
+                                       !top ? val : window.pageXOffset,
+                                       top ? val : window.pageYOffset
                                );
 
                        } else {
                                elem[ method ] = val;
                        }
-               }, method, val, arguments.length );
+               }, method, val, arguments.length, null );
        };
-} );
+});
 
-// Support: Safari <=7 - 9.1, Chrome <=37 - 49
 // Add the top/left cssHooks using jQuery.fn.position
 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
-// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
-// getComputedStyle returns percent when specified for top/left/bottom/right;
-// rather than make the css module depend on the offset module, just check for it here
+// getComputedStyle returns percent when specified for top/left/bottom/right
+// rather than make the css module depend on the offset module, we just check for it here
 jQuery.each( [ "top", "left" ], function( i, prop ) {
        jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
                function( elem, computed ) {
                        if ( computed ) {
                                computed = curCSS( elem, prop );
-
-                               // If curCSS returns percentage, fallback to offset
+                               // if curCSS returns percentage, fallback to offset
                                return rnumnonpx.test( computed ) ?
                                        jQuery( elem ).position()[ prop ] + "px" :
                                        computed;
                        }
                }
        );
-} );
+});
 
 
 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
-       jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
-               function( defaultExtra, funcName ) {
-
-               // Margin is only for outerHeight, outerWidth
+       jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+               // margin is only for outerHeight, outerWidth
                jQuery.fn[ funcName ] = function( margin, value ) {
                        var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
                                extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
@@ -10126,11 +9093,10 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
                                var doc;
 
                                if ( jQuery.isWindow( elem ) ) {
-
-                                       // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
-                                       return funcName.indexOf( "outer" ) === 0 ?
-                                               elem[ "inner" + name ] :
-                                               elem.document.documentElement[ "client" + name ];
+                                       // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
+                                       // isn't a whole lot we can do. See pull request at this URL for discussion:
+                                       // https://github.com/jquery/jquery/pull/764
+                                       return elem.document.documentElement[ "client" + name ];
                                }
 
                                // Get document width or height
@@ -10147,49 +9113,23 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
                                }
 
                                return value === undefined ?
-
                                        // Get width or height on the element, requesting but not forcing parseFloat
                                        jQuery.css( elem, type, extra ) :
 
                                        // Set width or height on the element
                                        jQuery.style( elem, type, value, extra );
-                       }, type, chainable ? margin : undefined, chainable );
+                       }, type, chainable ? margin : undefined, chainable, null );
                };
-       } );
-} );
-
-
-jQuery.fn.extend( {
-
-       bind: function( types, data, fn ) {
-               return this.on( types, null, data, fn );
-       },
-       unbind: function( types, fn ) {
-               return this.off( types, null, fn );
-       },
+       });
+});
 
-       delegate: function( selector, types, data, fn ) {
-               return this.on( types, selector, data, fn );
-       },
-       undelegate: function( selector, types, fn ) {
 
-               // ( namespace ) or ( selector, types [, fn] )
-               return arguments.length === 1 ?
-                       this.off( selector, "**" ) :
-                       this.off( types, selector || "**", fn );
-       }
-} );
-
-jQuery.holdReady = function( hold ) {
-       if ( hold ) {
-               jQuery.readyWait++;
-       } else {
-               jQuery.ready( true );
-       }
+// The number of elements contained in the matched element set
+jQuery.fn.size = function() {
+       return this.length;
 };
-jQuery.isArray = Array.isArray;
-jQuery.parseJSON = JSON.parse;
-jQuery.nodeName = nodeName;
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
 
 
 
@@ -10210,14 +9150,13 @@ jQuery.nodeName = nodeName;
 if ( typeof define === "function" && define.amd ) {
        define( "jquery", [], function() {
                return jQuery;
-       } );
+       });
 }
 
 
 
 
 var
-
        // Map over jQuery in case of overwrite
        _jQuery = window.jQuery,
 
@@ -10236,10 +9175,10 @@ jQuery.noConflict = function( deep ) {
        return jQuery;
 };
 
-// Expose jQuery and $ identifiers, even in AMD
-// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
+// Expose jQuery and $ identifiers, even in
+// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
 // and CommonJS for browser emulators (#13566)
-if ( !noGlobal ) {
+if ( typeof noGlobal === strundefined ) {
        window.jQuery = window.$ = jQuery;
 }
 
@@ -10247,11 +9186,12 @@ if ( !noGlobal ) {
 
 
 return jQuery;
-} );
+
+}));
 
 /**
- * @license AngularJS v1.6.4
- * (c) 2010-2017 Google, Inc. http://angularjs.org
+ * @license AngularJS v1.5.5
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
  * License: MIT
  */
 (function(window){
@@ -10290,135 +9230,131 @@ return jQuery;
 function minErr(module, ErrorConstructor) {
   ErrorConstructor = ErrorConstructor || Error;
   return function() {
-    var code = arguments[0],
-      template = arguments[1],
+    var SKIP_INDEXES = 2;
+
+    var templateArgs = arguments,
+      code = templateArgs[0],
       message = '[' + (module ? module + ':' : '') + code + '] ',
-      templateArgs = sliceArgs(arguments, 2).map(function(arg) {
-        return toDebugString(arg, minErrConfig.objectMaxDepth);
-      }),
+      template = templateArgs[1],
       paramPrefix, i;
 
     message += template.replace(/\{\d+\}/g, function(match) {
-      var index = +match.slice(1, -1);
+      var index = +match.slice(1, -1),
+        shiftedIndex = index + SKIP_INDEXES;
 
-      if (index < templateArgs.length) {
-        return templateArgs[index];
+      if (shiftedIndex < templateArgs.length) {
+        return toDebugString(templateArgs[shiftedIndex]);
       }
 
       return match;
     });
 
-    message += '\nhttp://errors.angularjs.org/1.6.4/' +
+    message += '\nhttp://errors.angularjs.org/1.5.5/' +
       (module ? module + '/' : '') + code;
 
-    for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
-      message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]);
+    for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
+      message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +
+        encodeURIComponent(toDebugString(templateArgs[i]));
     }
 
     return new ErrorConstructor(message);
   };
 }
 
-/* We need to tell ESLint what variables are being exported */
-/* exported
-  angular,
-  msie,
-  jqLite,
-  jQuery,
-  slice,
-  splice,
-  push,
-  toString,
-  minErrConfig,
-  errorHandlingConfig,
-  isValidObjectMaxDepth,
-  ngMinErr,
-  angularModule,
-  uid,
-  REGEX_STRING_REGEXP,
-  VALIDITY_STATE_PROPERTY,
-
-  lowercase,
-  uppercase,
-  manualLowercase,
-  manualUppercase,
-  nodeName_,
-  isArrayLike,
-  forEach,
-  forEachSorted,
-  reverseParams,
-  nextUid,
-  setHashKey,
-  extend,
-  toInt,
-  inherit,
-  merge,
-  noop,
-  identity,
-  valueFn,
-  isUndefined,
-  isDefined,
-  isObject,
-  isBlankObject,
-  isString,
-  isNumber,
-  isNumberNaN,
-  isDate,
-  isArray,
-  isFunction,
-  isRegExp,
-  isWindow,
-  isScope,
-  isFile,
-  isFormData,
-  isBlob,
-  isBoolean,
-  isPromiseLike,
-  trim,
-  escapeForRegexp,
-  isElement,
-  makeMap,
-  includes,
-  arrayRemove,
-  copy,
-  simpleCompare,
-  equals,
-  csp,
-  jq,
-  concat,
-  sliceArgs,
-  bind,
-  toJsonReplacer,
-  toJson,
-  fromJson,
-  convertTimezoneToLocal,
-  timezoneToOffset,
-  startingTag,
-  tryDecodeURIComponent,
-  parseKeyValue,
-  toKeyValue,
-  encodeUriSegment,
-  encodeUriQuery,
-  angularInit,
-  bootstrap,
-  getTestability,
-  snake_case,
-  bindJQuery,
-  assertArg,
-  assertArgFn,
-  assertNotHasOwnProperty,
-  getter,
-  getBlockNodes,
-  hasOwnProperty,
-  createMap,
-  stringify,
-
-  NODE_TYPE_ELEMENT,
-  NODE_TYPE_ATTRIBUTE,
-  NODE_TYPE_TEXT,
-  NODE_TYPE_COMMENT,
-  NODE_TYPE_DOCUMENT,
-  NODE_TYPE_DOCUMENT_FRAGMENT
+/* We need to tell jshint what variables are being exported */
+/* global angular: true,
+  msie: true,
+  jqLite: true,
+  jQuery: true,
+  slice: true,
+  splice: true,
+  push: true,
+  toString: true,
+  ngMinErr: true,
+  angularModule: true,
+  uid: true,
+  REGEX_STRING_REGEXP: true,
+  VALIDITY_STATE_PROPERTY: true,
+
+  lowercase: true,
+  uppercase: true,
+  manualLowercase: true,
+  manualUppercase: true,
+  nodeName_: true,
+  isArrayLike: true,
+  forEach: true,
+  forEachSorted: true,
+  reverseParams: true,
+  nextUid: true,
+  setHashKey: true,
+  extend: true,
+  toInt: true,
+  inherit: true,
+  merge: true,
+  noop: true,
+  identity: true,
+  valueFn: true,
+  isUndefined: true,
+  isDefined: true,
+  isObject: true,
+  isBlankObject: true,
+  isString: true,
+  isNumber: true,
+  isDate: true,
+  isArray: true,
+  isFunction: true,
+  isRegExp: true,
+  isWindow: true,
+  isScope: true,
+  isFile: true,
+  isFormData: true,
+  isBlob: true,
+  isBoolean: true,
+  isPromiseLike: true,
+  trim: true,
+  escapeForRegexp: true,
+  isElement: true,
+  makeMap: true,
+  includes: true,
+  arrayRemove: true,
+  copy: true,
+  shallowCopy: true,
+  equals: true,
+  csp: true,
+  jq: true,
+  concat: true,
+  sliceArgs: true,
+  bind: true,
+  toJsonReplacer: true,
+  toJson: true,
+  fromJson: true,
+  convertTimezoneToLocal: true,
+  timezoneToOffset: true,
+  startingTag: true,
+  tryDecodeURIComponent: true,
+  parseKeyValue: true,
+  toKeyValue: true,
+  encodeUriSegment: true,
+  encodeUriQuery: true,
+  angularInit: true,
+  bootstrap: true,
+  getTestability: true,
+  snake_case: true,
+  bindJQuery: true,
+  assertArg: true,
+  assertArgFn: true,
+  assertNotHasOwnProperty: true,
+  getter: true,
+  getBlockNodes: true,
+  hasOwnProperty: true,
+  createMap: true,
+
+  NODE_TYPE_ELEMENT: true,
+  NODE_TYPE_ATTRIBUTE: true,
+  NODE_TYPE_TEXT: true,
+  NODE_TYPE_COMMENT: true,
+  NODE_TYPE_DOCUMENT: true,
+  NODE_TYPE_DOCUMENT_FRAGMENT: true,
 */
 
 ////////////////////////////////////
@@ -10445,101 +9381,23 @@ var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
 // This is used so that it's possible for internal tests to create mock ValidityStates.
 var VALIDITY_STATE_PROPERTY = 'validity';
 
-
 var hasOwnProperty = Object.prototype.hasOwnProperty;
 
-var minErrConfig = {
-  objectMaxDepth: 5
-};
-
- /**
- * @ngdoc function
- * @name angular.errorHandlingConfig
- * @module ng
- * @kind function
- *
- * @description
- * Configure several aspects of error handling in AngularJS if used as a setter or return the
- * current configuration if used as a getter. The following options are supported:
- *
- * - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages.
- *
- * Omitted or undefined options will leave the corresponding configuration values unchanged.
- *
- * @param {Object=} config - The configuration object. May only contain the options that need to be
- *     updated. Supported keys:
- *
- * * `objectMaxDepth`  **{Number}** - The max depth for stringifying objects. Setting to a
- *   non-positive or non-numeric value, removes the max depth limit.
- *   Default: 5
- */
-function errorHandlingConfig(config) {
-  if (isObject(config)) {
-    if (isDefined(config.objectMaxDepth)) {
-      minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN;
-    }
-  } else {
-    return minErrConfig;
-  }
-}
-
-/**
- * @private
- * @param {Number} maxDepth
- * @return {boolean}
- */
-function isValidObjectMaxDepth(maxDepth) {
-  return isNumber(maxDepth) && maxDepth > 0;
-}
-
-/**
- * @ngdoc function
- * @name angular.lowercase
- * @module ng
- * @kind function
- *
- * @deprecated
- * sinceVersion="1.5.0"
- * removeVersion="1.7.0"
- * Use [String.prototype.toLowerCase](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase) instead.
- *
- * @description Converts the specified string to lowercase.
- * @param {string} string String to be converted to lowercase.
- * @returns {string} Lowercased string.
- */
 var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};
-
-/**
- * @ngdoc function
- * @name angular.uppercase
- * @module ng
- * @kind function
- *
- * @deprecated
- * sinceVersion="1.5.0"
- * removeVersion="1.7.0"
- * Use [String.prototype.toUpperCase](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) instead.
- *
- * @description Converts the specified string to uppercase.
- * @param {string} string String to be converted to uppercase.
- * @returns {string} Uppercased string.
- */
 var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};
 
 
 var manualLowercase = function(s) {
-  /* eslint-disable no-bitwise */
+  /* jshint bitwise: false */
   return isString(s)
       ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
       : s;
-  /* eslint-enable */
 };
 var manualUppercase = function(s) {
-  /* eslint-disable no-bitwise */
+  /* jshint bitwise: false */
   return isString(s)
       ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
       : s;
-  /* eslint-enable */
 };
 
 
@@ -10568,7 +9426,6 @@ var
     angularModule,
     uid               = 0;
 
-// Support: IE 9-11 only
 /**
  * documentMode is an IE-only property
  * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx
@@ -10595,12 +9452,12 @@ function isArrayLike(obj) {
 
   // Support: iOS 8.2 (not reproducible in simulator)
   // "length" in obj used to prevent JIT error (gh-11508)
-  var length = 'length' in Object(obj) && obj.length;
+  var length = "length" in Object(obj) && obj.length;
 
   // NodeList objects (with `item` method) and
   // other objects with suitable length characteristics are array-like
   return isNumber(length) &&
-    (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item === 'function');
+    (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item == 'function');
 
 }
 
@@ -10644,7 +9501,9 @@ function forEach(obj, iterator, context) {
   if (obj) {
     if (isFunction(obj)) {
       for (key in obj) {
-        if (key !== 'prototype' && key !== 'length' && key !== 'name' && obj.hasOwnProperty(key)) {
+        // Need to check if hasOwnProperty exists,
+        // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
+        if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
           iterator.call(context, obj[key], key, obj);
         }
       }
@@ -10813,11 +9672,6 @@ function toInt(str) {
   return parseInt(str, 10);
 }
 
-var isNumberNaN = Number.isNaN || function isNumberNaN(num) {
-  // eslint-disable-next-line no-self-compare
-  return num !== num;
-};
-
 
 function inherit(parent, extra) {
   return extend(Object.create(parent), extra);
@@ -10854,22 +9708,12 @@ noop.$inject = [];
  * functional style.
  *
    ```js
-   function transformer(transformationFn, value) {
-     return (transformationFn || angular.identity)(value);
-   };
-
-   // E.g.
-   function getResult(fn, input) {
-     return (fn || angular.identity)(input);
-   };
-
-   getResult(function(n) { return n * 2; }, 21);   // returns 42
-   getResult(null, 21);                            // returns 21
-   getResult(undefined, 21);                       // returns 21
+     function transformer(transformationFn, value) {
+       return (transformationFn || angular.identity)(value);
+     };
    ```
- *
- * @param {*} value to be returned.
- * @returns {*} the value passed in.
+  * @param {*} value to be returned.
+  * @returns {*} the value passed in.
  */
 function identity($) {return $;}
 identity.$inject = [];
@@ -11001,7 +9845,7 @@ function isDate(value) {
  * @kind function
  *
  * @description
- * Determines if a reference is an `Array`. Alias of Array.isArray.
+ * Determines if a reference is an `Array`.
  *
  * @param {*} value Reference to check.
  * @returns {boolean} True if `value` is an `Array`.
@@ -11077,7 +9921,7 @@ function isPromiseLike(obj) {
 }
 
 
-var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/;
+var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;
 function isTypedArray(value) {
   return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));
 }
@@ -11095,10 +9939,8 @@ var trim = function(value) {
 // http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021
 // Prereq: s is a string.
 var escapeForRegexp = function(s) {
-  return s
-    .replace(/([-()[\]{}+?*.$^|,:#<!\\])/g, '\\$1')
-    // eslint-disable-next-line no-control-regex
-    .replace(/\x08/g, '\\x08');
+  return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').
+           replace(/\x08/g, '\\x08');
 };
 
 
@@ -11116,8 +9958,8 @@ var escapeForRegexp = function(s) {
  */
 function isElement(node) {
   return !!(node &&
-    (node.nodeName  // We are a direct element.
-    || (node.prop && node.attr && node.find)));  // We have an on and find method part of jQuery API.
+    (node.nodeName  // we are a direct element
+    || (node.prop && node.attr && node.find)));  // we have an on and find method part of jQuery API
 }
 
 /**
@@ -11138,7 +9980,7 @@ function nodeName_(element) {
 }
 
 function includes(array, obj) {
-  return Array.prototype.indexOf.call(array, obj) !== -1;
+  return Array.prototype.indexOf.call(array, obj) != -1;
 }
 
 function arrayRemove(array, value) {
@@ -11162,13 +10004,7 @@ function arrayRemove(array, value) {
  * * If a destination is provided, all of its elements (for arrays) or properties (for objects)
  *   are deleted and then all elements/properties from the source are copied to it.
  * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
- * * If `source` is identical to `destination` an exception will be thrown.
- *
- * <br />
- * <div class="alert alert-warning">
- *   Only enumerable properties are taken into account. Non-enumerable properties (both on `source`
- *   and on `destination`) will be ignored.
- * </div>
+ * * If `source` is identical to 'destination' an exception will be thrown.
  *
  * @param {*} source The source that will be used to make a copy.
  *                   Can be any type, including primitives, `null`, and `undefined`.
@@ -11177,54 +10013,52 @@ function arrayRemove(array, value) {
  * @returns {*} The copy or updated `destination`, if `destination` was specified.
  *
  * @example
-  <example module="copyExample" name="angular-copy">
-    <file name="index.html">
-      <div ng-controller="ExampleController">
-        <form novalidate class="simple-form">
-          <label>Name: <input type="text" ng-model="user.name" /></label><br />
-          <label>Age:  <input type="number" ng-model="user.age" /></label><br />
-          Gender: <label><input type="radio" ng-model="user.gender" value="male" />male</label>
-                  <label><input type="radio" ng-model="user.gender" value="female" />female</label><br />
-          <button ng-click="reset()">RESET</button>
-          <button ng-click="update(user)">SAVE</button>
-        </form>
-        <pre>form = {{user | json}}</pre>
-        <pre>master = {{master | json}}</pre>
-      </div>
-    </file>
-    <file name="script.js">
-      // Module: copyExample
-      angular.
-        module('copyExample', []).
-        controller('ExampleController', ['$scope', function($scope) {
-          $scope.master = {};
-
-          $scope.reset = function() {
-            // Example with 1 argument
-            $scope.user = angular.copy($scope.master);
-          };
+ <example module="copyExample">
+ <file name="index.html">
+ <div ng-controller="ExampleController">
+ <form novalidate class="simple-form">
+ Name: <input type="text" ng-model="user.name" /><br />
+ E-mail: <input type="email" ng-model="user.email" /><br />
+ Gender: <input type="radio" ng-model="user.gender" value="male" />male
+ <input type="radio" ng-model="user.gender" value="female" />female<br />
+ <button ng-click="reset()">RESET</button>
+ <button ng-click="update(user)">SAVE</button>
+ </form>
+ <pre>form = {{user | json}}</pre>
+ <pre>master = {{master | json}}</pre>
+ </div>
+
+ <script>
+  angular.module('copyExample', [])
+    .controller('ExampleController', ['$scope', function($scope) {
+      $scope.master= {};
+
+      $scope.update = function(user) {
+        // Example with 1 argument
+        $scope.master= angular.copy(user);
+      };
 
-          $scope.update = function(user) {
-            // Example with 2 arguments
-            angular.copy(user, $scope.master);
-          };
+      $scope.reset = function() {
+        // Example with 2 arguments
+        angular.copy($scope.master, $scope.user);
+      };
 
-          $scope.reset();
-        }]);
-    </file>
-  </example>
+      $scope.reset();
+    }]);
+ </script>
+ </file>
+ </example>
  */
-function copy(source, destination, maxDepth) {
+function copy(source, destination) {
   var stackSource = [];
   var stackDest = [];
-  maxDepth = isValidObjectMaxDepth(maxDepth) ? maxDepth : NaN;
 
   if (destination) {
     if (isTypedArray(destination) || isArrayBuffer(destination)) {
-      throw ngMinErr('cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
+      throw ngMinErr('cpta', "Can't copy! TypedArray destination cannot be mutated.");
     }
     if (source === destination) {
-      throw ngMinErr('cpi', 'Can\'t copy! Source and destination are identical.');
+      throw ngMinErr('cpi', "Can't copy! Source and destination are identical.");
     }
 
     // Empty the destination object
@@ -11240,39 +10074,35 @@ function copy(source, destination, maxDepth) {
 
     stackSource.push(source);
     stackDest.push(destination);
-    return copyRecurse(source, destination, maxDepth);
+    return copyRecurse(source, destination);
   }
 
-  return copyElement(source, maxDepth);
+  return copyElement(source);
 
-  function copyRecurse(source, destination, maxDepth) {
-    maxDepth--;
-    if (maxDepth < 0) {
-      return '...';
-    }
+  function copyRecurse(source, destination) {
     var h = destination.$$hashKey;
     var key;
     if (isArray(source)) {
       for (var i = 0, ii = source.length; i < ii; i++) {
-        destination.push(copyElement(source[i], maxDepth));
+        destination.push(copyElement(source[i]));
       }
     } else if (isBlankObject(source)) {
       // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
       for (key in source) {
-        destination[key] = copyElement(source[key], maxDepth);
+        destination[key] = copyElement(source[key]);
       }
     } else if (source && typeof source.hasOwnProperty === 'function') {
       // Slow path, which must rely on hasOwnProperty
       for (key in source) {
         if (source.hasOwnProperty(key)) {
-          destination[key] = copyElement(source[key], maxDepth);
+          destination[key] = copyElement(source[key]);
         }
       }
     } else {
       // Slowest path --- hasOwnProperty can't be called as a method
       for (key in source) {
         if (hasOwnProperty.call(source, key)) {
-          destination[key] = copyElement(source[key], maxDepth);
+          destination[key] = copyElement(source[key]);
         }
       }
     }
@@ -11280,7 +10110,7 @@ function copy(source, destination, maxDepth) {
     return destination;
   }
 
-  function copyElement(source, maxDepth) {
+  function copyElement(source) {
     // Simple values
     if (!isObject(source)) {
       return source;
@@ -11294,7 +10124,7 @@ function copy(source, destination, maxDepth) {
 
     if (isWindow(source) || isScope(source)) {
       throw ngMinErr('cpws',
-        'Can\'t copy! Making copies of Window or Scope instances is not supported.');
+        "Can't copy! Making copies of Window or Scope instances is not supported.");
     }
 
     var needsRecurse = false;
@@ -11309,7 +10139,7 @@ function copy(source, destination, maxDepth) {
     stackDest.push(destination);
 
     return needsRecurse
-      ? copyRecurse(source, destination, maxDepth)
+      ? copyRecurse(source, destination)
       : destination;
   }
 
@@ -11324,16 +10154,13 @@ function copy(source, destination, maxDepth) {
       case '[object Uint8ClampedArray]':
       case '[object Uint16Array]':
       case '[object Uint32Array]':
-        return new source.constructor(copyElement(source.buffer), source.byteOffset, source.length);
+        return new source.constructor(copyElement(source.buffer));
 
       case '[object ArrayBuffer]':
-        // Support: IE10
+        //Support: IE10
         if (!source.slice) {
-          // If we're in this case we know the environment supports ArrayBuffer
-          /* eslint-disable no-undef */
           var copied = new ArrayBuffer(source.byteLength);
           new Uint8Array(copied).set(new Uint8Array(source));
-          /* eslint-enable */
           return copied;
         }
         return source.slice(0);
@@ -11345,7 +10172,7 @@ function copy(source, destination, maxDepth) {
         return new source.constructor(source.valueOf());
 
       case '[object RegExp]':
-        var re = new RegExp(source.source, source.toString().match(/[^/]*$/)[0]);
+        var re = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
         re.lastIndex = source.lastIndex;
         return re;
 
@@ -11359,9 +10186,30 @@ function copy(source, destination, maxDepth) {
   }
 }
 
+/**
+ * Creates a shallow copy of an object, an array or a primitive.
+ *
+ * Assumes that there are no proto properties for objects.
+ */
+function shallowCopy(src, dst) {
+  if (isArray(src)) {
+    dst = dst || [];
+
+    for (var i = 0, ii = src.length; i < ii; i++) {
+      dst[i] = src[i];
+    }
+  } else if (isObject(src)) {
+    dst = dst || {};
 
-// eslint-disable-next-line no-self-compare
-function simpleCompare(a, b) { return a === b || (a !== a && b !== b); }
+    for (var key in src) {
+      if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
+        dst[key] = src[key];
+      }
+    }
+  }
+
+  return dst || src;
+}
 
 
 /**
@@ -11420,6 +10268,7 @@ function simpleCompare(a, b) { return a === b || (a !== a && b !== b); }
         angular.module('equalsExample', []).controller('ExampleController', ['$scope', function($scope) {
           $scope.user1 = {};
           $scope.user2 = {};
+          $scope.result;
           $scope.compare = function() {
             $scope.result = angular.equals($scope.user1, $scope.user2);
           };
@@ -11430,13 +10279,12 @@ function simpleCompare(a, b) { return a === b || (a !== a && b !== b); }
 function equals(o1, o2) {
   if (o1 === o2) return true;
   if (o1 === null || o2 === null) return false;
-  // eslint-disable-next-line no-self-compare
   if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
   var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
-  if (t1 === t2 && t1 === 'object') {
+  if (t1 == t2 && t1 == 'object') {
     if (isArray(o1)) {
       if (!isArray(o2)) return false;
-      if ((length = o1.length) === o2.length) {
+      if ((length = o1.length) == o2.length) {
         for (key = 0; key < length; key++) {
           if (!equals(o1[key], o2[key])) return false;
         }
@@ -11444,10 +10292,10 @@ function equals(o1, o2) {
       }
     } else if (isDate(o1)) {
       if (!isDate(o2)) return false;
-      return simpleCompare(o1.getTime(), o2.getTime());
+      return equals(o1.getTime(), o2.getTime());
     } else if (isRegExp(o1)) {
       if (!isRegExp(o2)) return false;
-      return o1.toString() === o2.toString();
+      return o1.toString() == o2.toString();
     } else {
       if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
         isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
@@ -11495,8 +10343,9 @@ var csp = function() {
 
   function noUnsafeEval() {
     try {
-      // eslint-disable-next-line no-new, no-new-func
+      /* jshint -W031, -W054 */
       new Function('');
+      /* jshint +W031, +W054 */
       return false;
     } catch (e) {
       return true;
@@ -11548,8 +10397,7 @@ var jq = function() {
   var i, ii = ngAttrPrefixes.length, prefix, name;
   for (i = 0; i < ii; ++i) {
     prefix = ngAttrPrefixes[i];
-    el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]');
-    if (el) {
+    if (el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]')) {
       name = el.getAttribute(prefix + 'jq');
       break;
     }
@@ -11567,6 +10415,7 @@ function sliceArgs(args, startIndex) {
 }
 
 
+/* jshint -W101 */
 /**
  * @ngdoc function
  * @name angular.bind
@@ -11584,6 +10433,7 @@ function sliceArgs(args, startIndex) {
  * @param {...*} args Optional arguments to be prebound to the `fn` function call.
  * @returns {function()} Function that wraps the `fn` with all the specified bindings.
  */
+/* jshint +W101 */
 function bind(self, fn) {
   var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
   if (isFunction(fn) && !(fn instanceof RegExp)) {
@@ -11599,7 +10449,7 @@ function bind(self, fn) {
             : fn.call(self);
         };
   } else {
-    // In IE, native methods are not functions so they cannot be bound (note: they don't need to be).
+    // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)
     return fn;
   }
 }
@@ -11632,31 +10482,10 @@ function toJsonReplacer(key, value) {
  * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be
  * stripped since angular uses this notation internally.
  *
- * @param {Object|Array|Date|string|number|boolean} obj Input to be serialized into JSON.
+ * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.
  * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.
  *    If set to an integer, the JSON output will contain that many spaces per indentation.
  * @returns {string|undefined} JSON-ified string representing `obj`.
- * @knownIssue
- *
- * The Safari browser throws a `RangeError` instead of returning `null` when it tries to stringify a `Date`
- * object with an invalid date value. The only reliable way to prevent this is to monkeypatch the
- * `Date.prototype.toJSON` method as follows:
- *
- * ```
- * var _DatetoJSON = Date.prototype.toJSON;
- * Date.prototype.toJSON = function() {
- *   try {
- *     return _DatetoJSON.call(this);
- *   } catch(e) {
- *     if (e instanceof RangeError) {
- *       return null;
- *     }
- *     throw e;
- *   }
- * };
- * ```
- *
- * See https://github.com/angular/angular.js/pull/14221 for more information.
  */
 function toJson(obj, pretty) {
   if (isUndefined(obj)) return undefined;
@@ -11688,11 +10517,10 @@ function fromJson(json) {
 
 var ALL_COLONS = /:/g;
 function timezoneToOffset(timezone, fallback) {
-  // Support: IE 9-11 only, Edge 13-14+
   // IE/Edge do not "understand" colon (`:`) in timezone
   timezone = timezone.replace(ALL_COLONS, '');
   var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
-  return isNumberNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
+  return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
 }
 
 
@@ -11720,13 +10548,13 @@ function startingTag(element) {
     // turns out IE does not let you set .html() on elements which
     // are not allowed to have children. So we just ignore it.
     element.empty();
-  } catch (e) { /* empty */ }
+  } catch (e) {}
   var elemHtml = jqLite('<div>').append(element).html();
   try {
     return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
         elemHtml.
           match(/^(<[^>]+>)/)[1].
-          replace(/^<([\w-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});
+          replace(/^<([\w\-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});
   } catch (e) {
     return lowercase(elemHtml);
   }
@@ -11748,7 +10576,7 @@ function tryDecodeURIComponent(value) {
   try {
     return decodeURIComponent(value);
   } catch (e) {
-    // Ignore any invalid uri component.
+    // Ignore any invalid uri component
   }
 }
 
@@ -11759,7 +10587,7 @@ function tryDecodeURIComponent(value) {
  */
 function parseKeyValue(/**string*/keyValue) {
   var obj = {};
-  forEach((keyValue || '').split('&'), function(keyValue) {
+  forEach((keyValue || "").split('&'), function(keyValue) {
     var splitPoint, key, val;
     if (keyValue) {
       key = keyValue = keyValue.replace(/\+/g,'%20');
@@ -11824,7 +10652,7 @@ function encodeUriSegment(val) {
  * This method is intended for encoding *key* or *value* parts of query component. We need a custom
  * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be
  * encoded per http://tools.ietf.org/html/rfc3986:
- *    query         = *( pchar / "/" / "?" )
+ *    query       = *( pchar / "/" / "?" )
  *    pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
  *    unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
  *    pct-encoded   = "%" HEXDIG HEXDIG
@@ -11854,57 +10682,6 @@ function getNgAttribute(element, ngAttr) {
   return null;
 }
 
-function allowAutoBootstrap(document) {
-  var script = document.currentScript;
-
-  if (!script) {
-    // IE does not have `document.currentScript`
-    return true;
-  }
-
-  // If the `currentScript` property has been clobbered just return false, since this indicates a probable attack
-  if (!(script instanceof window.HTMLScriptElement || script instanceof window.SVGScriptElement)) {
-    return false;
-  }
-
-  var attributes = script.attributes;
-  var srcs = [attributes.getNamedItem('src'), attributes.getNamedItem('href'), attributes.getNamedItem('xlink:href')];
-
-  return srcs.every(function(src) {
-    if (!src) {
-      return true;
-    }
-    if (!src.value) {
-      return false;
-    }
-
-    var link = document.createElement('a');
-    link.href = src.value;
-
-    if (document.location.origin === link.origin) {
-      // Same-origin resources are always allowed, even for non-whitelisted schemes.
-      return true;
-    }
-    // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
-    // This is to prevent angular.js bundled with browser extensions from being used to bypass the
-    // content security policy in web pages and other browser extensions.
-    switch (link.protocol) {
-      case 'http:':
-      case 'https:':
-      case 'ftp:':
-      case 'blob:':
-      case 'file:':
-      case 'data:':
-        return true;
-      default:
-        return false;
-    }
-  });
-}
-
-// Cached as it has to run during loading so that document.currentScript is available.
-var isAutoBootstrapAllowed = allowAutoBootstrap(window.document);
-
 /**
  * @ngdoc directive
  * @name ngApp
@@ -11948,7 +10725,7 @@ var isAutoBootstrapAllowed = allowAutoBootstrap(window.document);
  *
  * `ngApp` is the easiest, and most common way to bootstrap an application.
  *
- <example module="ngAppDemo" name="ng-app">
+ <example module="ngAppDemo">
    <file name="index.html">
    <div ng-controller="ngAppDemoController">
      I can add: {{a}} + {{b}} =  {{ a+b }}
@@ -11964,7 +10741,7 @@ var isAutoBootstrapAllowed = allowAutoBootstrap(window.document);
  *
  * Using `ngStrictDi`, you would see something like this:
  *
- <example ng-app-included="true" name="strict-di">
+ <example ng-app-included="true">
    <file name="index.html">
    <div ng-app="ngAppStrictDemo" ng-strict-di>
        <div ng-controller="GoodController1">
@@ -12013,7 +10790,7 @@ var isAutoBootstrapAllowed = allowAutoBootstrap(window.document);
      }])
      .controller('GoodController2', GoodController2);
      function GoodController2($scope) {
-       $scope.name = 'World';
+       $scope.name = "World";
      }
      GoodController2.$inject = ['$scope'];
    </file>
@@ -12044,7 +10821,7 @@ function angularInit(element, bootstrap) {
       module,
       config = {};
 
-  // The element `element` has priority over any other element.
+  // The element `element` has priority over any other element
   forEach(ngAttrPrefixes, function(prefix) {
     var name = prefix + 'app';
 
@@ -12063,12 +10840,7 @@ function angularInit(element, bootstrap) {
     }
   });
   if (appElement) {
-    if (!isAutoBootstrapAllowed) {
-      window.console.error('Angular: disabling automatic bootstrap. <script> protocol indicates ' +
-          'an extension, document.location.href does not match.');
-      return;
-    }
-    config.strictDi = getNgAttribute(appElement, 'strict-di') !== null;
+    config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
     bootstrap(appElement, module ? [module] : [], config);
   }
 }
@@ -12143,10 +10915,10 @@ function bootstrap(element, modules, config) {
 
     if (element.injector()) {
       var tag = (element[0] === window.document) ? 'document' : startingTag(element);
-      // Encode angle brackets to prevent input from being sanitized to empty string #8683.
+      //Encode angle brackets to prevent input from being sanitized to empty string #8683
       throw ngMinErr(
           'btstrpd',
-          'App already bootstrapped with this element \'{0}\'',
+          "App already bootstrapped with this element '{0}'",
           tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
     }
 
@@ -12263,7 +11035,7 @@ function bindJQuery() {
     extend(jQuery.fn, {
       scope: JQLitePrototype.scope,
       isolateScope: JQLitePrototype.isolateScope,
-      controller: /** @type {?} */ (JQLitePrototype).controller,
+      controller: JQLitePrototype.controller,
       injector: JQLitePrototype.injector,
       inheritedData: JQLitePrototype.inheritedData
     });
@@ -12275,7 +11047,7 @@ function bindJQuery() {
     jQuery.cleanData = function(elems) {
       var events;
       for (var i = 0, elem; (elem = elems[i]) != null; i++) {
-        events = jQuery._data(elem, 'events');
+        events = jQuery._data(elem, "events");
         if (events && events.$destroy) {
           jQuery(elem).triggerHandler('$destroy');
         }
@@ -12297,7 +11069,7 @@ function bindJQuery() {
  */
 function assertArg(arg, name, reason) {
   if (!arg) {
-    throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required'));
+    throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
   }
   return arg;
 }
@@ -12319,7 +11091,7 @@ function assertArgFn(arg, name, acceptArrayAnnotation) {
  */
 function assertNotHasOwnProperty(name, context) {
   if (name === 'hasOwnProperty') {
-    throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
+    throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context);
   }
 }
 
@@ -12389,27 +11161,6 @@ function createMap() {
   return Object.create(null);
 }
 
-function stringify(value) {
-  if (value == null) { // null || undefined
-    return '';
-  }
-  switch (typeof value) {
-    case 'string':
-      break;
-    case 'number':
-      value = '' + value;
-      break;
-    default:
-      if (hasCustomToString(value) && !isArray(value) && !isDate(value)) {
-        value = value.toString();
-      } else {
-        value = toJson(value);
-      }
-  }
-
-  return value;
-}
-
 var NODE_TYPE_ELEMENT = 1;
 var NODE_TYPE_ATTRIBUTE = 2;
 var NODE_TYPE_TEXT = 3;
@@ -12496,9 +11247,6 @@ function setupModuleLoader(window) {
      * @returns {angular.Module} new module with the {@link angular.Module} api.
      */
     return function module(name, requires, configFn) {
-
-      var info = {};
-
       var assertNotHasOwnProperty = function(name, context) {
         if (name === 'hasOwnProperty') {
           throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
@@ -12511,9 +11259,9 @@ function setupModuleLoader(window) {
       }
       return ensure(modules, name, function() {
         if (!requires) {
-          throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' +
-             'the module name or forgot to load it. If registering a module ensure that you ' +
-             'specify the dependencies as the second argument.', name);
+          throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
+             "the module name or forgot to load it. If registering a module ensure that you " +
+             "specify the dependencies as the second argument.", name);
         }
 
         /** @type {!Array.<Array.<*>>} */
@@ -12535,45 +11283,6 @@ function setupModuleLoader(window) {
           _runBlocks: runBlocks,
 
           /**
-           * @ngdoc method
-           * @name angular.Module#info
-           * @module ng
-           *
-           * @param {Object=} info Information about the module
-           * @returns {Object|Module} The current info object for this module if called as a getter,
-           *                          or `this` if called as a setter.
-           *
-           * @description
-           * Read and write custom information about this module.
-           * For example you could put the version of the module in here.
-           *
-           * ```js
-           * angular.module('myModule', []).info({ version: '1.0.0' });
-           * ```
-           *
-           * The version could then be read back out by accessing the module elsewhere:
-           *
-           * ```
-           * var version = angular.module('myModule').info().version;
-           * ```
-           *
-           * You can also retrieve this information during runtime via the
-           * {@link $injector#modules `$injector.modules`} property:
-           *
-           * ```js
-           * var version = $injector.modules['myModule'].info().version;
-           * ```
-           */
-          info: function(value) {
-            if (isDefined(value)) {
-              if (!isObject(value)) throw ngMinErr('aobj', 'Argument \'{0}\' must be an object', 'value');
-              info = value;
-              return this;
-            }
-            return info;
-          },
-
-          /**
            * @ngdoc property
            * @name angular.Module#requires
            * @module ng
@@ -12662,7 +11371,7 @@ function setupModuleLoader(window) {
            * @description
            * See {@link auto.$provide#decorator $provide.decorator()}.
            */
-          decorator: invokeLaterAndSetModuleName('$provide', 'decorator', configBlocks),
+          decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),
 
           /**
            * @ngdoc method
@@ -12808,11 +11517,10 @@ function setupModuleLoader(window) {
          * @param {string} method
          * @returns {angular.Module}
          */
-        function invokeLaterAndSetModuleName(provider, method, queue) {
-          if (!queue) queue = invokeQueue;
+        function invokeLaterAndSetModuleName(provider, method) {
           return function(recipeName, factoryFunction) {
             if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
-            queue.push([provider, method, arguments]);
+            invokeQueue.push([provider, method, arguments]);
             return moduleInstance;
           };
         }
@@ -12822,44 +11530,11 @@ function setupModuleLoader(window) {
 
 }
 
-/* global shallowCopy: true */
-
-/**
- * Creates a shallow copy of an object, an array or a primitive.
- *
- * Assumes that there are no proto properties for objects.
- */
-function shallowCopy(src, dst) {
-  if (isArray(src)) {
-    dst = dst || [];
-
-    for (var i = 0, ii = src.length; i < ii; i++) {
-      dst[i] = src[i];
-    }
-  } else if (isObject(src)) {
-    dst = dst || {};
+/* global: toDebugString: true */
 
-    for (var key in src) {
-      if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
-        dst[key] = src[key];
-      }
-    }
-  }
-
-  return dst || src;
-}
-
-/* global toDebugString: true */
-
-function serializeObject(obj, maxDepth) {
+function serializeObject(obj) {
   var seen = [];
 
-  // There is no direct way to stringify object until reaching a specific depth
-  // and a very deep object can cause a performance issue, so we copy the object
-  // based on this specific depth and then stringify it.
-  if (isValidObjectMaxDepth(maxDepth)) {
-    obj = copy(obj, null, maxDepth);
-  }
   return JSON.stringify(obj, function(key, val) {
     val = toJsonReplacer(key, val);
     if (isObject(val)) {
@@ -12872,13 +11547,13 @@ function serializeObject(obj, maxDepth) {
   });
 }
 
-function toDebugString(obj, maxDepth) {
+function toDebugString(obj) {
   if (typeof obj === 'function') {
     return obj.toString().replace(/ \{[\s\S]*$/, '');
   } else if (isUndefined(obj)) {
     return 'undefined';
   } else if (typeof obj !== 'string') {
-    return serializeObject(obj, maxDepth);
+    return serializeObject(obj);
   }
   return obj;
 }
@@ -12894,6 +11569,7 @@ function toDebugString(obj, maxDepth) {
   formDirective,
   scriptDirective,
   selectDirective,
+  styleDirective,
   optionDirective,
   ngBindDirective,
   ngBindHtmlDirective,
@@ -12947,21 +11623,19 @@ function toDebugString(obj, maxDepth) {
   $ControllerProvider,
   $DateProvider,
   $DocumentProvider,
-  $$IsDocumentHiddenProvider,
   $ExceptionHandlerProvider,
   $FilterProvider,
   $$ForceReflowProvider,
   $InterpolateProvider,
   $IntervalProvider,
+  $$HashMapProvider,
   $HttpProvider,
   $HttpParamSerializerProvider,
   $HttpParamSerializerJQLikeProvider,
   $HttpBackendProvider,
   $xhrFactoryProvider,
-  $jsonpCallbacksProvider,
   $LocationProvider,
   $LogProvider,
-  $$MapProvider,
   $ParseProvider,
   $RootScopeProvider,
   $QProvider,
@@ -12997,19 +11671,16 @@ function toDebugString(obj, maxDepth) {
  * - `codeName` â€“ `{string}` â€“ Code name of the release, such as "jiggling-armfat".
  */
 var version = {
-  // These placeholder strings will be replaced by grunt's `build` task.
-  // They need to be double- or single-quoted.
-  full: '1.6.4',
-  major: 1,
-  minor: 6,
-  dot: 4,
-  codeName: 'phenomenal-footnote'
+  full: '1.5.5',    // all of these placeholder strings will be replaced by grunt's
+  major: 1,    // package task
+  minor: 5,
+  dot: 5,
+  codeName: 'material-conspiration'
 };
 
 
 function publishExternalAPI(angular) {
   extend(angular, {
-    'errorHandlingConfig': errorHandlingConfig,
     'bootstrap': bootstrap,
     'copy': copy,
     'extend': extend,
@@ -13035,14 +11706,11 @@ function publishExternalAPI(angular) {
     'isDate': isDate,
     'lowercase': lowercase,
     'uppercase': uppercase,
-    'callbacks': {$$counter: 0},
+    'callbacks': {counter: 0},
     'getTestability': getTestability,
-    'reloadWithDebugInfo': reloadWithDebugInfo,
     '$$minErr': minErr,
     '$$csp': csp,
-    '$$encodeUriSegment': encodeUriSegment,
-    '$$encodeUriQuery': encodeUriQuery,
-    '$$stringify': stringify
+    'reloadWithDebugInfo': reloadWithDebugInfo
   });
 
   angularModule = setupModuleLoader(window);
@@ -13061,6 +11729,7 @@ function publishExternalAPI(angular) {
             form: formDirective,
             script: scriptDirective,
             select: selectDirective,
+            style: styleDirective,
             option: optionDirective,
             ngBind: ngBindDirective,
             ngBindHtml: ngBindHtmlDirective,
@@ -13116,7 +11785,6 @@ function publishExternalAPI(angular) {
         $cacheFactory: $CacheFactoryProvider,
         $controller: $ControllerProvider,
         $document: $DocumentProvider,
-        $$isDocumentHidden: $$IsDocumentHiddenProvider,
         $exceptionHandler: $ExceptionHandlerProvider,
         $filter: $FilterProvider,
         $$forceReflow: $$ForceReflowProvider,
@@ -13127,7 +11795,6 @@ function publishExternalAPI(angular) {
         $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,
         $httpBackend: $HttpBackendProvider,
         $xhrFactory: $xhrFactoryProvider,
-        $jsonpCallbacks: $jsonpCallbacksProvider,
         $location: $LocationProvider,
         $log: $LogProvider,
         $parse: $ParseProvider,
@@ -13144,12 +11811,11 @@ function publishExternalAPI(angular) {
         $window: $WindowProvider,
         $$rAF: $$RAFProvider,
         $$jqLite: $$jqLiteProvider,
-        $$Map: $$MapProvider,
+        $$HashMap: $$HashMapProvider,
         $$cookieReader: $$CookieReaderProvider
       });
     }
-  ])
-  .info({ angularVersion: '1.6.4' });
+  ]);
 }
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -13163,10 +11829,11 @@ function publishExternalAPI(angular) {
  *     Or gives undesired access to variables likes document or window?    *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-/* global
-  JQLitePrototype: true,
+/* global JQLitePrototype: true,
+  addEventListenerFn: true,
+  removeEventListenerFn: true,
   BOOLEAN_ATTR: true,
-  ALIASED_ATTR: true
+  ALIASED_ATTR: true,
 */
 
 //////////////////////////////////
@@ -13204,11 +11871,11 @@ function publishExternalAPI(angular) {
  * ## Angular's jqLite
  * jqLite provides only the following jQuery methods:
  *
- * - [`addClass()`](http://api.jquery.com/addClass/) - Does not support a function as first argument
+ * - [`addClass()`](http://api.jquery.com/addClass/)
  * - [`after()`](http://api.jquery.com/after/)
  * - [`append()`](http://api.jquery.com/append/)
  * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters
- * - [`bind()`](http://api.jquery.com/bind/) (_deprecated_, use [`on()`](http://api.jquery.com/on/)) - Does not support namespaces, selectors or eventData
+ * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData
  * - [`children()`](http://api.jquery.com/children/) - Does not support selectors
  * - [`clone()`](http://api.jquery.com/clone/)
  * - [`contents()`](http://api.jquery.com/contents/)
@@ -13228,16 +11895,16 @@ function publishExternalAPI(angular) {
  * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors
  * - [`prepend()`](http://api.jquery.com/prepend/)
  * - [`prop()`](http://api.jquery.com/prop/)
- * - [`ready()`](http://api.jquery.com/ready/) (_deprecated_, use `angular.element(callback)` instead of `angular.element(document).ready(callback)`)
+ * - [`ready()`](http://api.jquery.com/ready/)
  * - [`remove()`](http://api.jquery.com/remove/)
- * - [`removeAttr()`](http://api.jquery.com/removeAttr/) - Does not support multiple attributes
- * - [`removeClass()`](http://api.jquery.com/removeClass/) - Does not support a function as first argument
+ * - [`removeAttr()`](http://api.jquery.com/removeAttr/)
+ * - [`removeClass()`](http://api.jquery.com/removeClass/)
  * - [`removeData()`](http://api.jquery.com/removeData/)
  * - [`replaceWith()`](http://api.jquery.com/replaceWith/)
  * - [`text()`](http://api.jquery.com/text/)
- * - [`toggleClass()`](http://api.jquery.com/toggleClass/) - Does not support a function as first argument
- * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers
- * - [`unbind()`](http://api.jquery.com/unbind/) (_deprecated_, use [`off()`](http://api.jquery.com/off/)) - Does not support namespaces or event object as parameter
+ * - [`toggleClass()`](http://api.jquery.com/toggleClass/)
+ * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.
+ * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces or event object as parameter
  * - [`val()`](http://api.jquery.com/val/)
  * - [`wrap()`](http://api.jquery.com/wrap/)
  *
@@ -13275,7 +11942,13 @@ function publishExternalAPI(angular) {
 JQLite.expando = 'ng339';
 
 var jqCache = JQLite.cache = {},
-    jqId = 1;
+    jqId = 1,
+    addEventListenerFn = function(element, type, fn) {
+      element.addEventListener(type, fn, false);
+    },
+    removeEventListenerFn = function(element, type, fn) {
+      element.removeEventListener(type, fn, false);
+    };
 
 /*
  * !!! This is an undocumented "private" function !!!
@@ -13288,31 +11961,22 @@ JQLite._data = function(node) {
 function jqNextId() { return ++jqId; }
 
 
-var DASH_LOWERCASE_REGEXP = /-([a-z])/g;
-var MS_HACK_REGEXP = /^-ms-/;
-var MOUSE_EVENT_MAP = { mouseleave: 'mouseout', mouseenter: 'mouseover' };
+var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
+var MOZ_HACK_REGEXP = /^moz([A-Z])/;
+var MOUSE_EVENT_MAP= { mouseleave: "mouseout", mouseenter: "mouseover"};
 var jqLiteMinErr = minErr('jqLite');
 
 /**
- * Converts kebab-case to camelCase.
- * There is also a special case for the ms prefix starting with a lowercase letter.
+ * Converts snake_case to camelCase.
+ * Also there is special case for Moz prefix starting with upper case letter.
  * @param name Name to normalize
  */
-function cssKebabToCamel(name) {
-    return kebabToCamel(name.replace(MS_HACK_REGEXP, 'ms-'));
-}
-
-function fnCamelCaseReplace(all, letter) {
-  return letter.toUpperCase();
-}
-
-/**
- * Converts kebab-case to camelCase.
- * @param name Name to normalize
- */
-function kebabToCamel(name) {
-  return name
-    .replace(DASH_LOWERCASE_REGEXP, fnCamelCaseReplace);
+function camelCase(name) {
+  return name.
+    replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+      return offset ? letter.toUpperCase() : letter;
+    }).
+    replace(MOZ_HACK_REGEXP, 'Moz$1');
 }
 
 var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;
@@ -13327,7 +11991,7 @@ var wrapMap = {
   'col': [2, '<table><colgroup>', '</colgroup></table>'],
   'tr': [2, '<table><tbody>', '</tbody></table>'],
   'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
-  '_default': [0, '', '']
+  '_default': [0, "", ""]
 };
 
 wrapMap.optgroup = wrapMap.option;
@@ -13353,6 +12017,12 @@ function jqLiteHasData(node) {
   return false;
 }
 
+function jqLiteCleanData(nodes) {
+  for (var i = 0, ii = nodes.length; i < ii; i++) {
+    jqLiteRemoveData(nodes[i]);
+  }
+}
+
 function jqLiteBuildFragment(html, context) {
   var tmp, tag, wrap,
       fragment = context.createDocumentFragment(),
@@ -13363,10 +12033,10 @@ function jqLiteBuildFragment(html, context) {
     nodes.push(context.createTextNode(html));
   } else {
     // Convert html into DOM nodes
-    tmp = fragment.appendChild(context.createElement('div'));
-    tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase();
+    tmp = tmp || fragment.appendChild(context.createElement("div"));
+    tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
     wrap = wrapMap[tag] || wrapMap._default;
-    tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1></$2>') + wrap[2];
+    tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
 
     // Descend through wrappers to the right content
     i = wrap[0];
@@ -13377,12 +12047,12 @@ function jqLiteBuildFragment(html, context) {
     nodes = concat(nodes, tmp.childNodes);
 
     tmp = fragment.firstChild;
-    tmp.textContent = '';
+    tmp.textContent = "";
   }
 
   // Remove wrapper from fragment
-  fragment.textContent = '';
-  fragment.innerHTML = ''; // Clear inner HTML
+  fragment.textContent = "";
+  fragment.innerHTML = ""; // Clear inner HTML
   forEach(nodes, function(node) {
     fragment.appendChild(node);
   });
@@ -13417,9 +12087,10 @@ function jqLiteWrapNode(node, wrapper) {
 
 
 // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
-var jqLiteContains = window.Node.prototype.contains || /** @this */ function(arg) {
-  // eslint-disable-next-line no-bitwise
+var jqLiteContains = window.Node.prototype.contains || function(arg) {
+  // jshint bitwise: false
   return !!(this.compareDocumentPosition(arg) & 16);
+  // jshint bitwise: true
 };
 
 /////////////////////////////////////////////
@@ -13435,7 +12106,7 @@ function JQLite(element) {
     argIsString = true;
   }
   if (!(this instanceof JQLite)) {
-    if (argIsString && element.charAt(0) !== '<') {
+    if (argIsString && element.charAt(0) != '<') {
       throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
     }
     return new JQLite(element);
@@ -13443,8 +12114,6 @@ function JQLite(element) {
 
   if (argIsString) {
     jqLiteAddNodes(this, jqLiteParseHTML(element));
-  } else if (isFunction(element)) {
-    jqLiteReady(element);
   } else {
     jqLiteAddNodes(this, element);
   }
@@ -13455,10 +12124,13 @@ function jqLiteClone(element) {
 }
 
 function jqLiteDealoc(element, onlyDescendants) {
-  if (!onlyDescendants && jqLiteAcceptsData(element)) jqLite.cleanData([element]);
+  if (!onlyDescendants) jqLiteRemoveData(element);
 
   if (element.querySelectorAll) {
-    jqLite.cleanData(element.querySelectorAll('*'));
+    var descendants = element.querySelectorAll('*');
+    for (var i = 0, l = descendants.length; i < l; i++) {
+      jqLiteRemoveData(descendants[i]);
+    }
   }
 }
 
@@ -13474,7 +12146,7 @@ function jqLiteOff(element, type, fn, unsupported) {
   if (!type) {
     for (type in events) {
       if (type !== '$destroy') {
-        element.removeEventListener(type, handle);
+        removeEventListenerFn(element, type, handle);
       }
       delete events[type];
     }
@@ -13486,7 +12158,7 @@ function jqLiteOff(element, type, fn, unsupported) {
         arrayRemove(listenerFns || [], fn);
       }
       if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {
-        element.removeEventListener(type, handle);
+        removeEventListenerFn(element, type, handle);
         delete events[type];
       }
     };
@@ -13537,7 +12209,6 @@ function jqLiteExpandoStore(element, createIfNecessary) {
 
 function jqLiteData(element, key, value) {
   if (jqLiteAcceptsData(element)) {
-    var prop;
 
     var isSimpleSetter = isDefined(value);
     var isSimpleGetter = !isSimpleSetter && key && !isObject(key);
@@ -13546,18 +12217,16 @@ function jqLiteData(element, key, value) {
     var data = expandoStore && expandoStore.data;
 
     if (isSimpleSetter) { // data('key', value)
-      data[kebabToCamel(key)] = value;
+      data[key] = value;
     } else {
       if (massGetter) {  // data()
         return data;
       } else {
         if (isSimpleGetter) { // data('key')
           // don't force creation of expandoStore if it doesn't exist yet
-          return data && data[kebabToCamel(key)];
+          return data && data[key];
         } else { // mass-setter: data({key1: val1, key2: val2})
-          for (prop in key) {
-            data[kebabToCamel(prop)] = key[prop];
-          }
+          extend(data, key);
         }
       }
     }
@@ -13566,17 +12235,17 @@ function jqLiteData(element, key, value) {
 
 function jqLiteHasClass(element, selector) {
   if (!element.getAttribute) return false;
-  return ((' ' + (element.getAttribute('class') || '') + ' ').replace(/[\n\t]/g, ' ').
-      indexOf(' ' + selector + ' ') > -1);
+  return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
+      indexOf(" " + selector + " ") > -1);
 }
 
 function jqLiteRemoveClass(element, cssClasses) {
   if (cssClasses && element.setAttribute) {
     forEach(cssClasses.split(' '), function(cssClass) {
       element.setAttribute('class', trim(
-          (' ' + (element.getAttribute('class') || '') + ' ')
-          .replace(/[\n\t]/g, ' ')
-          .replace(' ' + trim(cssClass) + ' ', ' '))
+          (" " + (element.getAttribute('class') || '') + " ")
+          .replace(/[\n\t]/g, " ")
+          .replace(" " + trim(cssClass) + " ", " "))
       );
     });
   }
@@ -13585,7 +12254,7 @@ function jqLiteRemoveClass(element, cssClasses) {
 function jqLiteAddClass(element, cssClasses) {
   if (cssClasses && element.setAttribute) {
     var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')
-                            .replace(/[\n\t]/g, ' ');
+                            .replace(/[\n\t]/g, " ");
 
     forEach(cssClasses.split(' '), function(cssClass) {
       cssClass = trim(cssClass);
@@ -13632,7 +12301,7 @@ function jqLiteController(element, name) {
 function jqLiteInheritedData(element, name, value) {
   // if element is the document object work with the html element instead
   // this makes $(document).scope() possible
-  if (element.nodeType === NODE_TYPE_DOCUMENT) {
+  if (element.nodeType == NODE_TYPE_DOCUMENT) {
     element = element.documentElement;
   }
   var names = isArray(name) ? name : [name];
@@ -13676,32 +12345,30 @@ function jqLiteDocumentLoaded(action, win) {
   }
 }
 
-function jqLiteReady(fn) {
-  function trigger() {
-    window.document.removeEventListener('DOMContentLoaded', trigger);
-    window.removeEventListener('load', trigger);
-    fn();
-  }
-
-  // check if document is already loaded
-  if (window.document.readyState === 'complete') {
-    window.setTimeout(fn);
-  } else {
-    // We can not use jqLite since we are not done loading and jQuery could be loaded later.
-
-    // Works for modern browsers and IE9
-    window.document.addEventListener('DOMContentLoaded', trigger);
-
-    // Fallback to window.onload for others
-    window.addEventListener('load', trigger);
-  }
-}
-
 //////////////////////////////////////////
 // Functions which are declared directly.
 //////////////////////////////////////////
 var JQLitePrototype = JQLite.prototype = {
-  ready: jqLiteReady,
+  ready: function(fn) {
+    var fired = false;
+
+    function trigger() {
+      if (fired) return;
+      fired = true;
+      fn();
+    }
+
+    // check if document is already loaded
+    if (window.document.readyState === 'complete') {
+      window.setTimeout(trigger);
+    } else {
+      this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9
+      // we can not use jqLite since we are not done loading and jQuery could be loaded later.
+      // jshint -W064
+      JQLite(window).on('load', trigger); // fallback to window.onload for others
+      // jshint +W064
+    }
+  },
   toString: function() {
     var value = [];
     forEach(this, function(e) { value.push('' + e);});
@@ -13736,8 +12403,7 @@ var ALIASED_ATTR = {
   'ngMaxlength': 'maxlength',
   'ngMin': 'min',
   'ngMax': 'max',
-  'ngPattern': 'pattern',
-  'ngStep': 'step'
+  'ngPattern': 'pattern'
 };
 
 function getBooleanAttrName(element, name) {
@@ -13756,11 +12422,7 @@ forEach({
   data: jqLiteData,
   removeData: jqLiteRemoveData,
   hasData: jqLiteHasData,
-  cleanData: function jqLiteCleanData(nodes) {
-    for (var i = 0, ii = nodes.length; i < ii; i++) {
-      jqLiteRemoveData(nodes[i]);
-    }
-  }
+  cleanData: jqLiteCleanData
 }, function(fn, name) {
   JQLite[name] = fn;
 });
@@ -13792,7 +12454,7 @@ forEach({
   hasClass: jqLiteHasClass,
 
   css: function(element, name, value) {
-    name = cssKebabToCamel(name);
+    name = camelCase(name);
 
     if (isDefined(value)) {
       element.style[name] = value;
@@ -13802,33 +12464,33 @@ forEach({
   },
 
   attr: function(element, name, value) {
-    var ret;
     var nodeType = element.nodeType;
-    if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT ||
-      !element.getAttribute) {
+    if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT) {
       return;
     }
-
     var lowercasedName = lowercase(name);
-    var isBooleanAttr = BOOLEAN_ATTR[lowercasedName];
-
-    if (isDefined(value)) {
-      // setter
-
-      if (value === null || (value === false && isBooleanAttr)) {
-        element.removeAttribute(name);
+    if (BOOLEAN_ATTR[lowercasedName]) {
+      if (isDefined(value)) {
+        if (!!value) {
+          element[name] = true;
+          element.setAttribute(name, lowercasedName);
+        } else {
+          element[name] = false;
+          element.removeAttribute(lowercasedName);
+        }
       } else {
-        element.setAttribute(name, isBooleanAttr ? lowercasedName : value);
-      }
-    } else {
-      // getter
-
-      ret = element.getAttribute(name);
-
-      if (isBooleanAttr && ret !== null) {
-        ret = lowercasedName;
-      }
-      // Normalize non-existing attributes to undefined (as jQuery).
+        return (element[name] ||
+                 (element.attributes.getNamedItem(name) || noop).specified)
+               ? lowercasedName
+               : undefined;
+      }
+    } else if (isDefined(value)) {
+      element.setAttribute(name, value);
+    } else if (element.getAttribute) {
+      // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code
+      // some elements (e.g. Document) don't have get attribute, so return undefined
+      var ret = element.getAttribute(name, 2);
+      // normalize non-existing attributes to undefined (as jQuery)
       return ret === null ? undefined : ret;
     }
   },
@@ -13863,7 +12525,7 @@ forEach({
             result.push(option.value || option.text);
           }
         });
-        return result;
+        return result.length === 0 ? null : result;
       }
       return element.value;
     }
@@ -13891,7 +12553,7 @@ forEach({
     // in a way that survives minification.
     // jqLiteEmpty takes no arguments but is a setter.
     if (fn !== jqLiteEmpty &&
-        (isUndefined((fn.length === 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {
+        (isUndefined((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {
       if (isObject(arg1)) {
 
         // we are a write, but the object properties are the key/values
@@ -14033,7 +12695,7 @@ forEach({
         eventFns = events[type] = [];
         eventFns.specialHandlerWrapper = specialHandlerWrapper;
         if (type !== '$destroy' && !noEventListener) {
-          element.addEventListener(type, handle);
+          addEventListenerFn(element, type, handle);
         }
       }
 
@@ -14126,15 +12788,12 @@ forEach({
 
   after: function(element, newElement) {
     var index = element, parent = element.parentNode;
+    newElement = new JQLite(newElement);
 
-    if (parent) {
-      newElement = new JQLite(newElement);
-
-      for (var i = 0, ii = newElement.length; i < ii; i++) {
-        var node = newElement[i];
-        parent.insertBefore(node, index.nextSibling);
-        index = node;
-      }
+    for (var i = 0, ii = newElement.length; i < ii; i++) {
+      var node = newElement[i];
+      parent.insertBefore(node, index.nextSibling);
+      index = node;
     }
   },
 
@@ -14228,15 +12887,14 @@ forEach({
     }
     return isDefined(value) ? value : this;
   };
-});
 
-// bind legacy bind/unbind to on/off
-JQLite.prototype.bind = JQLite.prototype.on;
-JQLite.prototype.unbind = JQLite.prototype.off;
+  // bind legacy bind/unbind to on/off
+  JQLite.prototype.bind = JQLite.prototype.on;
+  JQLite.prototype.unbind = JQLite.prototype.off;
+});
 
 
 // Provider for private $$jqLite service
-/** @this */
 function $$jqLiteProvider() {
   this.$get = function $$jqLite() {
     return extend(JQLite, {
@@ -14279,7 +12937,7 @@ function hashKey(obj, nextUidFn) {
   }
 
   var objType = typeof obj;
-  if (objType === 'function' || (objType === 'object' && obj !== null)) {
+  if (objType == 'function' || (objType == 'object' && obj !== null)) {
     key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();
   } else {
     key = objType + ':' + obj;
@@ -14288,70 +12946,50 @@ function hashKey(obj, nextUidFn) {
   return key;
 }
 
-// A minimal ES2015 Map implementation.
-// Should be bug/feature equivalent to the native implementations of supported browsers
-// (for the features required in Angular).
-// See https://kangax.github.io/compat-table/es6/#test-Map
-var nanKey = Object.create(null);
-function NgMapShim() {
-  this._keys = [];
-  this._values = [];
-  this._lastKey = NaN;
-  this._lastIndex = -1;
-}
-NgMapShim.prototype = {
-  _idx: function(key) {
-    if (key === this._lastKey) {
-      return this._lastIndex;
-    }
-    this._lastKey = key;
-    this._lastIndex = this._keys.indexOf(key);
-    return this._lastIndex;
-  },
-  _transformKey: function(key) {
-    return isNumberNaN(key) ? nanKey : key;
+/**
+ * HashMap which can use objects as keys
+ */
+function HashMap(array, isolatedUid) {
+  if (isolatedUid) {
+    var uid = 0;
+    this.nextUid = function() {
+      return ++uid;
+    };
+  }
+  forEach(array, this.put, this);
+}
+HashMap.prototype = {
+  /**
+   * Store key value pair
+   * @param key key to store can be any type
+   * @param value value to store can be any type
+   */
+  put: function(key, value) {
+    this[hashKey(key, this.nextUid)] = value;
   },
+
+  /**
+   * @param key
+   * @returns {Object} the value for the key
+   */
   get: function(key) {
-    key = this._transformKey(key);
-    var idx = this._idx(key);
-    if (idx !== -1) {
-      return this._values[idx];
-    }
+    return this[hashKey(key, this.nextUid)];
   },
-  set: function(key, value) {
-    key = this._transformKey(key);
-    var idx = this._idx(key);
-    if (idx === -1) {
-      idx = this._lastIndex = this._keys.length;
-    }
-    this._keys[idx] = key;
-    this._values[idx] = value;
 
-    // Support: IE11
-    // Do not `return this` to simulate the partial IE11 implementation
-  },
-  delete: function(key) {
-    key = this._transformKey(key);
-    var idx = this._idx(key);
-    if (idx === -1) {
-      return false;
-    }
-    this._keys.splice(idx, 1);
-    this._values.splice(idx, 1);
-    this._lastKey = NaN;
-    this._lastIndex = -1;
-    return true;
+  /**
+   * Remove the key/value pair
+   * @param key
+   */
+  remove: function(key) {
+    var value = this[key = hashKey(key, this.nextUid)];
+    delete this[key];
+    return value;
   }
 };
 
-// For now, always use `NgMapShim`, even if `window.Map` is available. Some native implementations
-// are still buggy (often in subtle ways) and can cause hard-to-debug failures. When native `Map`
-// implementations get more stable, we can reconsider switching to `window.Map` (when available).
-var NgMap = NgMapShim;
-
-var $$MapProvider = [/** @this */function() {
+var $$HashMapProvider = [function() {
   this.$get = [function() {
-    return NgMap;
+    return HashMap;
   }];
 }];
 
@@ -14418,19 +13056,15 @@ var $$MapProvider = [/** @this */function() {
  * Implicit module which gets automatically added to each {@link auto.$injector $injector}.
  */
 
-var ARROW_ARG = /^([^(]+?)=>/;
-var FN_ARGS = /^[^(]*\(\s*([^)]*)\)/m;
+var ARROW_ARG = /^([^\(]+?)=>/;
+var FN_ARGS = /^[^\(]*\(\s*([^\)]*)\)/m;
 var FN_ARG_SPLIT = /,/;
 var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
 var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
 var $injectorMinErr = minErr('$injector');
 
-function stringifyFn(fn) {
-  return Function.prototype.toString.call(fn);
-}
-
 function extractArgs(fn) {
-  var fnText = stringifyFn(fn).replace(STRIP_COMMENTS, ''),
+  var fnText = Function.prototype.toString.call(fn).replace(STRIP_COMMENTS, ''),
       args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
   return args;
 }
@@ -14536,28 +13170,6 @@ function annotate(fn, strictDi, name) {
  */
 
 /**
- * @ngdoc property
- * @name $injector#modules
- * @type {Object}
- * @description
- * A hash containing all the modules that have been loaded into the
- * $injector.
- *
- * You can use this property to find out information about a module via the
- * {@link angular.Module#info `myModule.info(...)`} method.
- *
- * For example:
- *
- * ```
- * var info = $injector.modules['ngAnimate'].info();
- * ```
- *
- * **Do not use this property to attempt to modify the modules after the application
- * has been bootstrapped.**
- */
-
-
-/**
  * @ngdoc method
  * @name $injector#get
  *
@@ -14695,6 +13307,7 @@ function annotate(fn, strictDi, name) {
 
 
 
+
 /**
  * @ngdoc service
  * @name $provide
@@ -14719,20 +13332,18 @@ function annotate(fn, strictDi, name) {
  * these cases the {@link auto.$provide $provide} service has additional helper methods to register
  * services without specifying a provider.
  *
- * * {@link auto.$provide#provider provider(name, provider)} - registers a **service provider** with the
+ * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the
  *     {@link auto.$injector $injector}
- * * {@link auto.$provide#constant constant(name, obj)} - registers a value/object that can be accessed by
+ * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by
  *     providers and services.
- * * {@link auto.$provide#value value(name, obj)} - registers a value/object that can only be accessed by
+ * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by
  *     services, not providers.
- * * {@link auto.$provide#factory factory(name, fn)} - registers a service **factory function**
+ * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,
  *     that will be wrapped in a **service provider** object, whose `$get` property will contain the
  *     given factory function.
- * * {@link auto.$provide#service service(name, Fn)} - registers a **constructor function**
+ * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`
  *     that will be wrapped in a **service provider** object, whose `$get` property will instantiate
  *      a new object using the given constructor function.
- * * {@link auto.$provide#decorator decorator(name, decorFn)} - registers a **decorator function** that
- *      will be able to modify or replace the implementation of another service.
  *
  * See the individual methods for more information and examples.
  */
@@ -14989,20 +13600,18 @@ function annotate(fn, strictDi, name) {
  * @name $provide#decorator
  * @description
  *
- * Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function
+ * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator
  * intercepts the creation of a service, allowing it to override or modify the behavior of the
- * service. The return value of the decorator function may be the original service, or a new service
- * that replaces (or wraps and delegates to) the original service.
- *
- * You can find out more about using decorators in the {@link guide/decorators} guide.
+ * service. The object returned by the decorator may be the original service, or a new service
+ * object which replaces or wraps and delegates to the original service.
  *
  * @param {string} name The name of the service to decorate.
  * @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be
- *    provided and should return the decorated service instance. The function is called using
+ *    instantiated and should return the decorated service instance. The function is called using
  *    the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.
  *    Local injection arguments:
  *
- *    * `$delegate` - The original service instance, which can be replaced, monkey patched, configured,
+ *    * `$delegate` - The original service instance, which can be monkey patched, configured,
  *      decorated or delegated to.
  *
  * @example
@@ -15022,7 +13631,7 @@ function createInjector(modulesToLoad, strictDi) {
   var INSTANTIATING = {},
       providerSuffix = 'Provider',
       path = [],
-      loadedModules = new NgMap(),
+      loadedModules = new HashMap([], true),
       providerCache = {
         $provide: {
             provider: supportObject(provider),
@@ -15038,7 +13647,7 @@ function createInjector(modulesToLoad, strictDi) {
             if (angular.isString(caller)) {
               path.push(caller);
             }
-            throw $injectorMinErr('unpr', 'Unknown provider: {0}', path.join(' <- '));
+            throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- '));
           })),
       instanceCache = {},
       protoInstanceInjector =
@@ -15050,7 +13659,6 @@ function createInjector(modulesToLoad, strictDi) {
       instanceInjector = protoInstanceInjector;
 
   providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) };
-  instanceInjector.modules = providerInjector.modules = createMap();
   var runBlocks = loadModules(modulesToLoad);
   instanceInjector = protoInstanceInjector.get('$injector');
   instanceInjector.strictDi = strictDi;
@@ -15078,16 +13686,16 @@ function createInjector(modulesToLoad, strictDi) {
       provider_ = providerInjector.instantiate(provider_);
     }
     if (!provider_.$get) {
-      throw $injectorMinErr('pget', 'Provider \'{0}\' must define $get factory method.', name);
+      throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name);
     }
-    return (providerCache[name + providerSuffix] = provider_);
+    return providerCache[name + providerSuffix] = provider_;
   }
 
   function enforceReturnValue(name, factory) {
-    return /** @this */ function enforcedReturnValue() {
+    return function enforcedReturnValue() {
       var result = instanceInjector.invoke(factory, this);
       if (isUndefined(result)) {
-        throw $injectorMinErr('undef', 'Provider \'{0}\' must return a value from $get factory method.', name);
+        throw $injectorMinErr('undef', "Provider '{0}' must return a value from $get factory method.", name);
       }
       return result;
     };
@@ -15131,7 +13739,7 @@ function createInjector(modulesToLoad, strictDi) {
     var runBlocks = [], moduleFn;
     forEach(modulesToLoad, function(module) {
       if (loadedModules.get(module)) return;
-      loadedModules.set(module, true);
+      loadedModules.put(module, true);
 
       function runInvokeQueue(queue) {
         var i, ii;
@@ -15146,7 +13754,6 @@ function createInjector(modulesToLoad, strictDi) {
       try {
         if (isString(module)) {
           moduleFn = angularModule(module);
-          instanceInjector.modules[module] = moduleFn;
           runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
           runInvokeQueue(moduleFn._invokeQueue);
           runInvokeQueue(moduleFn._configBlocks);
@@ -15161,15 +13768,15 @@ function createInjector(modulesToLoad, strictDi) {
         if (isArray(module)) {
           module = module[module.length - 1];
         }
-        if (e.message && e.stack && e.stack.indexOf(e.message) === -1) {
+        if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
           // Safari & FF's stack traces don't contain error.message content
           // unlike those of Chrome and IE
           // So if stack doesn't contain message, we create a new string that contains both.
           // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
-          // eslint-disable-next-line no-ex-assign
+          /* jshint -W022 */
           e = e.message + '\n' + e.stack;
         }
-        throw $injectorMinErr('modulerr', 'Failed to instantiate module {0} due to:\n{1}',
+        throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
                   module, e.stack || e.message || e);
       }
     });
@@ -15193,8 +13800,7 @@ function createInjector(modulesToLoad, strictDi) {
         try {
           path.unshift(serviceName);
           cache[serviceName] = INSTANTIATING;
-          cache[serviceName] = factory(serviceName, caller);
-          return cache[serviceName];
+          return cache[serviceName] = factory(serviceName, caller);
         } catch (err) {
           if (cache[serviceName] === INSTANTIATING) {
             delete cache[serviceName];
@@ -15224,18 +13830,14 @@ function createInjector(modulesToLoad, strictDi) {
     }
 
     function isClass(func) {
-      // Support: IE 9-11 only
       // IE 9-11 do not support classes and IE9 leaks with the code below.
-      if (msie || typeof func !== 'function') {
+      if (msie <= 11) {
         return false;
       }
-      var result = func.$$ngIsClass;
-      if (!isBoolean(result)) {
-        // Support: Edge 12-13 only
-        // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/6156135/
-        result = func.$$ngIsClass = /^(?:class\b|constructor\()/.test(stringifyFn(func));
-      }
-      return result;
+      // Workaround for MS Edge.
+      // Check https://connect.microsoft.com/IE/Feedback/Details/2211653
+      return typeof func === 'function'
+        && /^(?:class\s|constructor\()/.test(Function.prototype.toString.call(func));
     }
 
     function invoke(fn, self, locals, serviceName) {
@@ -15288,7 +13890,6 @@ createInjector.$$annotate = annotate;
 /**
  * @ngdoc provider
  * @name $anchorScrollProvider
- * @this
  *
  * @description
  * Use `$anchorScrollProvider` to disable automatic scrolling whenever
@@ -15327,7 +13928,7 @@ function $AnchorScrollProvider() {
    * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the
    * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified
    * in the
-   * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#an-indicated-part-of-the-document).
+   * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#the-indicated-part-of-the-document).
    *
    * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to
    * match any anchor whenever it changes. This can be disabled by calling
@@ -15360,7 +13961,7 @@ function $AnchorScrollProvider() {
    * </div>
    *
    * @example
-     <example module="anchorScrollExample" name="anchor-scroll">
+     <example module="anchorScrollExample">
        <file name="index.html">
          <div id="scrollArea" ng-controller="ScrollController">
            <a ng-click="gotoBottom()">Go to bottom</a>
@@ -15370,7 +13971,7 @@ function $AnchorScrollProvider() {
        <file name="script.js">
          angular.module('anchorScrollExample', [])
            .controller('ScrollController', ['$scope', '$location', '$anchorScroll',
-             function($scope, $location, $anchorScroll) {
+             function ($scope, $location, $anchorScroll) {
                $scope.gotoBottom = function() {
                  // set the location.hash to the id of
                  // the element you wish to scroll to.
@@ -15399,7 +14000,7 @@ function $AnchorScrollProvider() {
    * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details.
    *
    * @example
-     <example module="anchorScrollOffsetExample" name="anchor-scroll-offset">
+     <example module="anchorScrollOffsetExample">
        <file name="index.html">
          <div class="fixed-header" ng-controller="headerCtrl">
            <a href="" ng-click="gotoAnchor(x)" ng-repeat="x in [1,2,3,4,5]">
@@ -15416,7 +14017,7 @@ function $AnchorScrollProvider() {
              $anchorScroll.yOffset = 50;   // always scroll by 50 extra pixels
            }])
            .controller('headerCtrl', ['$anchorScroll', '$location', '$scope',
-             function($anchorScroll, $location, $scope) {
+             function ($anchorScroll, $location, $scope) {
                $scope.gotoAnchor = function(x) {
                  var newHash = 'anchor' + x;
                  if ($location.hash() !== newHash) {
@@ -15523,8 +14124,7 @@ function $AnchorScrollProvider() {
     }
 
     function scroll(hash) {
-      // Allow numeric hashes
-      hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash();
+      hash = isString(hash) ? hash : $location.hash();
       var elm;
 
       // empty hash, scroll to the top of the page
@@ -15536,7 +14136,7 @@ function $AnchorScrollProvider() {
       // first anchor with given name :-D
       else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
 
-      // no element and hash === 'top', scroll to the top of the page
+      // no element and hash == 'top', scroll to the top of the page
       else if (hash === 'top') scrollTo(null);
     }
 
@@ -15611,14 +14211,14 @@ function prepareAnimateOptions(options) {
       : {};
 }
 
-var $$CoreAnimateJsProvider = /** @this */ function() {
+var $$CoreAnimateJsProvider = function() {
   this.$get = noop;
 };
 
 // this is prefixed with Core since it conflicts with
 // the animateQueueProvider defined in ngAnimate/animateQueue.js
-var $$CoreAnimateQueueProvider = /** @this */ function() {
-  var postDigestQueue = new NgMap();
+var $$CoreAnimateQueueProvider = function() {
+  var postDigestQueue = new HashMap();
   var postDigestElements = [];
 
   this.$get = ['$$AnimateRunner', '$rootScope',
@@ -15630,23 +14230,17 @@ var $$CoreAnimateQueueProvider = /** @this */ function() {
       pin: noop,
 
       push: function(element, event, options, domOperation) {
-        if (domOperation) {
-          domOperation();
-        }
+        domOperation        && domOperation();
 
         options = options || {};
-        if (options.from) {
-          element.css(options.from);
-        }
-        if (options.to) {
-          element.css(options.to);
-        }
+        options.from        && element.css(options.from);
+        options.to          && element.css(options.to);
 
         if (options.addClass || options.removeClass) {
           addRemoveClassesPostDigest(element, options.addClass, options.removeClass);
         }
 
-        var runner = new $$AnimateRunner();
+        var runner = new $$AnimateRunner(); // jshint ignore:line
 
         // since there are no animations to run the runner needs to be
         // notified that the animation call is complete.
@@ -15690,14 +14284,10 @@ var $$CoreAnimateQueueProvider = /** @this */ function() {
           });
 
           forEach(element, function(elm) {
-            if (toAdd) {
-              jqLiteAddClass(elm, toAdd);
-            }
-            if (toRemove) {
-              jqLiteRemoveClass(elm, toRemove);
-            }
+            toAdd    && jqLiteAddClass(elm, toAdd);
+            toRemove && jqLiteRemoveClass(elm, toRemove);
           });
-          postDigestQueue.delete(element);
+          postDigestQueue.remove(element);
         }
       });
       postDigestElements.length = 0;
@@ -15712,7 +14302,7 @@ var $$CoreAnimateQueueProvider = /** @this */ function() {
 
       if (classesAdded || classesRemoved) {
 
-        postDigestQueue.set(element, data);
+        postDigestQueue.put(element, data);
         postDigestElements.push(element);
 
         if (postDigestElements.length === 1) {
@@ -15735,9 +14325,8 @@ var $$CoreAnimateQueueProvider = /** @this */ function() {
  *
  * To see the functional implementation check out `src/ngAnimate/animate.js`.
  */
-var $AnimateProvider = ['$provide', /** @this */ function($provide) {
+var $AnimateProvider = ['$provide', function($provide) {
   var provider = this;
-  var classNameFilter = null;
 
   this.$$registeredAnimations = Object.create(null);
 
@@ -15782,7 +14371,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
    */
   this.register = function(name, factory) {
     if (name && name.charAt(0) !== '.') {
-      throw $animateMinErr('notcsel', 'Expecting class selector starting with \'.\' got \'{0}\'.', name);
+      throw $animateMinErr('notcsel', "Expecting class selector starting with '.' got '{0}'.", name);
     }
 
     var key = name + '-animation';
@@ -15806,16 +14395,16 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
    */
   this.classNameFilter = function(expression) {
     if (arguments.length === 1) {
-      classNameFilter = (expression instanceof RegExp) ? expression : null;
-      if (classNameFilter) {
-        var reservedRegex = new RegExp('[(\\s|\\/)]' + NG_ANIMATE_CLASSNAME + '[(\\s|\\/)]');
-        if (reservedRegex.test(classNameFilter.toString())) {
-          classNameFilter = null;
-          throw $animateMinErr('nongcls', '$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
+      this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
+      if (this.$$classNameFilter) {
+        var reservedRegex = new RegExp("(\\s+|\\/)" + NG_ANIMATE_CLASSNAME + "(\\s+|\\/)");
+        if (reservedRegex.test(this.$$classNameFilter.toString())) {
+          throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
+
         }
       }
     }
-    return classNameFilter;
+    return this.$$classNameFilter;
   };
 
   this.$get = ['$$animateQueue', function($$animateQueue) {
@@ -15829,11 +14418,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
           afterElement = null;
         }
       }
-      if (afterElement) {
-        afterElement.after(element);
-      } else {
-        parentElement.prepend(element);
-      }
+      afterElement ? afterElement.after(element) : parentElement.prepend(element);
     }
 
     /**
@@ -15976,9 +14561,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
        * @param {Promise} animationPromise The animation promise that is returned when an animation is started.
        */
       cancel: function(runner) {
-        if (runner.end) {
-          runner.end();
-        }
+        runner.end && runner.end();
       },
 
       /**
@@ -15995,13 +14578,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
        * @param {DOMElement} parent the parent element which will append the element as
        *   a child (so long as the after element is not present)
        * @param {DOMElement=} after the sibling element after which the element will be appended
-       * @param {object=} options an optional collection of options/styles that will be applied to the element.
-       *   The object can have the following properties:
-       *
-       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
-       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
-       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
-       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       * @param {object=} options an optional collection of options/styles that will be applied to the element
        *
        * @return {Promise} the animation callback promise
        */
@@ -16027,13 +14604,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
        * @param {DOMElement} parent the parent element which will append the element as
        *   a child (so long as the after element is not present)
        * @param {DOMElement=} after the sibling element after which the element will be appended
-       * @param {object=} options an optional collection of options/styles that will be applied to the element.
-       *   The object can have the following properties:
-       *
-       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
-       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
-       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
-       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       * @param {object=} options an optional collection of options/styles that will be applied to the element
        *
        * @return {Promise} the animation callback promise
        */
@@ -16054,13 +14625,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
        * digest once the animation has completed.
        *
        * @param {DOMElement} element the element which will be removed from the DOM
-       * @param {object=} options an optional collection of options/styles that will be applied to the element.
-       *   The object can have the following properties:
-       *
-       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
-       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
-       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
-       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       * @param {object=} options an optional collection of options/styles that will be applied to the element
        *
        * @return {Promise} the animation callback promise
        */
@@ -16084,13 +14649,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
        *
        * @param {DOMElement} element the element which the CSS classes will be applied to
        * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
-       * @param {object=} options an optional collection of options/styles that will be applied to the element.
-       *   The object can have the following properties:
-       *
-       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
-       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
-       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
-       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       * @param {object=} options an optional collection of options/styles that will be applied to the element
        *
        * @return {Promise} the animation callback promise
        */
@@ -16114,13 +14673,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
        *
        * @param {DOMElement} element the element which the CSS classes will be applied to
        * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
-       * @param {object=} options an optional collection of options/styles that will be applied to the element.
-       *   The object can have the following properties:
-       *
-       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
-       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
-       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
-       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       * @param {object=} options an optional collection of options/styles that will be applied to the element
        *
        * @return {Promise} the animation callback promise
        */
@@ -16145,13 +14698,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
        * @param {DOMElement} element the element which the CSS classes will be applied to
        * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces)
        * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)
-       * @param {object=} options an optional collection of options/styles that will be applied to the element.
-       *   The object can have the following properties:
-       *
-       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
-       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
-       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
-       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       * @param {object=} options an optional collection of options/styles that will be applied to the element
        *
        * @return {Promise} the animation callback promise
        */
@@ -16169,7 +14716,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
        *
        * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element.
        * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take
-       * on the provided styles. For example, if a transition animation is set for the given className, then the provided `from` and
+       * on the provided styles. For example, if a transition animation is set for the given classNamem, then the provided `from` and
        * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding
        * style in `to`, the style in `from` is applied immediately, and no animation is run.
        * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate`
@@ -16192,13 +14739,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
        * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If
        *    this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element.
        *    (Note that if no animation is detected then this value will not be applied to the element.)
-       * @param {object=} options an optional collection of options/styles that will be applied to the element.
-       *   The object can have the following properties:
-       *
-       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
-       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
-       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
-       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       * @param {object=} options an optional collection of options/styles that will be applied to the element
        *
        * @return {Promise} the animation callback promise
        */
@@ -16215,7 +14756,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
   }];
 }];
 
-var $$AnimateAsyncRunFactoryProvider = /** @this */ function() {
+var $$AnimateAsyncRunFactoryProvider = function() {
   this.$get = ['$$rAF', function($$rAF) {
     var waitQueue = [];
 
@@ -16236,19 +14777,15 @@ var $$AnimateAsyncRunFactoryProvider = /** @this */ function() {
         passed = true;
       });
       return function(callback) {
-        if (passed) {
-          callback();
-        } else {
-          waitForTick(callback);
-        }
+        passed ? callback() : waitForTick(callback);
       };
     };
   }];
 };
 
-var $$AnimateRunnerFactoryProvider = /** @this */ function() {
-  this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$$isDocumentHidden', '$timeout',
-       function($q,   $sniffer,   $$animateAsyncRun,   $$isDocumentHidden,   $timeout) {
+var $$AnimateRunnerFactoryProvider = function() {
+  this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$document', '$timeout',
+       function($q,   $sniffer,   $$animateAsyncRun,   $document,   $timeout) {
 
     var INITIAL_STATE = 0;
     var DONE_PENDING_STATE = 1;
@@ -16300,7 +14837,11 @@ var $$AnimateRunnerFactoryProvider = /** @this */ function() {
 
       this._doneCallbacks = [];
       this._tick = function(fn) {
-        if ($$isDocumentHidden()) {
+        var doc = $document[0];
+
+        // the document may not be ready or attached
+        // to the module for some internal tests
+        if (doc && doc.hidden) {
           timeoutTick(fn);
         } else {
           rafTick(fn);
@@ -16329,11 +14870,7 @@ var $$AnimateRunnerFactoryProvider = /** @this */ function() {
           var self = this;
           this.promise = $q(function(resolve, reject) {
             self.done(function(status) {
-              if (status === false) {
-                reject();
-              } else {
-                resolve();
-              }
+              status === false ? reject() : resolve();
             });
           });
         }
@@ -16403,13 +14940,10 @@ var $$AnimateRunnerFactoryProvider = /** @this */ function() {
   }];
 };
 
-/* exported $CoreAnimateCssProvider */
-
 /**
  * @ngdoc service
  * @name $animateCss
  * @kind object
- * @this
  *
  * @description
  * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,
@@ -16442,6 +14976,7 @@ var $CoreAnimateCssProvider = function() {
         options.from = null;
       }
 
+      /* jshint newcap: false */
       var closed, runner = new $$AnimateRunner();
       return {
         start: run,
@@ -16574,6 +15109,7 @@ function Browser(window, document, $log, $sniffer) {
       };
 
   cacheState();
+  lastHistoryState = cachedState;
 
   /**
    * @name $browser#url
@@ -16627,8 +15163,10 @@ function Browser(window, document, $log, $sniffer) {
       if ($sniffer.history && (!sameBase || !sameState)) {
         history[replace ? 'replaceState' : 'pushState'](state, '', url);
         cacheState();
+        // Do the assignment again so that those two variables are referentially identical.
+        lastHistoryState = cachedState;
       } else {
-        if (!sameBase) {
+        if (!sameBase || pendingLocation) {
           pendingLocation = url;
         }
         if (replace) {
@@ -16642,9 +15180,6 @@ function Browser(window, document, $log, $sniffer) {
           pendingLocation = url;
         }
       }
-      if (pendingLocation) {
-        pendingLocation = url;
-      }
       return self;
     // getter
     } else {
@@ -16652,7 +15187,7 @@ function Browser(window, document, $log, $sniffer) {
       //   the new location.href if a reload happened or if there is a bug like in iOS 9 (see
       //   https://openradar.appspot.com/22186109).
       // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
-      return pendingLocation || location.href.replace(/%27/g,'\'');
+      return pendingLocation || location.href.replace(/%27/g,"'");
     }
   };
 
@@ -16675,7 +15210,8 @@ function Browser(window, document, $log, $sniffer) {
 
   function cacheStateAndFireUrlChange() {
     pendingLocation = null;
-    fireStateOrUrlChange();
+    cacheState();
+    fireUrlChange();
   }
 
   // This variable should be used *only* inside the cacheState function.
@@ -16689,16 +15225,11 @@ function Browser(window, document, $log, $sniffer) {
     if (equals(cachedState, lastCachedState)) {
       cachedState = lastCachedState;
     }
-
     lastCachedState = cachedState;
-    lastHistoryState = cachedState;
   }
 
-  function fireStateOrUrlChange() {
-    var prevLastHistoryState = lastHistoryState;
-    cacheState();
-
-    if (lastBrowserUrl === self.url() && prevLastHistoryState === cachedState) {
+  function fireUrlChange() {
+    if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {
       return;
     }
 
@@ -16733,8 +15264,8 @@ function Browser(window, document, $log, $sniffer) {
   self.onUrlChange = function(callback) {
     // TODO(vojta): refactor to use node's syntax for events
     if (!urlChangeInit) {
-      // We listen on both (hashchange/popstate) when available, as some browsers don't
-      // fire popstate when user changes the address bar and don't fire hashchange when url
+      // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)
+      // don't fire popstate when user change the address bar and don't fire hashchange when url
       // changed by push/replaceState
 
       // html5 history api - popstate event
@@ -16764,7 +15295,7 @@ function Browser(window, document, $log, $sniffer) {
    * Needs to be exported to be able to check for changes that have been done in sync,
    * as hashchange/popstate events fire in async.
    */
-  self.$$checkUrlChange = fireStateOrUrlChange;
+  self.$$checkUrlChange = fireUrlChange;
 
   //////////////////////////////////////////////////////////////
   // Misc API
@@ -16781,7 +15312,7 @@ function Browser(window, document, $log, $sniffer) {
    */
   self.baseHref = function() {
     var href = baseElement.attr('href');
-    return href ? href.replace(/^(https?:)?\/\/[^/]*/, '') : '';
+    return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, '') : '';
   };
 
   /**
@@ -16832,7 +15363,6 @@ function Browser(window, document, $log, $sniffer) {
 
 }
 
-/** @this */
 function $BrowserProvider() {
   this.$get = ['$window', '$log', '$sniffer', '$document',
       function($window, $log, $sniffer, $document) {
@@ -16843,7 +15373,6 @@ function $BrowserProvider() {
 /**
  * @ngdoc service
  * @name $cacheFactory
- * @this
  *
  * @description
  * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
@@ -16880,7 +15409,7 @@ function $BrowserProvider() {
  * - `{void}` `destroy()` â€” Removes references to this cache from $cacheFactory.
  *
  * @example
-   <example module="cacheExampleApp" name="cache-factory">
+   <example module="cacheExampleApp">
      <file name="index.html">
        <div ng-controller="CacheController">
          <input ng-model="newCacheKey" placeholder="Key">
@@ -16929,7 +15458,7 @@ function $CacheFactoryProvider() {
 
     function cacheFactory(cacheId, options) {
       if (cacheId in caches) {
-        throw minErr('$cacheFactory')('iid', 'CacheId \'{0}\' is already taken!', cacheId);
+        throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId);
       }
 
       var size = 0,
@@ -16979,7 +15508,7 @@ function $CacheFactoryProvider() {
        *  }));
        * ```
        */
-      return (caches[cacheId] = {
+      return caches[cacheId] = {
 
         /**
          * @ngdoc method
@@ -17057,8 +15586,8 @@ function $CacheFactoryProvider() {
 
             if (!lruEntry) return;
 
-            if (lruEntry === freshEnd) freshEnd = lruEntry.p;
-            if (lruEntry === staleEnd) staleEnd = lruEntry.n;
+            if (lruEntry == freshEnd) freshEnd = lruEntry.p;
+            if (lruEntry == staleEnd) staleEnd = lruEntry.n;
             link(lruEntry.n,lruEntry.p);
 
             delete lruHash[key];
@@ -17123,17 +15652,17 @@ function $CacheFactoryProvider() {
         info: function() {
           return extend({}, stats, {size: size});
         }
-      });
+      };
 
 
       /**
        * makes the `entry` the freshEnd of the LRU linked list
        */
       function refresh(entry) {
-        if (entry !== freshEnd) {
+        if (entry != freshEnd) {
           if (!staleEnd) {
             staleEnd = entry;
-          } else if (staleEnd === entry) {
+          } else if (staleEnd == entry) {
             staleEnd = entry.n;
           }
 
@@ -17149,7 +15678,7 @@ function $CacheFactoryProvider() {
        * bidirectionally links two entries of the LRU linked list
        */
       function link(nextEntry, prevEntry) {
-        if (nextEntry !== prevEntry) {
+        if (nextEntry != prevEntry) {
           if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify
           if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify
         }
@@ -17197,7 +15726,6 @@ function $CacheFactoryProvider() {
 /**
  * @ngdoc service
  * @name $templateCache
- * @this
  *
  * @description
  * The first time a template is used, it is loaded in the template cache for quick retrieval. You
@@ -17225,14 +15753,12 @@ function $CacheFactoryProvider() {
  * });
  * ```
  *
- * To retrieve the template later, simply use it in your component:
- * ```js
- * myApp.component('myComponent', {
- *    templateUrl: 'templateId.html'
- * });
+ * To retrieve the template later, simply use it in your HTML:
+ * ```html
+ * <div ng-include=" 'templateId.html' "></div>
  * ```
  *
- * or get it via the `$templateCache` service:
+ * or get it via Javascript:
  * ```js
  * $templateCache.get('templateId.html')
  * ```
@@ -17254,7 +15780,7 @@ function $TemplateCacheProvider() {
  *                                                                         *
  *  Does the change somehow allow for arbitrary javascript to be executed? *
  *    Or allows for someone to change the prototype of built-in objects?   *
- *     Or gives undesired access to variables like document or window?    *
+ *     Or gives undesired access to variables likes document or window?    *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!
@@ -17298,9 +15824,8 @@ function $TemplateCacheProvider() {
  * There are many different options for a directive.
  *
  * The difference resides in the return value of the factory function.
- * You can either return a {@link $compile#directive-definition-object Directive Definition Object (see below)}
- * that defines the directive properties, or just the `postLink` function (all other properties will have
- * the default values).
+ * You can either return a "Directive Definition Object" (see below) that defines the directive properties,
+ * or just the `postLink` function (all other properties will have the default values).
  *
  * <div class="alert alert-success">
  * **Best Practice:** It's recommended to use the "directive definition object" form.
@@ -17313,34 +15838,33 @@ function $TemplateCacheProvider() {
  *
  *   myModule.directive('directiveName', function factory(injectables) {
  *     var directiveDefinitionObject = {
- *       {@link $compile#-priority- priority}: 0,
- *       {@link $compile#-template- template}: '<div></div>', // or // function(tElement, tAttrs) { ... },
+ *       priority: 0,
+ *       template: '<div></div>', // or // function(tElement, tAttrs) { ... },
  *       // or
- *       // {@link $compile#-templateurl- templateUrl}: 'directive.html', // or // function(tElement, tAttrs) { ... },
- *       {@link $compile#-transclude- transclude}: false,
- *       {@link $compile#-restrict- restrict}: 'A',
- *       {@link $compile#-templatenamespace- templateNamespace}: 'html',
- *       {@link $compile#-scope- scope}: false,
- *       {@link $compile#-controller- controller}: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
- *       {@link $compile#-controlleras- controllerAs}: 'stringIdentifier',
- *       {@link $compile#-bindtocontroller- bindToController}: false,
- *       {@link $compile#-require- require}: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
- *       {@link $compile#-multielement- multiElement}: false,
- *       {@link $compile#-compile- compile}: function compile(tElement, tAttrs, transclude) {
+ *       // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },
+ *       transclude: false,
+ *       restrict: 'A',
+ *       templateNamespace: 'html',
+ *       scope: false,
+ *       controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
+ *       controllerAs: 'stringIdentifier',
+ *       bindToController: false,
+ *       require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
+ *       compile: function compile(tElement, tAttrs, transclude) {
  *         return {
- *            {@link $compile#pre-linking-function pre}: function preLink(scope, iElement, iAttrs, controller) { ... },
- *            {@link $compile#post-linking-function post}: function postLink(scope, iElement, iAttrs, controller) { ... }
+ *           pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ *           post: function postLink(scope, iElement, iAttrs, controller) { ... }
  *         }
  *         // or
  *         // return function postLink( ... ) { ... }
  *       },
  *       // or
- *       // {@link $compile#-link- link}: {
- *       //  {@link $compile#pre-linking-function pre}: function preLink(scope, iElement, iAttrs, controller) { ... },
- *       //  {@link $compile#post-linking-function post}: function postLink(scope, iElement, iAttrs, controller) { ... }
+ *       // link: {
+ *       //  pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ *       //  post: function postLink(scope, iElement, iAttrs, controller) { ... }
  *       // }
  *       // or
- *       // {@link $compile#-link- link}: function postLink( ... ) { ... }
+ *       // link: function postLink( ... ) { ... }
  *     };
  *     return directiveDefinitionObject;
  *   });
@@ -17365,126 +15889,6 @@ function $TemplateCacheProvider() {
  *   });
  * ```
  *
- * ### Life-cycle hooks
- * Directive controllers can provide the following methods that are called by Angular at points in the life-cycle of the
- * directive:
- * * `$onInit()` - Called on each controller after all the controllers on an element have been constructed and
- *   had their bindings initialized (and before the pre &amp; post linking functions for the directives on
- *   this element). This is a good place to put initialization code for your controller.
- * * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The
- *   `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an
- *   object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a
- *   component such as cloning the bound value to prevent accidental mutation of the outer value. Note that this will
- *   also be called when your bindings are initialized.
- * * `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on
- *   changes. Any actions that you wish to take in response to the changes that you detect must be
- *   invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook
- *   could be useful if you wish to perform a deep equality check, or to check a Date object, changes to which would not
- *   be detected by Angular's change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments;
- *   if detecting changes, you must store the previous value(s) for comparison to the current values.
- * * `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing
- *   external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in
- *   the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent
- *   components will have their `$onDestroy()` hook called before child components.
- * * `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link
- *   function this hook can be used to set up DOM event handlers and do direct DOM manipulation.
- *   Note that child elements that contain `templateUrl` directives will not have been compiled and linked since
- *   they are waiting for their template to load asynchronously and their own compilation and linking has been
- *   suspended until that occurs.
- *
- * #### Comparison with Angular 2 life-cycle hooks
- * Angular 2 also uses life-cycle hooks for its components. While the Angular 1 life-cycle hooks are similar there are
- * some differences that you should be aware of, especially when it comes to moving your code from Angular 1 to Angular 2:
- *
- * * Angular 1 hooks are prefixed with `$`, such as `$onInit`. Angular 2 hooks are prefixed with `ng`, such as `ngOnInit`.
- * * Angular 1 hooks can be defined on the controller prototype or added to the controller inside its constructor.
- *   In Angular 2 you can only define hooks on the prototype of the Component class.
- * * Due to the differences in change-detection, you may get many more calls to `$doCheck` in Angular 1 than you would to
- *   `ngDoCheck` in Angular 2
- * * Changes to the model inside `$doCheck` will trigger new turns of the digest loop, which will cause the changes to be
- *   propagated throughout the application.
- *   Angular 2 does not allow the `ngDoCheck` hook to trigger a change outside of the component. It will either throw an
- *   error or do nothing depending upon the state of `enableProdMode()`.
- *
- * #### Life-cycle hook examples
- *
- * This example shows how you can check for mutations to a Date object even though the identity of the object
- * has not changed.
- *
- * <example name="doCheckDateExample" module="do-check-module">
- *   <file name="app.js">
- *     angular.module('do-check-module', [])
- *       .component('app', {
- *         template:
- *           'Month: <input ng-model="$ctrl.month" ng-change="$ctrl.updateDate()">' +
- *           'Date: {{ $ctrl.date }}' +
- *           '<test date="$ctrl.date"></test>',
- *         controller: function() {
- *           this.date = new Date();
- *           this.month = this.date.getMonth();
- *           this.updateDate = function() {
- *             this.date.setMonth(this.month);
- *           };
- *         }
- *       })
- *       .component('test', {
- *         bindings: { date: '<' },
- *         template:
- *           '<pre>{{ $ctrl.log | json }}</pre>',
- *         controller: function() {
- *           var previousValue;
- *           this.log = [];
- *           this.$doCheck = function() {
- *             var currentValue = this.date && this.date.valueOf();
- *             if (previousValue !== currentValue) {
- *               this.log.push('doCheck: date mutated: ' + this.date);
- *               previousValue = currentValue;
- *             }
- *           };
- *         }
- *       });
- *   </file>
- *   <file name="index.html">
- *     <app></app>
- *   </file>
- * </example>
- *
- * This example show how you might use `$doCheck` to trigger changes in your component's inputs even if the
- * actual identity of the component doesn't change. (Be aware that cloning and deep equality checks on large
- * arrays or objects can have a negative impact on your application performance)
- *
- * <example name="doCheckArrayExample" module="do-check-module">
- *   <file name="index.html">
- *     <div ng-init="items = []">
- *       <button ng-click="items.push(items.length)">Add Item</button>
- *       <button ng-click="items = []">Reset Items</button>
- *       <pre>{{ items }}</pre>
- *       <test items="items"></test>
- *     </div>
- *   </file>
- *   <file name="app.js">
- *      angular.module('do-check-module', [])
- *        .component('test', {
- *          bindings: { items: '<' },
- *          template:
- *            '<pre>{{ $ctrl.log | json }}</pre>',
- *          controller: function() {
- *            this.log = [];
- *
- *            this.$doCheck = function() {
- *              if (this.items_ref !== this.items) {
- *                this.log.push('doCheck: items changed');
- *                this.items_ref = this.items;
- *              }
- *              if (!angular.equals(this.items_clone, this.items)) {
- *                this.log.push('doCheck: items mutated');
- *                this.items_clone = angular.copy(this.items);
- *              }
- *            };
- *          }
- *        });
- *   </file>
- * </example>
  *
  *
  * ### Directive Definition Object
@@ -17493,7 +15897,7 @@ function $TemplateCacheProvider() {
  * compiler}. The attributes are:
  *
  * #### `multiElement`
- * When this property is set to true (default is `false`), the HTML compiler will collect DOM nodes between
+ * When this property is set to true, the HTML compiler will collect DOM nodes between
  * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them
  * together as the directive elements. It is recommended that this feature be used on directives
  * which are not strictly behavioral (such as {@link ngClick}), and which
@@ -17514,21 +15918,19 @@ function $TemplateCacheProvider() {
  * and other directives used in the directive's template will also be excluded from execution.
  *
  * #### `scope`
- * The scope property can be `false`, `true`, or an object:
+ * The scope property can be `true`, an object or a falsy value:
  *
- * * **`false` (default):** No scope will be created for the directive. The directive will use its
- * parent's scope.
+ * * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.
  *
  * * **`true`:** A new child scope that prototypically inherits from its parent will be created for
  * the directive's element. If multiple directives on the same element request a new scope,
- * only one new scope is created.
+ * only one new scope is created. The new scope rule does not apply for the root of the template
+ * since the root of the template always gets a new scope.
  *
- * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's template.
- * The 'isolate' scope differs from normal scope in that it does not prototypically
- * inherit from its parent scope. This is useful when creating reusable components, which should not
- * accidentally read or modify data in the parent scope. Note that an isolate scope
- * directive without a `template` or `templateUrl` will not apply the isolate scope
- * to its children elements.
+ * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's element. The
+ * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent
+ * scope. This is useful when creating reusable components, which should not accidentally read or modify
+ * data in the parent scope.
  *
  * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the
  * directive's element. These local properties are useful for aliasing values for templates. The keys in
@@ -17610,7 +16012,9 @@ function $TemplateCacheProvider() {
  *
  * #### `bindToController`
  * This property is used to bind scope properties directly to the controller. It can be either
- * `true` or an object hash with the same format as the `scope` property.
+ * `true` or an object hash with the same format as the `scope` property. Additionally, a controller
+ * alias must be set, either by using `controllerAs: 'myAlias'` or by specifying the alias in the controller
+ * definition: `controller: 'myCtrl as myAlias'`.
  *
  * When an isolate scope is used for a directive (see above), `bindToController: true` will
  * allow a component to have its properties bound to the controller, rather than to scope.
@@ -17621,9 +16025,9 @@ function $TemplateCacheProvider() {
  * initialized.
  *
  * <div class="alert alert-warning">
- * **Deprecation warning:** if `$compileProcvider.preAssignBindingsEnabled(true)` was called, bindings for non-ES6 class
- * controllers are bound to `this` before the controller constructor is called but this use is now deprecated. Please
- * place initialization code that relies upon bindings inside a `$onInit` method on the controller, instead.
+ * **Deprecation warning:** although bindings for non-ES6 class controllers are currently
+ * bound to `this` before the controller constructor is called, this use is now deprecated. Please place initialization
+ * code that relies upon bindings inside a `$onInit` method on the controller, instead.
  * </div>
  *
  * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.
@@ -17651,15 +16055,34 @@ function $TemplateCacheProvider() {
  *        * defines the parent to which the `cloneLinkingFn` will add the cloned elements.
  *        * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`.
  *        * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements)
- *          and when the `cloneLinkingFn` is passed,
+ *          and when the `cloneLinkinFn` is passed,
  *          as those elements need to created and cloned in a special way when they are defined outside their
  *          usual containers (e.g. like `<svg>`).
  *        * See also the `directive.templateNamespace` property.
  *    * `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`)
- *      then the default transclusion is provided.
+ *      then the default translusion is provided.
  *    The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns
  *    `true` if the specified slot contains content (i.e. one or more DOM nodes).
  *
+ * The controller can provide the following methods that act as life-cycle hooks:
+ * * `$onInit()` - Called on each controller after all the controllers on an element have been constructed and
+ *   had their bindings initialized (and before the pre &amp; post linking functions for the directives on
+ *   this element). This is a good place to put initialization code for your controller.
+ * * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The
+ *   `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an
+ *   object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a
+ *   component such as cloning the bound value to prevent accidental mutation of the outer value.
+ * * `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing
+ *   external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in
+ *   the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent
+ *   components will have their `$onDestroy()` hook called before child components.
+ * * `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link
+ *   function this hook can be used to set up DOM event handlers and do direct DOM manipulation.
+ *   Note that child elements that contain `templateUrl` directives will not have been compiled and linked since
+ *   they are waiting for their template to load asynchronously and their own compilation and linking has been
+ *   suspended until that occurs.
+ *
+ *
  * #### `require`
  * Require another directive and inject its controller as the fourth argument to the linking function. The
  * `require` property can be a string, an array or an object:
@@ -17673,9 +16096,8 @@ function $TemplateCacheProvider() {
  * If the `require` property is an object and `bindToController` is truthy, then the required controllers are
  * bound to the controller using the keys of the `require` property. This binding occurs after all the controllers
  * have been constructed but before `$onInit` is called.
- * If the name of the required controller is the same as the local name (the key), the name can be
- * omitted. For example, `{parentDir: '^^'}` is equivalent to `{parentDir: '^^parentDir'}`.
  * See the {@link $compileProvider#component} helper for an example of how this can be used.
+ *
  * If no such required directive(s) can be found, or if the directive does not have a controller, then an error is
  * raised (unless no link function is specified and the required controllers are not being bound to the directive
  * controller, in which case error checking is skipped). The name can be prefixed with:
@@ -17857,8 +16279,8 @@ function $TemplateCacheProvider() {
  *     any other controller.
  *
  *   * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
- *     This is the same as the `$transclude` parameter of directive controllers,
- *     see {@link ng.$compile#-controller- the controller section for details}.
+ *     This is the same as the `$transclude`
+ *     parameter of directive controllers, see there for details.
  *     `function([scope], cloneLinkingFn, futureParentElement)`.
  *
  * #### Pre-linking function
@@ -17945,7 +16367,7 @@ function $TemplateCacheProvider() {
  *
  * When you call a transclusion function you can pass in a **clone attach function**. This function accepts
  * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded
- * content and the `scope` is the newly created transclusion scope, which the clone will be linked to.
+ * content and the `scope` is the newly created transclusion scope, to which the clone is bound.
  *
  * <div class="alert alert-info">
  * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function
@@ -18063,7 +16485,7 @@ function $TemplateCacheProvider() {
  * to illustrate how `$compile` works.
  * </div>
  *
- <example module="compileExample" name="compile">
+ <example module="compileExample">
    <file name="index.html">
     <script>
       angular.module('compileExample', [], function($compileProvider) {
@@ -18192,16 +16614,6 @@ function $TemplateCacheProvider() {
  *
  * For information on how the compiler works, see the
  * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.
- *
- * @knownIssue
- *
- * ### Double Compilation
- *
-   Double compilation occurs when an already compiled part of the DOM gets
-   compiled again. This is an undesired effect and can lead to misbehaving directives, performance issues,
-   and memory leaks. Refer to the Compiler Guide {@link guide/compiler#double-compilation-and-how-to-avoid-it
-   section on double compilation} for an in-depth explanation and ways to avoid it.
- *
  */
 
 var $compileMinErr = minErr('$compile');
@@ -18216,12 +16628,11 @@ var _UNINITIALIZED_VALUE = new UNINITIALIZED_VALUE();
  * @description
  */
 $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
-/** @this */
 function $CompileProvider($provide, $$sanitizeUriProvider) {
   var hasDirectives = {},
       Suffix = 'Directive',
-      COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/,
-      CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/,
+      COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/,
+      CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/,
       ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
       REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
 
@@ -18232,7 +16643,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
   var bindingCache = createMap();
 
   function parseIsolateBindings(scope, directiveName, isController) {
-    var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*([\w$]*)\s*$/;
+    var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/;
 
     var bindings = createMap();
 
@@ -18245,11 +16656,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
       if (!match) {
         throw $compileMinErr('iscp',
-            'Invalid {3} for directive \'{0}\'.' +
-            ' Definition: {... {1}: \'{2}\' ...}',
+            "Invalid {3} for directive '{0}'." +
+            " Definition: {... {1}: '{2}' ...}",
             directiveName, scopeName, definition,
-            (isController ? 'controller bindings definition' :
-            'isolate scope definition'));
+            (isController ? "controller bindings definition" :
+            "isolate scope definition"));
       }
 
       bindings[scopeName] = {
@@ -18285,11 +16696,20 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
       bindings.bindToController =
           parseIsolateBindings(directive.bindToController, directiveName, true);
     }
-    if (bindings.bindToController && !directive.controller) {
-      // There is no controller
-      throw $compileMinErr('noctrl',
-            'Cannot bind to controller without directive \'{0}\'s controller.',
-            directiveName);
+    if (isObject(bindings.bindToController)) {
+      var controller = directive.controller;
+      var controllerAs = directive.controllerAs;
+      if (!controller) {
+        // There is no controller, there may or may not be a controllerAs property
+        throw $compileMinErr('noctrl',
+              "Cannot bind to controller without directive '{0}'s controller.",
+              directiveName);
+      } else if (!identifierForController(controller, controllerAs)) {
+        // There is a controller, but no identifier or controllerAs property
+        throw $compileMinErr('noident',
+              "Cannot bind to controller without identifier for directive '{0}'.",
+              directiveName);
+      }
     }
     return bindings;
   }
@@ -18297,40 +16717,15 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
   function assertValidDirectiveName(name) {
     var letter = name.charAt(0);
     if (!letter || letter !== lowercase(letter)) {
-      throw $compileMinErr('baddir', 'Directive/Component name \'{0}\' is invalid. The first character must be a lowercase letter', name);
+      throw $compileMinErr('baddir', "Directive/Component name '{0}' is invalid. The first character must be a lowercase letter", name);
     }
     if (name !== name.trim()) {
       throw $compileMinErr('baddir',
-            'Directive/Component name \'{0}\' is invalid. The name should not contain leading or trailing whitespaces',
+            "Directive/Component name '{0}' is invalid. The name should not contain leading or trailing whitespaces",
             name);
     }
   }
 
-  function getDirectiveRequire(directive) {
-    var require = directive.require || (directive.controller && directive.name);
-
-    if (!isArray(require) && isObject(require)) {
-      forEach(require, function(value, key) {
-        var match = value.match(REQUIRE_PREFIX_REGEXP);
-        var name = value.substring(match[0].length);
-        if (!name) require[key] = match[0] + key;
-      });
-    }
-
-    return require;
-  }
-
-  function getDirectiveRestrict(restrict, name) {
-    if (restrict && !(isString(restrict) && /[EACM]/.test(restrict))) {
-      throw $compileMinErr('badrestrict',
-          'Restrict property \'{0}\' of directive \'{1}\' is invalid',
-          restrict,
-          name);
-    }
-
-    return restrict || 'EA';
-  }
-
   /**
    * @ngdoc method
    * @name $compileProvider#directive
@@ -18347,7 +16742,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
    * @returns {ng.$compileProvider} Self for chaining.
    */
   this.directive = function registerDirective(name, directiveFactory) {
-    assertArg(name, 'name');
     assertNotHasOwnProperty(name, 'directive');
     if (isString(name)) {
       assertValidDirectiveName(name);
@@ -18368,8 +16762,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
                 directive.priority = directive.priority || 0;
                 directive.index = index;
                 directive.name = directive.name || name;
-                directive.require = getDirectiveRequire(directive);
-                directive.restrict = getDirectiveRestrict(directive.restrict, name);
+                directive.require = directive.require || (directive.controller && directive.name);
+                directive.restrict = directive.restrict || 'EA';
                 directive.$$moduleName = directiveFactory.$$moduleName;
                 directives.push(directive);
               } catch (e) {
@@ -18478,7 +16872,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
     function factory($injector) {
       function makeInjectable(fn) {
         if (isFunction(fn) || isArray(fn)) {
-          return /** @this */ function(tElement, tAttrs) {
+          return function(tElement, tAttrs) {
             return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs});
           };
         } else {
@@ -18618,42 +17012,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
     return debugInfoEnabled;
   };
 
-  /**
-   * @ngdoc method
-   * @name  $compileProvider#preAssignBindingsEnabled
-   *
-   * @param {boolean=} enabled update the preAssignBindingsEnabled state if provided, otherwise just return the
-   * current preAssignBindingsEnabled state
-   * @returns {*} current value if used as getter or itself (chaining) if used as setter
-   *
-   * @kind function
-   *
-   * @description
-   * Call this method to enable/disable whether directive controllers are assigned bindings before
-   * calling the controller's constructor.
-   * If enabled (true), the compiler assigns the value of each of the bindings to the
-   * properties of the controller object before the constructor of this object is called.
-   *
-   * If disabled (false), the compiler calls the constructor first before assigning bindings.
-   *
-   * The default value is false.
-   *
-   * @deprecated
-   * sinceVersion="1.6.0"
-   * removeVersion="1.7.0"
-   *
-   * This method and the option to assign the bindings before calling the controller's constructor
-   * will be removed in v1.7.0.
-   */
-  var preAssignBindingsEnabled = false;
-  this.preAssignBindingsEnabled = function(enabled) {
-    if (isDefined(enabled)) {
-      preAssignBindingsEnabled = enabled;
-      return this;
-    }
-    return preAssignBindingsEnabled;
-  };
-
 
   var TTL = 10;
   /**
@@ -18684,63 +17042,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
     return TTL;
   };
 
-  var commentDirectivesEnabledConfig = true;
-  /**
-   * @ngdoc method
-   * @name $compileProvider#commentDirectivesEnabled
-   * @description
-   *
-   * It indicates to the compiler
-   * whether or not directives on comments should be compiled.
-   * Defaults to `true`.
-   *
-   * Calling this function with false disables the compilation of directives
-   * on comments for the whole application.
-   * This results in a compilation performance gain,
-   * as the compiler doesn't have to check comments when looking for directives.
-   * This should however only be used if you are sure that no comment directives are used in
-   * the application (including any 3rd party directives).
-   *
-   * @param {boolean} enabled `false` if the compiler may ignore directives on comments
-   * @returns {boolean|object} the current value (or `this` if called as a setter for chaining)
-   */
-  this.commentDirectivesEnabled = function(value) {
-    if (arguments.length) {
-      commentDirectivesEnabledConfig = value;
-      return this;
-    }
-    return commentDirectivesEnabledConfig;
-  };
-
-
-  var cssClassDirectivesEnabledConfig = true;
-  /**
-   * @ngdoc method
-   * @name $compileProvider#cssClassDirectivesEnabled
-   * @description
-   *
-   * It indicates to the compiler
-   * whether or not directives on element classes should be compiled.
-   * Defaults to `true`.
-   *
-   * Calling this function with false disables the compilation of directives
-   * on element classes for the whole application.
-   * This results in a compilation performance gain,
-   * as the compiler doesn't have to check element classes when looking for directives.
-   * This should however only be used if you are sure that no class directives are used in
-   * the application (including any 3rd party directives).
-   *
-   * @param {boolean} enabled `false` if the compiler may ignore directives on element classes
-   * @returns {boolean|object} the current value (or `this` if called as a setter for chaining)
-   */
-  this.cssClassDirectivesEnabled = function(value) {
-    if (arguments.length) {
-      cssClassDirectivesEnabledConfig = value;
-      return this;
-    }
-    return cssClassDirectivesEnabledConfig;
-  };
-
   this.$get = [
             '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse',
             '$controller', '$rootScope', '$sce', '$animate', '$$sanitizeUri',
@@ -18751,9 +17052,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
     var specialAttrHolder = window.document.createElement('div');
 
 
-    var commentDirectivesEnabled = commentDirectivesEnabledConfig;
-    var cssClassDirectivesEnabled = cssClassDirectivesEnabledConfig;
-
 
     var onChangesTtl = TTL;
     // The onChanges hooks should all be run together in a single digest
@@ -18770,19 +17068,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
         }
         // We must run this hook in an apply since the $$postDigest runs outside apply
         $rootScope.$apply(function() {
-          var errors = [];
           for (var i = 0, ii = onChangesQueue.length; i < ii; ++i) {
-            try {
-              onChangesQueue[i]();
-            } catch (e) {
-              errors.push(e);
-            }
+            onChangesQueue[i]();
           }
           // Reset the queue to trigger a new schedule next time there is a change
           onChangesQueue = undefined;
-          if (errors.length) {
-            throw errors;
-          }
         });
       } finally {
         onChangesTtl++;
@@ -18929,9 +17219,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
             (nodeName === 'img' && key === 'src')) {
           // sanitize a[href] and img[src] values
           this[key] = value = $$sanitizeUri(value, key === 'src');
-        } else if (nodeName === 'img' && key === 'srcset' && isDefined(value)) {
+        } else if (nodeName === 'img' && key === 'srcset') {
           // sanitize img[srcset] values
-          var result = '';
+          var result = "";
 
           // first check if there are spaces because it's not the same pattern
           var trimmedSrcset = trim(value);
@@ -18949,7 +17239,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
             // sanitize the uri
             result += $$sanitizeUri(trim(rawUris[innerIdx]), true);
             // add the descriptor
-            result += (' ' + trim(rawUris[innerIdx + 1]));
+            result += (" " + trim(rawUris[innerIdx + 1]));
           }
 
           // split the last item into uri and descriptor
@@ -18960,7 +17250,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
           // and add the last descriptor if any
           if (lastTuple.length === 2) {
-            result += (' ' + trim(lastTuple[1]));
+            result += (" " + trim(lastTuple[1]));
           }
           this[key] = value = result;
         }
@@ -18979,15 +17269,13 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
         // fire observers
         var $$observers = this.$$observers;
-        if ($$observers) {
-          forEach($$observers[observer], function(fn) {
-            try {
-              fn(value);
-            } catch (e) {
-              $exceptionHandler(e);
-            }
-          });
-        }
+        $$observers && forEach($$observers[observer], function(fn) {
+          try {
+            fn(value);
+          } catch (e) {
+            $exceptionHandler(e);
+          }
+        });
       },
 
 
@@ -19033,7 +17321,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
       // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`
       // so we have to jump through some hoops to get such an attribute
       // https://github.com/angular/angular.js/pull/13318
-      specialAttrHolder.innerHTML = '<span ' + attrName + '>';
+      specialAttrHolder.innerHTML = "<span " + attrName + ">";
       var attributes = specialAttrHolder.firstChild.attributes;
       var attribute = attributes[0];
       // We have to remove the attribute from its container element before we can add it to the destination element
@@ -19054,7 +17342,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
     var startSymbol = $interpolate.startSymbol(),
         endSymbol = $interpolate.endSymbol(),
-        denormalizeTemplate = (startSymbol === '{{' && endSymbol  === '}}')
+        denormalizeTemplate = (startSymbol == '{{' && endSymbol  == '}}')
             ? identity
             : function denormalizeTemplate(template) {
               return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
@@ -19090,8 +17378,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
     compile.$$createComment = function(directiveName, comment) {
       var content = '';
       if (debugInfoEnabled) {
-        content = ' ' + (directiveName || '') + ': ';
-        if (comment) content += comment + ' ';
+        content = ' ' + (directiveName || '') + ': ' + (comment || '') + ' ';
       }
       return window.document.createComment(content);
     };
@@ -19107,15 +17394,25 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
         // modify it.
         $compileNodes = jqLite($compileNodes);
       }
+
+      var NOT_EMPTY = /\S+/;
+
+      // We can not compile top level text elements since text nodes can be merged and we will
+      // not be able to attach scope data to them, so we will wrap them in <span>
+      for (var i = 0, len = $compileNodes.length; i < len; i++) {
+        var domNode = $compileNodes[i];
+
+        if (domNode.nodeType === NODE_TYPE_TEXT && domNode.nodeValue.match(NOT_EMPTY) /* non-empty */) {
+          jqLiteWrapNode(domNode, $compileNodes[i] = window.document.createElement('span'));
+        }
+      }
+
       var compositeLinkFn =
               compileNodes($compileNodes, transcludeFn, $compileNodes,
                            maxPriority, ignoreDirective, previousCompileContext);
       compile.$$addScopeClass($compileNodes);
       var namespace = null;
       return function publicLinkFn(scope, cloneConnectFn, options) {
-        if (!$compileNodes) {
-          throw $compileMinErr('multilink', 'This element has already been linked.');
-        }
         assertArg(scope, 'scope');
 
         if (previousCompileContext && previousCompileContext.needsNewScope) {
@@ -19170,10 +17467,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
         if (cloneConnectFn) cloneConnectFn($linkNode, scope);
         if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);
-
-        if (!cloneConnectFn) {
-          $compileNodes = compositeLinkFn = null;
-        }
         return $linkNode;
       };
     }
@@ -19206,23 +17499,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
     function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,
                             previousCompileContext) {
       var linkFns = [],
-          // `nodeList` can be either an element's `.childNodes` (live NodeList)
-          // or a jqLite/jQuery collection or an array
-          notLiveList = isArray(nodeList) || (nodeList instanceof jqLite),
           attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound;
 
-
       for (var i = 0; i < nodeList.length; i++) {
         attrs = new Attributes();
 
-        // Support: IE 11 only
-        // Workaround for #11781 and #14924
-        if (msie === 11) {
-          mergeConsecutiveTextNodes(nodeList, i, notLiveList);
-        }
-
-        // We must always refer to `nodeList[i]` hereafter,
-        // since the nodes can be replaced underneath us.
+        // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
         directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,
                                         ignoreDirective);
 
@@ -19269,7 +17551,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
           stableNodeList = new Array(nodeListLength);
 
           // create a sparse array by only copying the elements which have a linkFn
-          for (i = 0; i < linkFns.length; i += 3) {
+          for (i = 0; i < linkFns.length; i+=3) {
             idx = linkFns[i];
             stableNodeList[idx] = nodeList[idx];
           }
@@ -19313,32 +17595,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
       }
     }
 
-    function mergeConsecutiveTextNodes(nodeList, idx, notLiveList) {
-      var node = nodeList[idx];
-      var parent = node.parentNode;
-      var sibling;
-
-      if (node.nodeType !== NODE_TYPE_TEXT) {
-        return;
-      }
-
-      while (true) {
-        sibling = parent ? node.nextSibling : nodeList[idx + 1];
-        if (!sibling || sibling.nodeType !== NODE_TYPE_TEXT) {
-          break;
-        }
-
-        node.nodeValue = node.nodeValue + sibling.nodeValue;
-
-        if (sibling.parentNode) {
-          sibling.parentNode.removeChild(sibling);
-        }
-        if (notLiveList && sibling === nodeList[idx + 1]) {
-          nodeList.splice(idx + 1, 1);
-        }
-      }
-    }
-
     function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
       function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {
 
@@ -19382,17 +17638,13 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
       var nodeType = node.nodeType,
           attrsMap = attrs.$attr,
           match,
-          nodeName,
           className;
 
       switch (nodeType) {
         case NODE_TYPE_ELEMENT: /* Element */
-
-          nodeName = nodeName_(node);
-
           // use the node name: <directive>
           addDirective(directives,
-              directiveNormalize(nodeName), 'E', maxPriority, ignoreDirective);
+              directiveNormalize(nodeName_(node)), 'E', maxPriority, ignoreDirective);
 
           // iterate over the attributes
           for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,
@@ -19402,12 +17654,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
             attr = nAttrs[j];
             name = attr.name;
-            value = attr.value;
+            value = trim(attr.value);
 
             // support ngAttr attribute binding
             ngAttrName = directiveNormalize(name);
-            isNgAttr = NG_ATTR_BINDING.test(ngAttrName);
-            if (isNgAttr) {
+            if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {
               name = name.replace(PREFIX_REGEXP, '')
                 .substr(8).replace(/_(.)/g, function(match, letter) {
                   return letter.toUpperCase();
@@ -19434,21 +17685,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
                           attrEndName);
           }
 
-          if (nodeName === 'input' && node.getAttribute('type') === 'hidden') {
-            // Hidden input elements can have strange behaviour when navigating back to the page
-            // This tells the browser not to try to cache and reinstate previous values
-            node.setAttribute('autocomplete', 'off');
-          }
-
           // use class as directive
-          if (!cssClassDirectivesEnabled) break;
           className = node.className;
           if (isObject(className)) {
               // Maybe SVGAnimatedString
               className = className.animVal;
           }
           if (isString(className) && className !== '') {
-            while ((match = CLASS_DIRECTIVE_REGEXP.exec(className))) {
+            while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {
               nName = directiveNormalize(match[2]);
               if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {
                 attrs[nName] = trim(match[3]);
@@ -19458,11 +17702,29 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
           }
           break;
         case NODE_TYPE_TEXT: /* Text Node */
+          if (msie === 11) {
+            // Workaround for #11781
+            while (node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT) {
+              node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;
+              node.parentNode.removeChild(node.nextSibling);
+            }
+          }
           addTextInterpolateDirective(directives, node.nodeValue);
           break;
         case NODE_TYPE_COMMENT: /* Comment */
-          if (!commentDirectivesEnabled) break;
-          collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective);
+          try {
+            match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
+            if (match) {
+              nName = directiveNormalize(match[1]);
+              if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {
+                attrs[nName] = trim(match[2]);
+              }
+            }
+          } catch (e) {
+            // turns out that under some circumstances IE9 throws errors when one attempts to read
+            // comment's node value.
+            // Just ignore it and continue. (Can't seem to reproduce in test case.)
+          }
           break;
       }
 
@@ -19470,26 +17732,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
       return directives;
     }
 
-    function collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
-      // function created because of performance, try/catch disables
-      // the optimization of the whole function #14848
-      try {
-        var match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
-        if (match) {
-          var nName = directiveNormalize(match[1]);
-          if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {
-            attrs[nName] = trim(match[2]);
-          }
-        }
-      } catch (e) {
-        // turns out that under some circumstances IE9 throws errors when one attempts to read
-        // comment's node value.
-        // Just ignore it and continue. (Can't seem to reproduce in test case.)
-      }
-    }
-
     /**
-     * Given a node with a directive-start it collects all of the siblings until it finds
+     * Given a node with an directive-start it collects all of the siblings until it finds
      * directive-end.
      * @param node
      * @param attrStart
@@ -19503,10 +17747,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
         do {
           if (!node) {
             throw $compileMinErr('uterdir',
-                      'Unterminated attribute, found \'{0}\' but no matching \'{1}\' found.',
+                      "Unterminated attribute, found '{0}' but no matching '{1}' found.",
                       attrStart, attrEnd);
           }
-          if (node.nodeType === NODE_TYPE_ELEMENT) {
+          if (node.nodeType == NODE_TYPE_ELEMENT) {
             if (node.hasAttribute(attrStart)) depth++;
             if (node.hasAttribute(attrEnd)) depth--;
           }
@@ -19552,7 +17796,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
       if (eager) {
         return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
       }
-      return /** @this */ function lazyCompilation() {
+      return function lazyCompilation() {
         if (!compiled) {
           compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
 
@@ -19628,9 +17872,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
           break; // prevent further processing of directives
         }
 
-        directiveValue = directive.scope;
-
-        if (directiveValue) {
+        if (directiveValue = directive.scope) {
 
           // skip the check for directives with async templates, we'll check the derived sync
           // directive when the template arrives
@@ -19664,7 +17906,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
             || (directive.transclude && !directive.$$tlb))) {
                 var candidateDirective;
 
-                for (var scanningIndex = i + 1; (candidateDirective = directives[scanningIndex++]);) {
+                for (var scanningIndex = i + 1; candidateDirective = directives[scanningIndex++];) {
                     if ((candidateDirective.transclude && !candidateDirective.$$tlb)
                         || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) {
                         mightHaveMultipleTransclusionError = true;
@@ -19676,15 +17918,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
         }
 
         if (!directive.templateUrl && directive.controller) {
+          directiveValue = directive.controller;
           controllerDirectives = controllerDirectives || createMap();
-          assertNoDuplicate('\'' + directiveName + '\' controller',
+          assertNoDuplicate("'" + directiveName + "' controller",
               controllerDirectives[directiveName], directive, $compileNode);
           controllerDirectives[directiveName] = directive;
         }
 
-        directiveValue = directive.transclude;
-
-        if (directiveValue) {
+        if (directiveValue = directive.transclude) {
           hasTranscludeDirective = true;
 
           // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.
@@ -19695,7 +17936,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
             nonTlbTranscludeDirective = directive;
           }
 
-          if (directiveValue === 'element') {
+          if (directiveValue == 'element') {
             hasElementTranscludeDirective = true;
             terminalPriority = directive.priority;
             $template = $compileNode;
@@ -19730,9 +17971,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
             var slots = createMap();
 
-            if (!isObject(directiveValue)) {
-              $template = jqLite(jqLiteClone(compileNode)).contents();
-            } else {
+            $template = jqLite(jqLiteClone(compileNode)).contents();
+
+            if (isObject(directiveValue)) {
 
               // We have transclusion slots,
               // collect them up, compile them and store their transclusion functions
@@ -19813,9 +18054,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
             }
             compileNode = $template[0];
 
-            if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
+            if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
               throw $compileMinErr('tplrt',
-                  'Template for directive \'{0}\' must have exactly one root element. {1}',
+                  "Template for directive '{0}' must have exactly one root element. {1}",
                   directiveName, '');
             }
 
@@ -19855,8 +18096,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
             replaceDirective = directive;
           }
 
-          // eslint-disable-next-line no-func-assign
+          /* jshint -W021 */
           nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,
+          /* jshint +W021 */
               templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {
                 controllerDirectives: controllerDirectives,
                 newScopeDirective: (newScopeDirective !== directive) && newScopeDirective,
@@ -19868,11 +18110,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
         } else if (directive.compile) {
           try {
             linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
-            var context = directive.$$originalDirective || directive;
             if (isFunction(linkFn)) {
-              addLinkFns(null, bind(context, linkFn), attrStart, attrEnd);
+              addLinkFns(null, linkFn, attrStart, attrEnd);
             } else if (linkFn) {
-              addLinkFns(bind(context, linkFn.pre), bind(context, linkFn.post), attrStart, attrEnd);
+              addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);
             }
           } catch (e) {
             $exceptionHandler(e, startingTag($compileNode));
@@ -19974,29 +18215,20 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
           var controller = elementControllers[name];
           var bindings = controllerDirective.$$bindings.bindToController;
 
-          if (preAssignBindingsEnabled) {
-            if (bindings) {
-              controller.bindingInfo =
-                initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
-            } else {
-              controller.bindingInfo = {};
-            }
-
-            var controllerResult = controller();
-            if (controllerResult !== controller.instance) {
-              // If the controller constructor has a return value, overwrite the instance
-              // from setupControllers
-              controller.instance = controllerResult;
-              $element.data('$' + controllerDirective.name + 'Controller', controllerResult);
-              if (controller.bindingInfo.removeWatches) {
-                controller.bindingInfo.removeWatches();
-              }
-              controller.bindingInfo =
-                initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
-            }
+          if (controller.identifier && bindings) {
+            controller.bindingInfo =
+              initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
           } else {
-            controller.instance = controller();
-            $element.data('$' + controllerDirective.name + 'Controller', controller.instance);
+            controller.bindingInfo = {};
+          }
+
+          var controllerResult = controller();
+          if (controllerResult !== controller.instance) {
+            // If the controller constructor has a return value, overwrite the instance
+            // from setupControllers
+            controller.instance = controllerResult;
+            $element.data('$' + controllerDirective.name + 'Controller', controllerResult);
+            controller.bindingInfo.removeWatches && controller.bindingInfo.removeWatches();
             controller.bindingInfo =
               initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
           }
@@ -20014,22 +18246,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
         forEach(elementControllers, function(controller) {
           var controllerInstance = controller.instance;
           if (isFunction(controllerInstance.$onChanges)) {
-            try {
-              controllerInstance.$onChanges(controller.bindingInfo.initialChanges);
-            } catch (e) {
-              $exceptionHandler(e);
-            }
+            controllerInstance.$onChanges(controller.bindingInfo.initialChanges);
           }
           if (isFunction(controllerInstance.$onInit)) {
-            try {
-              controllerInstance.$onInit();
-            } catch (e) {
-              $exceptionHandler(e);
-            }
-          }
-          if (isFunction(controllerInstance.$doCheck)) {
-            controllerScope.$watch(function() { controllerInstance.$doCheck(); });
-            controllerInstance.$doCheck();
+            controllerInstance.$onInit();
           }
           if (isFunction(controllerInstance.$onDestroy)) {
             controllerScope.$on('$destroy', function callOnDestroyHook() {
@@ -20057,9 +18277,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
         if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {
           scopeToChild = isolateScope;
         }
-        if (childLinkFn) {
-          childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);
-        }
+        childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);
 
         // POSTLINKING
         for (i = postLinkFns.length - 1; i >= 0; i--) {
@@ -20146,7 +18364,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
         if (!value && !optional) {
           throw $compileMinErr('ctreq',
-              'Controller \'{0}\', required by directive \'{1}\', can\'t be found!',
+              "Controller '{0}', required by directive '{1}', can't be found!",
               name, directiveName);
         }
       } else if (isArray(require)) {
@@ -20176,7 +18394,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
         };
 
         var controller = directive.controller;
-        if (controller === '@') {
+        if (controller == '@') {
           controller = attrs[directive.name];
         }
 
@@ -20225,22 +18443,24 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
       if (hasDirectives.hasOwnProperty(name)) {
         for (var directive, directives = $injector.get(name + Suffix),
             i = 0, ii = directives.length; i < ii; i++) {
-          directive = directives[i];
-          if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&
-               directive.restrict.indexOf(location) !== -1) {
-            if (startAttrName) {
-              directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
-            }
-            if (!directive.$$bindings) {
-              var bindings = directive.$$bindings =
-                  parseDirectiveBindings(directive, directive.name);
-              if (isObject(bindings.isolateScope)) {
-                directive.$$isolateBindings = bindings.isolateScope;
+          try {
+            directive = directives[i];
+            if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&
+                 directive.restrict.indexOf(location) != -1) {
+              if (startAttrName) {
+                directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
+              }
+              if (!directive.$$bindings) {
+                var bindings = directive.$$bindings =
+                    parseDirectiveBindings(directive, directive.name);
+                if (isObject(bindings.isolateScope)) {
+                  directive.$$isolateBindings = bindings.isolateScope;
+                }
               }
+              tDirectives.push(directive);
+              match = directive;
             }
-            tDirectives.push(directive);
-            match = directive;
-          }
+          } catch (e) { $exceptionHandler(e); }
         }
       }
       return match;
@@ -20278,17 +18498,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
      */
     function mergeTemplateAttributes(dst, src) {
       var srcAttr = src.$attr,
-          dstAttr = dst.$attr;
+          dstAttr = dst.$attr,
+          $element = dst.$$element;
 
       // reapply the old attributes to the new element
       forEach(dst, function(value, key) {
-        if (key.charAt(0) !== '$') {
+        if (key.charAt(0) != '$') {
           if (src[key] && src[key] !== value) {
-            if (value.length) {
-              value += (key === 'style' ? ';' : ' ') + src[key];
-            } else {
-              value = src[key];
-            }
+            value += (key === 'style' ? ';' : ' ') + src[key];
           }
           dst.$set(key, value, true, srcAttr[key]);
         }
@@ -20296,16 +18513,18 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
       // copy the new attributes on the old attrs object
       forEach(src, function(value, key) {
-        // Check if we already set this attribute in the loop above.
-        // `dst` will never contain hasOwnProperty as DOM parser won't let it.
-        // You will get an "InvalidCharacterError: DOM Exception 5" error if you
-        // have an attribute like "has-own-property" or "data-has-own-property", etc.
-        if (!dst.hasOwnProperty(key) && key.charAt(0) !== '$') {
+        if (key == 'class') {
+          safeAddClass($element, value);
+          dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;
+        } else if (key == 'style') {
+          $element.attr('style', $element.attr('style') + ';' + value);
+          dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;
+          // `dst` will never contain hasOwnProperty as DOM parser won't let it.
+          // You will get an "InvalidCharacterError: DOM Exception 5" error if you
+          // have an attribute like "has-own-property" or "data-has-own-property", etc.
+        } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {
           dst[key] = value;
-
-          if (key !== 'class' && key !== 'style') {
-            dstAttr[key] = srcAttr[key];
-          }
+          dstAttr[key] = srcAttr[key];
         }
       });
     }
@@ -20342,9 +18561,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
             }
             compileNode = $template[0];
 
-            if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
+            if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
               throw $compileMinErr('tplrt',
-                  'Template for directive \'{0}\' must have exactly one root element. {1}',
+                  "Template for directive '{0}' must have exactly one root element. {1}",
                   origAsyncDirective.name, templateUrl);
             }
 
@@ -20370,7 +18589,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
               childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,
               previousCompileContext);
           forEach($rootElement, function(node, i) {
-            if (node === compileNode) {
+            if (node == compileNode) {
               $rootElement[i] = $compileNode[0];
             }
           });
@@ -20407,10 +18626,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
               childBoundTranscludeFn);
           }
           linkQueue = null;
-        }).catch(function(error) {
-          if (error instanceof Error) {
-            $exceptionHandler(error);
-          }
         });
 
       return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
@@ -20499,47 +18714,34 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
 
     function getTrustedContext(node, attrNormalizedName) {
-      if (attrNormalizedName === 'srcdoc') {
+      if (attrNormalizedName == "srcdoc") {
         return $sce.HTML;
       }
       var tag = nodeName_(node);
-      // All tags with src attributes require a RESOURCE_URL value, except for
-      // img and various html5 media tags.
-      if (attrNormalizedName === 'src' || attrNormalizedName === 'ngSrc') {
-        if (['img', 'video', 'audio', 'source', 'track'].indexOf(tag) === -1) {
-          return $sce.RESOURCE_URL;
-        }
       // maction[xlink:href] can source SVG.  It's not limited to <maction>.
-      } else if (attrNormalizedName === 'xlinkHref' ||
-          (tag === 'form' && attrNormalizedName === 'action') ||
-          // links can be stylesheets or imports, which can run script in the current origin
-          (tag === 'link' && attrNormalizedName === 'href')
-      ) {
+      if (attrNormalizedName == "xlinkHref" ||
+          (tag == "form" && attrNormalizedName == "action") ||
+          (tag != "img" && (attrNormalizedName == "src" ||
+                            attrNormalizedName == "ngSrc"))) {
         return $sce.RESOURCE_URL;
       }
     }
 
 
-    function addAttrInterpolateDirective(node, directives, value, name, isNgAttr) {
+    function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) {
       var trustedContext = getTrustedContext(node, name);
-      var mustHaveExpression = !isNgAttr;
-      var allOrNothing = ALL_OR_NOTHING_ATTRS[name] || isNgAttr;
+      allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing;
 
-      var interpolateFn = $interpolate(value, mustHaveExpression, trustedContext, allOrNothing);
+      var interpolateFn = $interpolate(value, true, trustedContext, allOrNothing);
 
       // no interpolation found -> ignore
       if (!interpolateFn) return;
 
-      if (name === 'multiple' && nodeName_(node) === 'select') {
-        throw $compileMinErr('selmulti',
-            'Binding to the \'multiple\' attribute is not supported. Element: {0}',
-            startingTag(node));
-      }
 
-      if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
-        throw $compileMinErr('nodomevents',
-            'Interpolations for HTML DOM event attributes are disallowed.  Please use the ' +
-                'ng- versions (such as ng-click instead of onclick) instead.');
+      if (name === "multiple" && nodeName_(node) === "select") {
+        throw $compileMinErr("selmulti",
+            "Binding to the 'multiple' attribute is not supported. Element: {0}",
+            startingTag(node));
       }
 
       directives.push({
@@ -20549,6 +18751,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
               pre: function attrInterpolatePreLinkFn(scope, element, attr) {
                 var $$observers = (attr.$$observers || (attr.$$observers = createMap()));
 
+                if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
+                  throw $compileMinErr('nodomevents',
+                      "Interpolations for HTML DOM event attributes are disallowed.  Please use the " +
+                          "ng- versions (such as ng-click instead of onclick) instead.");
+                }
+
                 // If the attribute has changed since last $interpolate()ed
                 var newValue = attr[name];
                 if (newValue !== value) {
@@ -20577,7 +18785,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
                     //skip animations when the first digest occurs (when
                     //both the new and the old values are the same) since
                     //the CSS classes are the non-interpolated values
-                    if (name === 'class' && newValue !== oldValue) {
+                    if (name === 'class' && newValue != oldValue) {
                       attr.$updateClass(newValue, oldValue);
                     } else {
                       attr.$set(name, newValue);
@@ -20608,7 +18816,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
       if ($rootElement) {
         for (i = 0, ii = $rootElement.length; i < ii; i++) {
-          if ($rootElement[i] === firstElementToRemove) {
+          if ($rootElement[i] == firstElementToRemove) {
             $rootElement[i++] = newNode;
             for (var j = i, j2 = j + removeCount - 1,
                      jj = $rootElement.length;
@@ -20682,7 +18890,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
     }
 
 
-    // Set up $watches for isolate scope and controller bindings.
+    // Set up $watches for isolate scope and controller bindings. This process
+    // only occurs for isolate scopes and new scopes with controllerAs.
     function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {
       var removeWatchCollection = [];
       var initialChanges = {};
@@ -20690,7 +18899,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
       forEach(bindings, function initializeBinding(definition, scopeName) {
         var attrName = definition.attrName,
         optional = definition.optional,
-        mode = definition.mode, // @, =, <, or &
+        mode = definition.mode, // @, =, or &
         lastValue,
         parentGet, parentSet, compare, removeWatch;
 
@@ -20698,9 +18907,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
 
           case '@':
             if (!optional && !hasOwnProperty.call(attrs, attrName)) {
-              destination[scopeName] = attrs[attrName] = undefined;
+              destination[scopeName] = attrs[attrName] = void 0;
             }
-            removeWatch = attrs.$observe(attrName, function(value) {
+            attrs.$observe(attrName, function(value) {
               if (isString(value) || isBoolean(value)) {
                 var oldValue = destination[scopeName];
                 recordChanges(scopeName, value, oldValue);
@@ -20719,13 +18928,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
               destination[scopeName] = lastValue;
             }
             initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]);
-            removeWatchCollection.push(removeWatch);
             break;
 
           case '=':
             if (!hasOwnProperty.call(attrs, attrName)) {
               if (optional) break;
-              attrs[attrName] = undefined;
+              attrs[attrName] = void 0;
             }
             if (optional && !attrs[attrName]) break;
 
@@ -20733,13 +18941,13 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
             if (parentGet.literal) {
               compare = equals;
             } else {
-              compare = simpleCompare;
+              compare = function simpleCompare(a, b) { return a === b || (a !== a && b !== b); };
             }
             parentSet = parentGet.assign || function() {
               // reset the change, or we will throw this exception on every $digest
               lastValue = destination[scopeName] = parentGet(scope);
               throw $compileMinErr('nonassign',
-                  'Expression \'{0}\' in attribute \'{1}\' used with directive \'{2}\' is non-assignable!',
+                  "Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!",
                   attrs[attrName], attrName, directive.name);
             };
             lastValue = destination[scopeName] = parentGet(scope);
@@ -20754,8 +18962,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
                   parentSet(scope, parentValue = destination[scopeName]);
                 }
               }
-              lastValue = parentValue;
-              return lastValue;
+              return lastValue = parentValue;
             };
             parentValueWatch.$stateful = true;
             if (definition.collection) {
@@ -20769,26 +18976,24 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
           case '<':
             if (!hasOwnProperty.call(attrs, attrName)) {
               if (optional) break;
-              attrs[attrName] = undefined;
+              attrs[attrName] = void 0;
             }
             if (optional && !attrs[attrName]) break;
 
             parentGet = $parse(attrs[attrName]);
-            var deepWatch = parentGet.literal;
 
-            var initialValue = destination[scopeName] = parentGet(scope);
+            destination[scopeName] = parentGet(scope);
             initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]);
 
             removeWatch = scope.$watch(parentGet, function parentValueWatchAction(newValue, oldValue) {
-              if (oldValue === newValue) {
-                if (oldValue === initialValue || (deepWatch && equals(oldValue, initialValue))) {
-                  return;
-                }
-                oldValue = initialValue;
+              if (newValue === oldValue) {
+                // If the new and old values are identical then this is the first time the watch has been triggered
+                // So instead we use the current value on the destination as the old value
+                oldValue = destination[scopeName];
               }
               recordChanges(scopeName, newValue, oldValue);
               destination[scopeName] = newValue;
-            }, deepWatch);
+            }, parentGet.literal);
 
             removeWatchCollection.push(removeWatch);
             break;
@@ -20808,7 +19013,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
       });
 
       function recordChanges(key, currentValue, previousValue) {
-        if (isFunction(destination.$onChanges) && !simpleCompare(currentValue, previousValue)) {
+        if (isFunction(destination.$onChanges) && currentValue !== previousValue) {
           // If we have not already scheduled the top level onChangesQueue handler then do so now
           if (!onChangesQueue) {
             scope.$$postDigest(flushOnChangesQueue);
@@ -20853,17 +19058,13 @@ function SimpleChange(previous, current) {
 SimpleChange.prototype.isFirstChange = function() { return this.previousValue === _UNINITIALIZED_VALUE; };
 
 
-var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i;
-var SPECIAL_CHARS_REGEXP = /[:\-_]+(.)/g;
-
+var PREFIX_REGEXP = /^((?:x|data)[\:\-_])/i;
 /**
  * Converts all accepted directives format into proper directive name.
  * @param name Name to normalize
  */
 function directiveNormalize(name) {
-  return name
-    .replace(PREFIX_REGEXP, '')
-    .replace(SPECIAL_CHARS_REGEXP, fnCamelCaseReplace);
+  return camelCase(name.replace(PREFIX_REGEXP, ''));
 }
 
 /**
@@ -20935,7 +19136,7 @@ function tokenDifference(str1, str2) {
   for (var i = 0; i < tokens1.length; i++) {
     var token = tokens1[i];
     for (var j = 0; j < tokens2.length; j++) {
-      if (token === tokens2[j]) continue outer;
+      if (token == tokens2[j]) continue outer;
     }
     values += (values.length > 0 ? ' ' : '') + token;
   }
@@ -20952,9 +19153,8 @@ function removeComments(jqNodes) {
 
   while (i--) {
     var node = jqNodes[i];
-    if (node.nodeType === NODE_TYPE_COMMENT ||
-       (node.nodeType === NODE_TYPE_TEXT && node.nodeValue.trim() === '')) {
-         splice.call(jqNodes, i, 1);
+    if (node.nodeType === NODE_TYPE_COMMENT) {
+      splice.call(jqNodes, i, 1);
     }
   }
   return jqNodes;
@@ -20976,8 +19176,6 @@ function identifierForController(controller, ident) {
 /**
  * @ngdoc provider
  * @name $controllerProvider
- * @this
- *
  * @description
  * The {@link ng.$controller $controller service} is used by Angular to create new
  * controllers.
@@ -21019,11 +19217,6 @@ function $ControllerProvider() {
    * @ngdoc method
    * @name $controllerProvider#allowGlobals
    * @description If called, allows `$controller` to find controller constructors on `window`
-   *
-   * @deprecated
-   * sinceVersion="v1.3.0"
-   * removeVersion="v1.7.0"
-   * This method of finding controllers has been deprecated.
    */
   this.allowGlobals = function() {
     globals = true;
@@ -21044,7 +19237,7 @@ function $ControllerProvider() {
      *    * check if a controller with given name is registered via `$controllerProvider`
      *    * check if evaluating the string on the current scope returns a constructor
      *    * if $controllerProvider#allowGlobals, check `window[constructor]` on the global
-     *      `window` object (deprecated, not recommended)
+     *      `window` object (not recommended)
      *
      *    The string can use the `controller as property` syntax, where the controller instance is published
      *    as the specified property on the `scope`; the `scope` must be injected into `locals` param for this
@@ -21077,21 +19270,16 @@ function $ControllerProvider() {
         match = expression.match(CNTRL_REG);
         if (!match) {
           throw $controllerMinErr('ctrlfmt',
-            'Badly formed controller string \'{0}\'. ' +
-            'Must match `__name__ as __id__` or `__name__`.', expression);
+            "Badly formed controller string '{0}'. " +
+            "Must match `__name__ as __id__` or `__name__`.", expression);
         }
-        constructor = match[1];
+        constructor = match[1],
         identifier = identifier || match[3];
         expression = controllers.hasOwnProperty(constructor)
             ? controllers[constructor]
             : getter(locals.$scope, constructor, true) ||
                 (globals ? getter($window, constructor, true) : undefined);
 
-        if (!expression) {
-          throw $controllerMinErr('ctrlreg',
-            'The controller with the name \'{0}\' is not registered.', constructor);
-        }
-
         assertArgFn(expression, constructor, true);
       }
 
@@ -21114,7 +19302,8 @@ function $ControllerProvider() {
           addIdentifier(locals, identifier, instance, constructor || expression.name);
         }
 
-        return extend(function $controllerInit() {
+        var instantiate;
+        return instantiate = extend(function $controllerInit() {
           var result = $injector.invoke(expression, instance, locals, constructor);
           if (result !== instance && (isObject(result) || isFunction(result))) {
             instance = result;
@@ -21142,7 +19331,7 @@ function $ControllerProvider() {
     function addIdentifier(locals, identifier, instance, name) {
       if (!(locals && isObject(locals.$scope))) {
         throw minErr('$controller')('noscp',
-          'Cannot export controller \'{0}\' as \'{1}\'! No $scope object provided via `locals`.',
+          "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",
           name, identifier);
       }
 
@@ -21155,13 +19344,12 @@ function $ControllerProvider() {
  * @ngdoc service
  * @name $document
  * @requires $window
- * @this
  *
  * @description
  * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
  *
  * @example
-   <example module="documentExample" name="document">
+   <example module="documentExample">
      <file name="index.html">
        <div ng-controller="ExampleController">
          <p>$document title: <b ng-bind="title"></b></p>
@@ -21183,38 +19371,10 @@ function $DocumentProvider() {
   }];
 }
 
-
-/**
- * @private
- * @this
- * Listens for document visibility change and makes the current status accessible.
- */
-function $$IsDocumentHiddenProvider() {
-  this.$get = ['$document', '$rootScope', function($document, $rootScope) {
-    var doc = $document[0];
-    var hidden = doc && doc.hidden;
-
-    $document.on('visibilitychange', changeListener);
-
-    $rootScope.$on('$destroy', function() {
-      $document.off('visibilitychange', changeListener);
-    });
-
-    function changeListener() {
-      hidden = doc.hidden;
-    }
-
-    return function() {
-      return hidden;
-    };
-  }];
-}
-
 /**
  * @ngdoc service
  * @name $exceptionHandler
  * @requires ng.$log
- * @this
  *
  * @description
  * Any uncaught exception in angular expressions is delegated to this service.
@@ -21226,21 +19386,18 @@ function $$IsDocumentHiddenProvider() {
  *
  * ## Example:
  *
- * The example below will overwrite the default `$exceptionHandler` in order to (a) log uncaught
- * errors to the backend for later inspection by the developers and (b) to use `$log.warn()` instead
- * of `$log.error()`.
- *
  * ```js
- *   angular.
- *     module('exceptionOverwrite', []).
- *     factory('$exceptionHandler', ['$log', 'logErrorsToBackend', function($log, logErrorsToBackend) {
- *       return function myExceptionHandler(exception, cause) {
- *         logErrorsToBackend(exception, cause);
- *         $log.warn(exception, cause);
- *       };
- *     }]);
+ *   angular.module('exceptionOverride', []).factory('$exceptionHandler', function() {
+ *     return function(exception, cause) {
+ *       exception.message += ' (caused by "' + cause + '")';
+ *       throw exception;
+ *     };
+ *   });
  * ```
  *
+ * This example will override the normal action of `$exceptionHandler`, to make angular
+ * exceptions fail hard when they happen, instead of just logging to the console.
+ *
  * <hr />
  * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind`
  * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler}
@@ -21250,7 +19407,7 @@ function $$IsDocumentHiddenProvider() {
  * `try { ... } catch(e) { $exceptionHandler(e); }`
  *
  * @param {Error} exception Exception associated with the error.
- * @param {string=} cause Optional information about the context in which
+ * @param {string=} cause optional information about the context in which
  *       the error was thrown.
  *
  */
@@ -21262,7 +19419,7 @@ function $ExceptionHandlerProvider() {
   }];
 }
 
-var $$ForceReflowProvider = /** @this */ function() {
+var $$ForceReflowProvider = function() {
   this.$get = ['$document', function($document) {
     return function(domNode) {
       //the line below will force the browser to perform a repaint so
@@ -21292,8 +19449,13 @@ var JSON_ENDS = {
   '[': /]$/,
   '{': /}$/
 };
-var JSON_PROTECTION_PREFIX = /^\)]\}',?\n/;
+var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/;
 var $httpMinErr = minErr('$http');
+var $httpMinErrLegacyFn = function(method) {
+  return function() {
+    throw $httpMinErr('legacy', 'The method `{0}` on the promise returned from `$http` has been disabled.', method);
+  };
+};
 
 function serializeValue(v) {
   if (isObject(v)) {
@@ -21303,7 +19465,6 @@ function serializeValue(v) {
 }
 
 
-/** @this */
 function $HttpParamSerializerProvider() {
   /**
    * @ngdoc service
@@ -21316,7 +19477,7 @@ function $HttpParamSerializerProvider() {
    * * `{'foo': 'bar'}` results in `foo=bar`
    * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)
    * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)
-   * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D` (stringified and encoded representation of an object)
+   * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D"` (stringified and encoded representation of an object)
    *
    * Note that serializer will sort the request parameters alphabetically.
    * */
@@ -21341,12 +19502,10 @@ function $HttpParamSerializerProvider() {
   };
 }
 
-/** @this */
 function $HttpParamSerializerJQLikeProvider() {
   /**
    * @ngdoc service
    * @name $httpParamSerializerJQLike
-   *
    * @description
    *
    * Alternative {@link $http `$http`} params serializer that follows
@@ -21423,12 +19582,7 @@ function defaultHttpResponseTransform(data, headers) {
     if (tempData) {
       var contentType = headers('Content-Type');
       if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {
-        try {
-          data = fromJson(tempData);
-        } catch (e) {
-          throw $httpMinErr('baddata', 'Data must be a valid JSON object. Received: "{0}". ' +
-          'Parse error: "{1}"', data, e);
-        }
+        data = fromJson(tempData);
       }
     }
   }
@@ -21480,7 +19634,7 @@ function parseHeaders(headers) {
  * @param {(string|Object)} headers Headers to provide access to.
  * @returns {function(string=)} Returns a getter function which if called with:
  *
- *   - if called with an argument returns a single header value or null
+ *   - if called with single an argument returns a single header value or null
  *   - if called with no arguments returns an object containing all headers.
  */
 function headersGetter(headers) {
@@ -21491,7 +19645,7 @@ function headersGetter(headers) {
 
     if (name) {
       var value = headersObj[lowercase(name)];
-      if (value === undefined) {
+      if (value === void 0) {
         value = null;
       }
       return value;
@@ -21534,8 +19688,6 @@ function isSuccess(status) {
 /**
  * @ngdoc provider
  * @name $httpProvider
- * @this
- *
  * @description
  * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
  * */
@@ -21571,10 +19723,6 @@ function $HttpProvider() {
    *  If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
    *  Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
    *
-   * - **`defaults.jsonpCallbackParam`** - `{string}` - the name of the query parameter that passes the name of the
-   * callback in a JSONP request. The value of this parameter will be replaced with the expression generated by the
-   * {@link $jsonpCallbacks} service. Defaults to `'callback'`.
-   *
    **/
   var defaults = this.defaults = {
     // transform incoming response data
@@ -21598,9 +19746,7 @@ function $HttpProvider() {
     xsrfCookieName: 'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
 
-    paramSerializer: '$httpParamSerializer',
-
-    jsonpCallbackParam: 'callback'
+    paramSerializer: '$httpParamSerializer'
   };
 
   var useApplyAsync = false;
@@ -21631,6 +19777,30 @@ function $HttpProvider() {
     return useApplyAsync;
   };
 
+  var useLegacyPromise = true;
+  /**
+   * @ngdoc method
+   * @name $httpProvider#useLegacyPromiseExtensions
+   * @description
+   *
+   * Configure `$http` service to return promises without the shorthand methods `success` and `error`.
+   * This should be used to make sure that applications work without these methods.
+   *
+   * Defaults to true. If no value is specified, returns the current configured value.
+   *
+   * @param {boolean=} value If true, `$http` will return a promise with the deprecated legacy `success` and `error` methods.
+   *
+   * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
+   *    otherwise, returns the current configured value.
+   **/
+  this.useLegacyPromiseExtensions = function(value) {
+    if (isDefined(value)) {
+      useLegacyPromise = !!value;
+      return this;
+    }
+    return useLegacyPromise;
+  };
+
   /**
    * @ngdoc property
    * @name $httpProvider#interceptors
@@ -21646,8 +19816,8 @@ function $HttpProvider() {
    **/
   var interceptorFactories = this.interceptors = [];
 
-  this.$get = ['$browser', '$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector', '$sce',
-      function($browser, $httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector, $sce) {
+  this.$get = ['$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector',
+      function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {
 
     var defaultCache = $cacheFactory('$http');
 
@@ -21722,13 +19892,10 @@ function $HttpProvider() {
      *   - **config** â€“ `{Object}` â€“ The configuration object that was used to generate the request.
      *   - **statusText** â€“ `{string}` â€“ HTTP status text of the response.
      *
-     * A response status code between 200 and 299 is considered a success status and will result in
-     * the success callback being called. Any response status code outside of that range is
-     * considered an error status and will result in the error callback being called.
-     * Also, status codes less than -1 are normalized to zero. -1 usually means the request was
-     * aborted, e.g. using a `config.timeout`.
-     * Note that if the response is a redirect, XMLHttpRequest will transparently follow it, meaning
-     * that the outcome (success or error) will be determined by the final response status code.
+     * A response status code between 200 and 299 is considered a success status and
+     * will result in the success callback being called. Note that if the response is a redirect,
+     * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
+     * called for such responses.
      *
      *
      * ## Shortcut methods
@@ -21764,6 +19931,14 @@ function $HttpProvider() {
      * $httpBackend.flush();
      * ```
      *
+     * ## Deprecation Notice
+     * <div class="alert alert-danger">
+     *   The `$http` legacy promise methods `success` and `error` have been deprecated.
+     *   Use the standard `then` method instead.
+     *   If {@link $httpProvider#useLegacyPromiseExtensions `$httpProvider.useLegacyPromiseExtensions`} is set to
+     *   `false` then these methods will throw {@link $http:legacy `$http/legacy`} error.
+     * </div>
+     *
      * ## Setting HTTP Headers
      *
      * The $http service will automatically add certain HTTP headers to all requests. These defaults
@@ -21771,7 +19946,7 @@ function $HttpProvider() {
      * object, which currently contains this default configuration:
      *
      * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):
-     *   - <code>Accept: application/json, text/plain, \*&#65279;/&#65279;\*</code>
+     *   - `Accept: application/json, text/plain, * / *`
      * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)
      *   - `Content-Type: application/json`
      * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
@@ -21850,7 +20025,7 @@ function $HttpProvider() {
      *
      * ### Overriding the Default Transformations Per Request
      *
-     * If you wish to override the request/response transformations only for a single request then provide
+     * If you wish override the request/response transformations only for a single request then provide
      * `transformRequest` and/or `transformResponse` properties on the configuration object passed
      * into `$http`.
      *
@@ -21893,7 +20068,7 @@ function $HttpProvider() {
      *   * cache a specific response - set config.cache value to TRUE or to a cache object
      *
      * If caching is enabled, but neither the default cache nor config.cache are set to a cache object,
-     * then the default `$cacheFactory("$http")` object is used.
+     * then the default `$cacheFactory($http)` object is used.
      *
      * The default cache value can be set by updating the
      * {@link ng.$http#defaults `$http.defaults.cache`} property or the
@@ -22061,8 +20236,7 @@ function $HttpProvider() {
      *    processed. The object has following properties:
      *
      *    - **method** â€“ `{string}` â€“ HTTP method (e.g. 'GET', 'POST', etc)
-     *    - **url** â€“ `{string|TrustedObject}` â€“ Absolute or relative URL of the resource that is being requested;
-     *      or an object created by a call to `$sce.trustAsResourceUrl(url)`.
+     *    - **url** â€“ `{string}` â€“ Absolute or relative URL of the resource that is being requested.
      *    - **params** â€“ `{Object.<string|Object>}` â€“ Map of strings or objects which will be serialized
      *      with the `paramSerializer` and appended as GET parameters.
      *    - **data** â€“ `{string|Object}` â€“ Data to be sent as the request message data.
@@ -22116,7 +20290,7 @@ function $HttpProvider() {
      *
      *
      * @example
-<example module="httpExample" name="http-service">
+<example module="httpExample">
 <file name="index.html">
   <div ng-controller="FetchController">
     <select ng-model="method" aria-label="Request method">
@@ -22128,11 +20302,11 @@ function $HttpProvider() {
     <button id="samplegetbtn" ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
     <button id="samplejsonpbtn"
       ng-click="updateModel('JSONP',
-                    'https://angularjs.org/greet.php?name=Super%20Hero')">
+                    'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">
       Sample JSONP
     </button>
     <button id="invalidjsonpbtn"
-      ng-click="updateModel('JSONP', 'https://angularjs.org/doesntexist')">
+      ng-click="updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')">
         Invalid JSONP
       </button>
     <pre>http status code: {{status}}</pre>
@@ -22141,13 +20315,6 @@ function $HttpProvider() {
 </file>
 <file name="script.js">
   angular.module('httpExample', [])
-    .config(['$sceDelegateProvider', function($sceDelegateProvider) {
-      // We must whitelist the JSONP endpoint that we are using to show that we trust it
-      $sceDelegateProvider.resourceUrlWhitelist([
-        'self',
-        'https://angularjs.org/**'
-      ]);
-    }])
     .controller('FetchController', ['$scope', '$http', '$templateCache',
       function($scope, $http, $templateCache) {
         $scope.method = 'GET';
@@ -22162,7 +20329,7 @@ function $HttpProvider() {
               $scope.status = response.status;
               $scope.data = response.data;
             }, function(response) {
-              $scope.data = response.data || 'Request failed';
+              $scope.data = response.data || "Request failed";
               $scope.status = response.status;
           });
         };
@@ -22181,6 +20348,7 @@ function $HttpProvider() {
   var data = element(by.binding('data'));
   var fetchBtn = element(by.id('fetchbtn'));
   var sampleGetBtn = element(by.id('samplegetbtn'));
+  var sampleJsonpBtn = element(by.id('samplejsonpbtn'));
   var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));
 
   it('should make an xhr GET request', function() {
@@ -22192,7 +20360,6 @@ function $HttpProvider() {
 
 // Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185
 // it('should make a JSONP request to angularjs.org', function() {
-//   var sampleJsonpBtn = element(by.id('samplejsonpbtn'));
 //   sampleJsonpBtn.click();
 //   fetchBtn.click();
 //   expect(status.getText()).toMatch('200');
@@ -22215,62 +20382,96 @@ function $HttpProvider() {
         throw minErr('$http')('badreq', 'Http request configuration must be an object.  Received: {0}', requestConfig);
       }
 
-      if (!isString($sce.valueOf(requestConfig.url))) {
-        throw minErr('$http')('badreq', 'Http request configuration url must be a string or a $sce trusted object.  Received: {0}', requestConfig.url);
+      if (!isString(requestConfig.url)) {
+        throw minErr('$http')('badreq', 'Http request configuration url must be a string.  Received: {0}', requestConfig.url);
       }
 
       var config = extend({
         method: 'get',
         transformRequest: defaults.transformRequest,
         transformResponse: defaults.transformResponse,
-        paramSerializer: defaults.paramSerializer,
-        jsonpCallbackParam: defaults.jsonpCallbackParam
+        paramSerializer: defaults.paramSerializer
       }, requestConfig);
 
       config.headers = mergeHeaders(requestConfig);
       config.method = uppercase(config.method);
       config.paramSerializer = isString(config.paramSerializer) ?
-          $injector.get(config.paramSerializer) : config.paramSerializer;
+        $injector.get(config.paramSerializer) : config.paramSerializer;
 
-      $browser.$$incOutstandingRequestCount();
+      var serverRequest = function(config) {
+        var headers = config.headers;
+        var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);
 
-      var requestInterceptors = [];
-      var responseInterceptors = [];
-      var promise = $q.resolve(config);
+        // strip content-type if data is undefined
+        if (isUndefined(reqData)) {
+          forEach(headers, function(value, header) {
+            if (lowercase(header) === 'content-type') {
+                delete headers[header];
+            }
+          });
+        }
+
+        if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {
+          config.withCredentials = defaults.withCredentials;
+        }
+
+        // send request
+        return sendReq(config, reqData).then(transformResponse, transformResponse);
+      };
+
+      var chain = [serverRequest, undefined];
+      var promise = $q.when(config);
 
       // apply interceptors
       forEach(reversedInterceptors, function(interceptor) {
         if (interceptor.request || interceptor.requestError) {
-          requestInterceptors.unshift(interceptor.request, interceptor.requestError);
+          chain.unshift(interceptor.request, interceptor.requestError);
         }
         if (interceptor.response || interceptor.responseError) {
-          responseInterceptors.push(interceptor.response, interceptor.responseError);
+          chain.push(interceptor.response, interceptor.responseError);
         }
       });
 
-      promise = chainInterceptors(promise, requestInterceptors);
-      promise = promise.then(serverRequest);
-      promise = chainInterceptors(promise, responseInterceptors);
-      promise = promise.finally(completeOutstandingRequest);
-
-      return promise;
+      while (chain.length) {
+        var thenFn = chain.shift();
+        var rejectFn = chain.shift();
 
+        promise = promise.then(thenFn, rejectFn);
+      }
 
-      function chainInterceptors(promise, interceptors) {
-        for (var i = 0, ii = interceptors.length; i < ii;) {
-          var thenFn = interceptors[i++];
-          var rejectFn = interceptors[i++];
+      if (useLegacyPromise) {
+        promise.success = function(fn) {
+          assertArgFn(fn, 'fn');
 
-          promise = promise.then(thenFn, rejectFn);
-        }
+          promise.then(function(response) {
+            fn(response.data, response.status, response.headers, config);
+          });
+          return promise;
+        };
 
-        interceptors.length = 0;
+        promise.error = function(fn) {
+          assertArgFn(fn, 'fn');
 
-        return promise;
+          promise.then(null, function(response) {
+            fn(response.data, response.status, response.headers, config);
+          });
+          return promise;
+        };
+      } else {
+        promise.success = $httpMinErrLegacyFn('success');
+        promise.error = $httpMinErrLegacyFn('error');
       }
 
-      function completeOutstandingRequest() {
-        $browser.$$completeOutstandingRequest(noop);
+      return promise;
+
+      function transformResponse(response) {
+        // make a copy since the response must be cacheable
+        var resp = extend({}, response);
+        resp.data = transformData(response.data, response.headers, response.status,
+                                  config.transformResponse);
+        return (isSuccess(response.status))
+          ? resp
+          : $q.reject(resp);
       }
 
       function executeHeaderFns(headers, config) {
@@ -22314,37 +20515,6 @@ function $HttpProvider() {
         // execute if header value is a function for merged headers
         return executeHeaderFns(reqHeaders, shallowCopy(config));
       }
-
-      function serverRequest(config) {
-        var headers = config.headers;
-        var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);
-
-        // strip content-type if data is undefined
-        if (isUndefined(reqData)) {
-          forEach(headers, function(value, header) {
-            if (lowercase(header) === 'content-type') {
-              delete headers[header];
-            }
-          });
-        }
-
-        if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {
-          config.withCredentials = defaults.withCredentials;
-        }
-
-        // send request
-        return sendReq(config, reqData).then(transformResponse, transformResponse);
-      }
-
-      function transformResponse(response) {
-        // make a copy since the response must be cacheable
-        var resp = extend({}, response);
-        resp.data = transformData(response.data, response.headers, response.status,
-                                  config.transformResponse);
-        return (isSuccess(response.status))
-          ? resp
-          : $q.reject(resp);
-      }
     }
 
     $http.pendingRequests = [];
@@ -22356,8 +20526,7 @@ function $HttpProvider() {
      * @description
      * Shortcut method to perform `GET` request.
      *
-     * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested;
-     *                                   or an object created by a call to `$sce.trustAsResourceUrl(url)`.
+     * @param {string} url Relative or absolute URL specifying the destination of the request
      * @param {Object=} config Optional configuration object
      * @returns {HttpPromise} Future object
      */
@@ -22369,8 +20538,7 @@ function $HttpProvider() {
      * @description
      * Shortcut method to perform `DELETE` request.
      *
-     * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested;
-     *                                   or an object created by a call to `$sce.trustAsResourceUrl(url)`.
+     * @param {string} url Relative or absolute URL specifying the destination of the request
      * @param {Object=} config Optional configuration object
      * @returns {HttpPromise} Future object
      */
@@ -22382,8 +20550,7 @@ function $HttpProvider() {
      * @description
      * Shortcut method to perform `HEAD` request.
      *
-     * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested;
-     *                                   or an object created by a call to `$sce.trustAsResourceUrl(url)`.
+     * @param {string} url Relative or absolute URL specifying the destination of the request
      * @param {Object=} config Optional configuration object
      * @returns {HttpPromise} Future object
      */
@@ -22395,33 +20562,8 @@ function $HttpProvider() {
      * @description
      * Shortcut method to perform `JSONP` request.
      *
-     * Note that, since JSONP requests are sensitive because the response is given full access to the browser,
-     * the url must be declared, via {@link $sce} as a trusted resource URL.
-     * You can trust a URL by adding it to the whitelist via
-     * {@link $sceDelegateProvider#resourceUrlWhitelist  `$sceDelegateProvider.resourceUrlWhitelist`} or
-     * by explicitly trusting the URL via {@link $sce#trustAsResourceUrl `$sce.trustAsResourceUrl(url)`}.
-     *
-     * JSONP requests must specify a callback to be used in the response from the server. This callback
-     * is passed as a query parameter in the request. You must specify the name of this parameter by
-     * setting the `jsonpCallbackParam` property on the request config object.
-     *
-     * ```
-     * $http.jsonp('some/trusted/url', {jsonpCallbackParam: 'callback'})
-     * ```
-     *
-     * You can also specify a default callback parameter name in `$http.defaults.jsonpCallbackParam`.
-     * Initially this is set to `'callback'`.
-     *
-     * <div class="alert alert-danger">
-     * You can no longer use the `JSON_CALLBACK` string as a placeholder for specifying where the callback
-     * parameter value should go.
-     * </div>
-     *
-     * If you would like to customise where and how the callbacks are stored then try overriding
-     * or decorating the {@link $jsonpCallbacks} service.
-     *
-     * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested;
-     *                                   or an object created by a call to `$sce.trustAsResourceUrl(url)`.
+     * @param {string} url Relative or absolute URL specifying the destination of the request.
+     *                     The name of the callback should be the string `JSON_CALLBACK`.
      * @param {Object=} config Optional configuration object
      * @returns {HttpPromise} Future object
      */
@@ -22520,33 +20662,16 @@ function $HttpProvider() {
           cache,
           cachedResp,
           reqHeaders = config.headers,
-          isJsonp = lowercase(config.method) === 'jsonp',
-          url = config.url;
-
-      if (isJsonp) {
-        // JSONP is a pretty sensitive operation where we're allowing a script to have full access to
-        // our DOM and JS space.  So we require that the URL satisfies SCE.RESOURCE_URL.
-        url = $sce.getTrustedResourceUrl(url);
-      } else if (!isString(url)) {
-        // If it is not a string then the URL must be a $sce trusted object
-        url = $sce.valueOf(url);
-      }
-
-      url = buildUrl(url, config.paramSerializer(config.params));
-
-      if (isJsonp) {
-        // Check the url and add the JSONP callback placeholder
-        url = sanitizeJsonpCallbackParam(url, config.jsonpCallbackParam);
-      }
+          url = buildUrl(config.url, config.paramSerializer(config.params));
 
       $http.pendingRequests.push(config);
       promise.then(removePendingReq, removePendingReq);
 
+
       if ((config.cache || defaults.cache) && config.cache !== false &&
           (config.method === 'GET' || config.method === 'JSONP')) {
         cache = isObject(config.cache) ? config.cache
-            : isObject(/** @type {?} */ (defaults).cache)
-              ? /** @type {?} */ (defaults).cache
+              : isObject(defaults.cache) ? defaults.cache
               : defaultCache;
       }
 
@@ -22670,26 +20795,8 @@ function $HttpProvider() {
 
     function buildUrl(url, serializedParams) {
       if (serializedParams.length > 0) {
-        url += ((url.indexOf('?') === -1) ? '?' : '&') + serializedParams;
-      }
-      return url;
-    }
-
-    function sanitizeJsonpCallbackParam(url, key) {
-      if (/[&?][^=]+=JSON_CALLBACK/.test(url)) {
-        // Throw if the url already contains a reference to JSON_CALLBACK
-        throw $httpMinErr('badjsonp', 'Illegal use of JSON_CALLBACK in url, "{0}"', url);
+        url += ((url.indexOf('?') == -1) ? '?' : '&') + serializedParams;
       }
-
-      var callbackParamRegex = new RegExp('[&?]' + key + '=');
-      if (callbackParamRegex.test(url)) {
-        // Throw if the callback param was already provided
-        throw $httpMinErr('badjsonp', 'Illegal use of callback param, "{0}", in url, "{1}"', key, url);
-      }
-
-      // Add in the JSON_CALLBACK callback param value
-      url += ((url.indexOf('?') === -1) ? '?' : '&') + key + '=JSON_CALLBACK';
-
       return url;
     }
   }];
@@ -22698,7 +20805,6 @@ function $HttpProvider() {
 /**
  * @ngdoc service
  * @name $xhrFactory
- * @this
  *
  * @description
  * Factory function used to create XMLHttpRequest objects.
@@ -22728,10 +20834,9 @@ function $xhrFactoryProvider() {
 /**
  * @ngdoc service
  * @name $httpBackend
- * @requires $jsonpCallbacks
+ * @requires $window
  * @requires $document
  * @requires $xhrFactory
- * @this
  *
  * @description
  * HTTP backend used by the {@link ng.$http service} that delegates to
@@ -22744,23 +20849,28 @@ function $xhrFactoryProvider() {
  * $httpBackend} which can be trained with responses.
  */
 function $HttpBackendProvider() {
-  this.$get = ['$browser', '$jsonpCallbacks', '$document', '$xhrFactory', function($browser, $jsonpCallbacks, $document, $xhrFactory) {
-    return createHttpBackend($browser, $xhrFactory, $browser.defer, $jsonpCallbacks, $document[0]);
+  this.$get = ['$browser', '$window', '$document', '$xhrFactory', function($browser, $window, $document, $xhrFactory) {
+    return createHttpBackend($browser, $xhrFactory, $browser.defer, $window.angular.callbacks, $document[0]);
   }];
 }
 
 function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {
   // TODO(vojta): fix the signature
   return function(method, url, post, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers) {
+    $browser.$$incOutstandingRequestCount();
     url = url || $browser.url();
 
-    if (lowercase(method) === 'jsonp') {
-      var callbackPath = callbacks.createCallback(url);
-      var jsonpDone = jsonpReq(url, callbackPath, function(status, text) {
-        // jsonpReq only ever sets status to 200 (OK), 404 (ERROR) or -1 (WAITING)
-        var response = (status === 200) && callbacks.getResponse(callbackPath);
-        completeRequest(callback, status, response, '', text);
-        callbacks.removeCallback(callbackPath);
+    if (lowercase(method) == 'jsonp') {
+      var callbackId = '_' + (callbacks.counter++).toString(36);
+      callbacks[callbackId] = function(data) {
+        callbacks[callbackId].data = data;
+        callbacks[callbackId].called = true;
+      };
+
+      var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),
+          callbackId, function(status, text) {
+        completeRequest(callback, status, callbacks[callbackId].data, "", text);
+        callbacks[callbackId] = noop;
       });
     } else {
 
@@ -22787,7 +20897,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
         // Occurs when accessing file resources or on Android 4.1 stock browser
         // while retrieving files from application cache.
         if (status === 0) {
-          status = response ? 200 : urlResolve(url).protocol === 'file' ? 404 : 0;
+          status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;
         }
 
         completeRequest(callback,
@@ -22805,7 +20915,6 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
 
       xhr.onerror = requestError;
       xhr.onabort = requestError;
-      xhr.ontimeout = requestError;
 
       forEach(eventHandlers, function(value, key) {
           xhr.addEventListener(key, value);
@@ -22847,12 +20956,8 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
 
 
     function timeoutRequest() {
-      if (jsonpDone) {
-        jsonpDone();
-      }
-      if (xhr) {
-        xhr.abort();
-      }
+      jsonpDone && jsonpDone();
+      xhr && xhr.abort();
     }
 
     function completeRequest(callback, status, response, headersString, statusText) {
@@ -22863,33 +20968,33 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
       jsonpDone = xhr = null;
 
       callback(status, response, headersString, statusText);
+      $browser.$$completeOutstandingRequest(noop);
     }
   };
 
-  function jsonpReq(url, callbackPath, done) {
-    url = url.replace('JSON_CALLBACK', callbackPath);
+  function jsonpReq(url, callbackId, done) {
     // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.:
     // - fetches local scripts via XHR and evals them
     // - adds and immediately removes script elements from the document
     var script = rawDocument.createElement('script'), callback = null;
-    script.type = 'text/javascript';
+    script.type = "text/javascript";
     script.src = url;
     script.async = true;
 
     callback = function(event) {
-      script.removeEventListener('load', callback);
-      script.removeEventListener('error', callback);
+      removeEventListenerFn(script, "load", callback);
+      removeEventListenerFn(script, "error", callback);
       rawDocument.body.removeChild(script);
       script = null;
       var status = -1;
-      var text = 'unknown';
+      var text = "unknown";
 
       if (event) {
-        if (event.type === 'load' && !callbacks.wasCalled(callbackPath)) {
-          event = { type: 'error' };
+        if (event.type === "load" && !callbacks[callbackId].called) {
+          event = { type: "error" };
         }
         text = event.type;
-        status = event.type === 'error' ? 404 : 200;
+        status = event.type === "error" ? 404 : 200;
       }
 
       if (done) {
@@ -22897,8 +21002,8 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
       }
     };
 
-    script.addEventListener('load', callback);
-    script.addEventListener('error', callback);
+    addEventListenerFn(script, "load", callback);
+    addEventListenerFn(script, "error", callback);
     rawDocument.body.appendChild(script);
     return callback;
   }
@@ -22907,19 +21012,18 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
 var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');
 $interpolateMinErr.throwNoconcat = function(text) {
   throw $interpolateMinErr('noconcat',
-      'Error while interpolating: {0}\nStrict Contextual Escaping disallows ' +
-      'interpolations that concatenate multiple expressions when a trusted value is ' +
-      'required.  See http://docs.angularjs.org/api/ng.$sce', text);
+      "Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
+      "interpolations that concatenate multiple expressions when a trusted value is " +
+      "required.  See http://docs.angularjs.org/api/ng.$sce", text);
 };
 
 $interpolateMinErr.interr = function(text, err) {
-  return $interpolateMinErr('interr', 'Can\'t interpolate: {0}\n{1}', text, err.toString());
+  return $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString());
 };
 
 /**
  * @ngdoc provider
  * @name $interpolateProvider
- * @this
  *
  * @description
  *
@@ -23016,13 +21120,30 @@ function $InterpolateProvider() {
         replace(escapedEndRegexp, endSymbol);
     }
 
-    // TODO: this is the same as the constantWatchDelegate in parse.js
+    function stringify(value) {
+      if (value == null) { // null || undefined
+        return '';
+      }
+      switch (typeof value) {
+        case 'string':
+          break;
+        case 'number':
+          value = '' + value;
+          break;
+        default:
+          value = toJson(value);
+      }
+
+      return value;
+    }
+
+    //TODO: this is the same as the constantWatchDelegate in parse.js
     function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
-      var unwatch = scope.$watch(function constantInterpolateWatch(scope) {
+      var unwatch;
+      return unwatch = scope.$watch(function constantInterpolateWatch(scope) {
         unwatch();
         return constantInterp(scope);
       }, listener, objectEquality);
-      return unwatch;
     }
 
     /**
@@ -23068,7 +21189,7 @@ function $InterpolateProvider() {
      *
      * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior.
      *
-     * #### Escaped Interpolation
+     * ####Escaped Interpolation
      * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers
      * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash).
      * It will be rendered as a regular start/end marker, and will not be interpreted as an expression
@@ -23089,7 +21210,7 @@ function $InterpolateProvider() {
      * this is typically useful only when user-data is used in rendering a template from the server, or
      * when otherwise untrusted data is used by a directive.
      *
-     * <example name="interpolation">
+     * <example>
      *  <file name="index.html">
      *    <div ng-init="username='A user'">
      *      <p ng-init="apptitle='Escaping demo'">{{apptitle}}: \{\{ username = "defaced value"; \}\}
@@ -23104,30 +21225,6 @@ function $InterpolateProvider() {
      *  </file>
      * </example>
      *
-     * @knownIssue
-     * It is currently not possible for an interpolated expression to contain the interpolation end
-     * symbol. For example, `{{ '}}' }}` will be incorrectly interpreted as `{{ ' }}` + `' }}`, i.e.
-     * an interpolated expression consisting of a single-quote (`'`) and the `' }}` string.
-     *
-     * @knownIssue
-     * All directives and components must use the standard `{{` `}}` interpolation symbols
-     * in their templates. If you change the application interpolation symbols the {@link $compile}
-     * service will attempt to denormalize the standard symbols to the custom symbols.
-     * The denormalization process is not clever enough to know not to replace instances of the standard
-     * symbols where they would not normally be treated as interpolation symbols. For example in the following
-     * code snippet the closing braces of the literal object will get incorrectly denormalized:
-     *
-     * ```
-     * <div data-context='{"context":{"id":3,"type":"page"}}">
-     * ```
-     *
-     * The workaround is to ensure that such instances are separated by whitespace:
-     * ```
-     * <div data-context='{"context":{"id":3,"type":"page"} }">
-     * ```
-     *
-     * See https://github.com/angular/angular.js/pull/14610#issuecomment-219401099 for more information.
-     *
      * @param {string} text The text with markup to interpolate.
      * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have
      *    embedded expression in order to return an interpolation function. Strings with no
@@ -23169,8 +21266,8 @@ function $InterpolateProvider() {
           expressionPositions = [];
 
       while (index < textLength) {
-        if (((startIndex = text.indexOf(startSymbol, index)) !== -1) &&
-             ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) !== -1)) {
+        if (((startIndex = text.indexOf(startSymbol, index)) != -1) &&
+             ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) {
           if (index !== startIndex) {
             concat.push(unescapeText(text.substring(index, startIndex)));
           }
@@ -23235,7 +21332,7 @@ function $InterpolateProvider() {
           expressions: expressions,
           $$watchDelegate: function(scope, listener) {
             var lastValue;
-            return scope.$watchGroup(parseFns, /** @this */ function interpolateFnWatcher(values, oldValues) {
+            return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {
               var currValue = compute(values);
               if (isFunction(listener)) {
                 listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);
@@ -23292,7 +21389,6 @@ function $InterpolateProvider() {
   }];
 }
 
-/** @this */
 function $IntervalProvider() {
   this.$get = ['$rootScope', '$window', '$q', '$$q', '$browser',
        function($rootScope,   $window,   $q,   $$q,   $browser) {
@@ -23325,18 +21421,17 @@ function $IntervalProvider() {
       * appropriate moment.  See the example below for more details on how and when to do this.
       * </div>
       *
-      * @param {function()} fn A function that should be called repeatedly. If no additional arguments
-      *   are passed (see below), the function is called with the current iteration count.
+      * @param {function()} fn A function that should be called repeatedly.
       * @param {number} delay Number of milliseconds between each function call.
       * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat
       *   indefinitely.
       * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
       *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
       * @param {...*=} Pass additional parameters to the executed function.
-      * @returns {promise} A promise which will be notified on each iteration. It will resolve once all iterations of the interval complete.
+      * @returns {promise} A promise which will be notified on each iteration.
       *
       * @example
-      * <example module="intervalExample" name="interval-service">
+      * <example module="intervalExample">
       * <file name="index.html">
       *   <script>
       *     angular.module('intervalExample', [])
@@ -23481,8 +21576,6 @@ function $IntervalProvider() {
       */
     interval.cancel = function(promise) {
       if (promise && promise.$$intervalId in intervals) {
-        // Interval cancels should not report as unhandled promise.
-        intervals[promise.$$intervalId].promise.catch(noop);
         intervals[promise.$$intervalId].reject('canceled');
         $window.clearInterval(promise.$$intervalId);
         delete intervals[promise.$$intervalId];
@@ -23497,87 +21590,6 @@ function $IntervalProvider() {
 
 /**
  * @ngdoc service
- * @name $jsonpCallbacks
- * @requires $window
- * @description
- * This service handles the lifecycle of callbacks to handle JSONP requests.
- * Override this service if you wish to customise where the callbacks are stored and
- * how they vary compared to the requested url.
- */
-var $jsonpCallbacksProvider = /** @this */ function() {
-  this.$get = function() {
-    var callbacks = angular.callbacks;
-    var callbackMap = {};
-
-    function createCallback(callbackId) {
-      var callback = function(data) {
-        callback.data = data;
-        callback.called = true;
-      };
-      callback.id = callbackId;
-      return callback;
-    }
-
-    return {
-      /**
-       * @ngdoc method
-       * @name $jsonpCallbacks#createCallback
-       * @param {string} url the url of the JSONP request
-       * @returns {string} the callback path to send to the server as part of the JSONP request
-       * @description
-       * {@link $httpBackend} calls this method to create a callback and get hold of the path to the callback
-       * to pass to the server, which will be used to call the callback with its payload in the JSONP response.
-       */
-      createCallback: function(url) {
-        var callbackId = '_' + (callbacks.$$counter++).toString(36);
-        var callbackPath = 'angular.callbacks.' + callbackId;
-        var callback = createCallback(callbackId);
-        callbackMap[callbackPath] = callbacks[callbackId] = callback;
-        return callbackPath;
-      },
-      /**
-       * @ngdoc method
-       * @name $jsonpCallbacks#wasCalled
-       * @param {string} callbackPath the path to the callback that was sent in the JSONP request
-       * @returns {boolean} whether the callback has been called, as a result of the JSONP response
-       * @description
-       * {@link $httpBackend} calls this method to find out whether the JSONP response actually called the
-       * callback that was passed in the request.
-       */
-      wasCalled: function(callbackPath) {
-        return callbackMap[callbackPath].called;
-      },
-      /**
-       * @ngdoc method
-       * @name $jsonpCallbacks#getResponse
-       * @param {string} callbackPath the path to the callback that was sent in the JSONP request
-       * @returns {*} the data received from the response via the registered callback
-       * @description
-       * {@link $httpBackend} calls this method to get hold of the data that was provided to the callback
-       * in the JSONP response.
-       */
-      getResponse: function(callbackPath) {
-        return callbackMap[callbackPath].data;
-      },
-      /**
-       * @ngdoc method
-       * @name $jsonpCallbacks#removeCallback
-       * @param {string} callbackPath the path to the callback that was sent in the JSONP request
-       * @description
-       * {@link $httpBackend} calls this method to remove the callback after the JSONP request has
-       * completed or timed-out.
-       */
-      removeCallback: function(callbackPath) {
-        var callback = callbackMap[callbackPath];
-        delete callbacks[callback.id];
-        delete callbackMap[callbackPath];
-      }
-    };
-  };
-};
-
-/**
- * @ngdoc service
  * @name $locale
  *
  * @description
@@ -23587,7 +21599,7 @@ var $jsonpCallbacksProvider = /** @this */ function() {
  * * `id` â€“ `{string}` â€“ locale id formatted as `languageId-countryId` (e.g. `en-us`)
  */
 
-var PATH_MATCH = /^([^?#]*)(\?([^#]*))?(#(.*))?$/,
+var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
     DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
 var $locationMinErr = minErr('$location');
 
@@ -23617,50 +21629,42 @@ function parseAbsoluteUrl(absoluteUrl, locationObj) {
   locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
 }
 
-var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/;
-function parseAppUrl(url, locationObj) {
-
-  if (DOUBLE_SLASH_REGEX.test(url)) {
-    throw $locationMinErr('badpath', 'Invalid url "{0}".', url);
-  }
 
-  var prefixed = (url.charAt(0) !== '/');
+function parseAppUrl(relativeUrl, locationObj) {
+  var prefixed = (relativeUrl.charAt(0) !== '/');
   if (prefixed) {
-    url = '/' + url;
+    relativeUrl = '/' + relativeUrl;
   }
-  var match = urlResolve(url);
+  var match = urlResolve(relativeUrl);
   locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
       match.pathname.substring(1) : match.pathname);
   locationObj.$$search = parseKeyValue(match.search);
   locationObj.$$hash = decodeURIComponent(match.hash);
 
   // make sure path starts with '/';
-  if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') {
+  if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {
     locationObj.$$path = '/' + locationObj.$$path;
   }
 }
 
-function startsWith(str, search) {
-  return str.slice(0, search.length) === search;
-}
 
 /**
  *
- * @param {string} base
- * @param {string} url
- * @returns {string} returns text from `url` after `base` or `undefined` if it does not begin with
- *                   the expected string.
+ * @param {string} begin
+ * @param {string} whole
+ * @returns {string} returns text from whole after begin or undefined if it does not begin with
+ *                   expected string.
  */
-function stripBaseUrl(base, url) {
-  if (startsWith(url, base)) {
-    return url.substr(base.length);
+function beginsWith(begin, whole) {
+  if (whole.indexOf(begin) === 0) {
+    return whole.substr(begin.length);
   }
 }
 
 
 function stripHash(url) {
   var index = url.indexOf('#');
-  return index === -1 ? url : url.substr(0, index);
+  return index == -1 ? url : url.substr(0, index);
 }
 
 function trimEmptyHash(url) {
@@ -23679,13 +21683,13 @@ function serverBase(url) {
 
 
 /**
- * LocationHtml5Url represents a URL
+ * LocationHtml5Url represents an url
  * This object is exposed as $location service when HTML5 mode is enabled and supported
  *
  * @constructor
  * @param {string} appBase application base URL
  * @param {string} appBaseNoFile application base URL stripped of any filename
- * @param {string} basePrefix URL path prefix
+ * @param {string} basePrefix url path prefix
  */
 function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
   this.$$html5 = true;
@@ -23694,12 +21698,12 @@ function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
 
 
   /**
-   * Parse given HTML5 (regular) URL string into properties
-   * @param {string} url HTML5 URL
+   * Parse given html5 (regular) url string into properties
+   * @param {string} url HTML5 url
    * @private
    */
   this.$$parse = function(url) {
-    var pathUrl = stripBaseUrl(appBaseNoFile, url);
+    var pathUrl = beginsWith(appBaseNoFile, url);
     if (!isString(pathUrl)) {
       throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url,
           appBaseNoFile);
@@ -23724,8 +21728,6 @@ function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
 
     this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
     this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'
-
-    this.$$urlUpdatedByLocation = true;
   };
 
   this.$$parseLinkUrl = function(url, relHref) {
@@ -23738,17 +21740,16 @@ function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
     var appUrl, prevAppUrl;
     var rewrittenUrl;
 
-
-    if (isDefined(appUrl = stripBaseUrl(appBase, url))) {
+    if (isDefined(appUrl = beginsWith(appBase, url))) {
       prevAppUrl = appUrl;
-      if (basePrefix && isDefined(appUrl = stripBaseUrl(basePrefix, appUrl))) {
-        rewrittenUrl = appBaseNoFile + (stripBaseUrl('/', appUrl) || appUrl);
+      if (isDefined(appUrl = beginsWith(basePrefix, appUrl))) {
+        rewrittenUrl = appBaseNoFile + (beginsWith('/', appUrl) || appUrl);
       } else {
         rewrittenUrl = appBase + prevAppUrl;
       }
-    } else if (isDefined(appUrl = stripBaseUrl(appBaseNoFile, url))) {
+    } else if (isDefined(appUrl = beginsWith(appBaseNoFile, url))) {
       rewrittenUrl = appBaseNoFile + appUrl;
-    } else if (appBaseNoFile === url + '/') {
+    } else if (appBaseNoFile == url + '/') {
       rewrittenUrl = appBaseNoFile;
     }
     if (rewrittenUrl) {
@@ -23760,7 +21761,7 @@ function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
 
 
 /**
- * LocationHashbangUrl represents URL
+ * LocationHashbangUrl represents url
  * This object is exposed as $location service when developer doesn't opt into html5 mode.
  * It also serves as the base class for html5 mode fallback on legacy browsers.
  *
@@ -23775,19 +21776,19 @@ function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
 
 
   /**
-   * Parse given hashbang URL into properties
-   * @param {string} url Hashbang URL
+   * Parse given hashbang url into properties
+   * @param {string} url Hashbang url
    * @private
    */
   this.$$parse = function(url) {
-    var withoutBaseUrl = stripBaseUrl(appBase, url) || stripBaseUrl(appBaseNoFile, url);
+    var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);
     var withoutHashUrl;
 
     if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') {
 
-      // The rest of the URL starts with a hash so we have
+      // The rest of the url starts with a hash so we have
       // got either a hashbang path or a plain hash fragment
-      withoutHashUrl = stripBaseUrl(hashPrefix, withoutBaseUrl);
+      withoutHashUrl = beginsWith(hashPrefix, withoutBaseUrl);
       if (isUndefined(withoutHashUrl)) {
         // There was no hashbang prefix so we just have a hash fragment
         withoutHashUrl = withoutBaseUrl;
@@ -23803,7 +21804,7 @@ function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
         withoutHashUrl = '';
         if (isUndefined(withoutBaseUrl)) {
           appBase = url;
-          /** @type {?} */ (this).replace();
+          this.replace();
         }
       }
     }
@@ -23835,7 +21836,7 @@ function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
       var firstPathSegmentMatch;
 
       //Get the relative path from the input URL.
-      if (startsWith(url, base)) {
+      if (url.indexOf(base) === 0) {
         url = url.replace(base, '');
       }
 
@@ -23850,7 +21851,7 @@ function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
   };
 
   /**
-   * Compose hashbang URL and update `absUrl` property
+   * Compose hashbang url and update `absUrl` property
    * @private
    */
   this.$$compose = function() {
@@ -23859,12 +21860,10 @@ function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
 
     this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
     this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
-
-    this.$$urlUpdatedByLocation = true;
   };
 
   this.$$parseLinkUrl = function(url, relHref) {
-    if (stripHash(appBase) === stripHash(url)) {
+    if (stripHash(appBase) == stripHash(url)) {
       this.$$parse(url);
       return true;
     }
@@ -23874,7 +21873,7 @@ function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
 
 
 /**
- * LocationHashbangUrl represents URL
+ * LocationHashbangUrl represents url
  * This object is exposed as $location service when html5 history api is enabled but the browser
  * does not support it.
  *
@@ -23898,9 +21897,9 @@ function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
     var rewrittenUrl;
     var appUrl;
 
-    if (appBase === stripHash(url)) {
+    if (appBase == stripHash(url)) {
       rewrittenUrl = url;
-    } else if ((appUrl = stripBaseUrl(appBaseNoFile, url))) {
+    } else if ((appUrl = beginsWith(appBaseNoFile, url))) {
       rewrittenUrl = appBase + hashPrefix + appUrl;
     } else if (appBaseNoFile === url + '/') {
       rewrittenUrl = appBaseNoFile;
@@ -23918,8 +21917,6 @@ function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
     this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
     // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'
     this.$$absUrl = appBase + hashPrefix + this.$$url;
-
-    this.$$urlUpdatedByLocation = true;
   };
 
 }
@@ -23928,12 +21925,6 @@ function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
 var locationPrototype = {
 
   /**
-   * Ensure absolute URL is initialized.
-   * @private
-   */
-  $$absUrl:'',
-
-  /**
    * Are we in html5 mode?
    * @private
    */
@@ -23952,17 +21943,17 @@ var locationPrototype = {
    * @description
    * This method is getter only.
    *
-   * Return full URL representation with all segments encoded according to rules specified in
+   * Return full url representation with all segments encoded according to rules specified in
    * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
    *
    *
    * ```js
-   * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
    * var absUrl = $location.absUrl();
    * // => "http://example.com/#/some/path?foo=bar&baz=xoxo"
    * ```
    *
-   * @return {string} full URL
+   * @return {string} full url
    */
   absUrl: locationGetter('$$absUrl'),
 
@@ -23973,18 +21964,18 @@ var locationPrototype = {
    * @description
    * This method is getter / setter.
    *
-   * Return URL (e.g. `/path?a=b#hash`) when called without any parameter.
+   * Return url (e.g. `/path?a=b#hash`) when called without any parameter.
    *
    * Change path, search and hash, when called with parameter and return `$location`.
    *
    *
    * ```js
-   * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
    * var url = $location.url();
    * // => "/some/path?foo=bar&baz=xoxo"
    * ```
    *
-   * @param {string=} url New URL without base prefix (e.g. `/path?a=b#hash`)
+   * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
    * @return {string} url
    */
   url: function(url) {
@@ -24007,16 +21998,16 @@ var locationPrototype = {
    * @description
    * This method is getter only.
    *
-   * Return protocol of current URL.
+   * Return protocol of current url.
    *
    *
    * ```js
-   * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
    * var protocol = $location.protocol();
    * // => "http"
    * ```
    *
-   * @return {string} protocol of current URL
+   * @return {string} protocol of current url
    */
   protocol: locationGetter('$$protocol'),
 
@@ -24027,24 +22018,24 @@ var locationPrototype = {
    * @description
    * This method is getter only.
    *
-   * Return host of current URL.
+   * Return host of current url.
    *
    * Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
    *
    *
    * ```js
-   * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
    * var host = $location.host();
    * // => "example.com"
    *
-   * // given URL http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo
+   * // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo
    * host = $location.host();
    * // => "example.com"
    * host = location.host;
    * // => "example.com:8080"
    * ```
    *
-   * @return {string} host of current URL.
+   * @return {string} host of current url.
    */
   host: locationGetter('$$host'),
 
@@ -24055,11 +22046,11 @@ var locationPrototype = {
    * @description
    * This method is getter only.
    *
-   * Return port of current URL.
+   * Return port of current url.
    *
    *
    * ```js
-   * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
    * var port = $location.port();
    * // => 80
    * ```
@@ -24075,7 +22066,7 @@ var locationPrototype = {
    * @description
    * This method is getter / setter.
    *
-   * Return path of current URL when called without any parameter.
+   * Return path of current url when called without any parameter.
    *
    * Change path when called with parameter and return `$location`.
    *
@@ -24084,17 +22075,17 @@ var locationPrototype = {
    *
    *
    * ```js
-   * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
    * var path = $location.path();
    * // => "/some/path"
    * ```
    *
    * @param {(string|number)=} path New path
-   * @return {(string|object)} path if called with no parameters, or `$location` if called with a parameter
+   * @return {string} path
    */
   path: locationGetterSetter('$$path', function(path) {
     path = path !== null ? path.toString() : '';
-    return path.charAt(0) === '/' ? path : '/' + path;
+    return path.charAt(0) == '/' ? path : '/' + path;
   }),
 
   /**
@@ -24104,13 +22095,13 @@ var locationPrototype = {
    * @description
    * This method is getter / setter.
    *
-   * Return search part (as object) of current URL when called without any parameter.
+   * Return search part (as object) of current url when called without any parameter.
    *
    * Change search part when called with parameter and return `$location`.
    *
    *
    * ```js
-   * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
    * var searchObject = $location.search();
    * // => {foo: 'bar', baz: 'xoxo'}
    *
@@ -24126,7 +22117,7 @@ var locationPrototype = {
    * of `$location` to the specified value.
    *
    * If the argument is a hash object containing an array of values, these values will be encoded
-   * as duplicate search parameters in the URL.
+   * as duplicate search parameters in the url.
    *
    * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`
    * will override only a single search property.
@@ -24188,7 +22179,7 @@ var locationPrototype = {
    *
    *
    * ```js
-   * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
    * var hash = $location.hash();
    * // => "hashValue"
    * ```
@@ -24249,7 +22240,6 @@ forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], fun
     // but we're changing the $$state reference to $browser.state() during the $digest
     // so the modification window is narrow.
     this.$$state = isUndefined(state) ? null : state;
-    this.$$urlUpdatedByLocation = true;
 
     return this;
   };
@@ -24257,14 +22247,14 @@ forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], fun
 
 
 function locationGetter(property) {
-  return /** @this */ function() {
+  return function() {
     return this[property];
   };
 }
 
 
 function locationGetterSetter(property, preprocess) {
-  return /** @this */ function(value) {
+  return function(value) {
     if (isUndefined(value)) {
       return this[property];
     }
@@ -24306,13 +22296,11 @@ function locationGetterSetter(property, preprocess) {
 /**
  * @ngdoc provider
  * @name $locationProvider
- * @this
- *
  * @description
  * Use the `$locationProvider` to configure how the application deep linking paths are stored.
  */
 function $LocationProvider() {
-  var hashPrefix = '!',
+  var hashPrefix = '',
       html5Mode = {
         enabled: false,
         requireBase: true,
@@ -24323,7 +22311,6 @@ function $LocationProvider() {
    * @ngdoc method
    * @name $locationProvider#hashPrefix
    * @description
-   * The default value for the prefix is `'!'`.
    * @param {string=} prefix Prefix for hash part (containing path and search)
    * @returns {*} current value if used as getter or itself (chaining) if used as setter
    */
@@ -24350,12 +22337,8 @@ function $LocationProvider() {
    *     whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are
    *     true, and a base tag is not present, an error will be thrown when `$location` is injected.
    *     See the {@link guide/$location $location guide for more information}
-   *   - **rewriteLinks** - `{boolean|string}` - (default: `true`) When html5Mode is enabled,
-   *     enables/disables URL rewriting for relative links. If set to a string, URL rewriting will
-   *     only happen on links with an attribute that matches the given string. For example, if set
-   *     to `'internal-link'`, then the URL will only be rewritten for `<a internal-link>` links.
-   *     Note that [attribute name normalization](guide/directive#normalization) does not apply
-   *     here, so `'internalLink'` will **not** match `'internal-link'`.
+   *   - **rewriteLinks** - `{boolean}` - (default: `true`) When html5Mode is enabled,
+   *     enables/disables url rewriting for relative links.
    *
    * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter
    */
@@ -24373,7 +22356,7 @@ function $LocationProvider() {
         html5Mode.requireBase = mode.requireBase;
       }
 
-      if (isBoolean(mode.rewriteLinks) || isString(mode.rewriteLinks)) {
+      if (isBoolean(mode.rewriteLinks)) {
         html5Mode.rewriteLinks = mode.rewriteLinks;
       }
 
@@ -24433,7 +22416,7 @@ function $LocationProvider() {
     if (html5Mode.enabled) {
       if (!baseHref && html5Mode.requireBase) {
         throw $locationMinErr('nobase',
-          '$location in HTML5 mode requires a <base> tag to be present!');
+          "$location in HTML5 mode requires a <base> tag to be present!");
       }
       appBase = serverBase(initialUrl) + (baseHref || '/');
       LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;
@@ -24470,11 +22453,10 @@ function $LocationProvider() {
     }
 
     $rootElement.on('click', function(event) {
-      var rewriteLinks = html5Mode.rewriteLinks;
       // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
       // currently we open nice url link and redirect then
 
-      if (!rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which === 2 || event.button === 2) return;
+      if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;
 
       var elm = jqLite(event.target);
 
@@ -24484,8 +22466,6 @@ function $LocationProvider() {
         if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
       }
 
-      if (isString(rewriteLinks) && isUndefined(elm.attr(rewriteLinks))) return;
-
       var absHref = elm.prop('href');
       // get the actual href attribute - see
       // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx
@@ -24507,7 +22487,7 @@ function $LocationProvider() {
           // getting double entries in the location history.
           event.preventDefault();
           // update location manually
-          if ($location.absUrl() !== $browser.url()) {
+          if ($location.absUrl() != $browser.url()) {
             $rootScope.$apply();
             // hack to work around FF6 bug 684208 when scenario runner clicks on links
             $window.angular['ff-684208-preventDefault'] = true;
@@ -24518,7 +22498,7 @@ function $LocationProvider() {
 
 
     // rewrite hashbang url <> html5 url
-    if (trimEmptyHash($location.absUrl()) !== trimEmptyHash(initialUrl)) {
+    if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {
       $browser.url($location.absUrl(), true);
     }
 
@@ -24527,7 +22507,7 @@ function $LocationProvider() {
     // update $location when $browser url changes
     $browser.onUrlChange(function(newUrl, newState) {
 
-      if (!startsWith(newUrl, appBaseNoFile)) {
+      if (isUndefined(beginsWith(appBaseNoFile, newUrl))) {
         // If we are navigating outside of the app then force a reload
         $window.location.href = newUrl;
         return;
@@ -24562,40 +22542,36 @@ function $LocationProvider() {
 
     // update browser
     $rootScope.$watch(function $locationWatch() {
-      if (initializing || $location.$$urlUpdatedByLocation) {
-        $location.$$urlUpdatedByLocation = false;
+      var oldUrl = trimEmptyHash($browser.url());
+      var newUrl = trimEmptyHash($location.absUrl());
+      var oldState = $browser.state();
+      var currentReplace = $location.$$replace;
+      var urlOrStateChanged = oldUrl !== newUrl ||
+        ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);
 
-        var oldUrl = trimEmptyHash($browser.url());
-        var newUrl = trimEmptyHash($location.absUrl());
-        var oldState = $browser.state();
-        var currentReplace = $location.$$replace;
-        var urlOrStateChanged = oldUrl !== newUrl ||
-          ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);
+      if (initializing || urlOrStateChanged) {
+        initializing = false;
 
-        if (initializing || urlOrStateChanged) {
-          initializing = false;
-
-          $rootScope.$evalAsync(function() {
-            var newUrl = $location.absUrl();
-            var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
-                $location.$$state, oldState).defaultPrevented;
+        $rootScope.$evalAsync(function() {
+          var newUrl = $location.absUrl();
+          var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
+              $location.$$state, oldState).defaultPrevented;
 
-            // if the location was changed by a `$locationChangeStart` handler then stop
-            // processing this location change
-            if ($location.absUrl() !== newUrl) return;
+          // if the location was changed by a `$locationChangeStart` handler then stop
+          // processing this location change
+          if ($location.absUrl() !== newUrl) return;
 
-            if (defaultPrevented) {
-              $location.$$parse(oldUrl);
-              $location.$$state = oldState;
-            } else {
-              if (urlOrStateChanged) {
-                setBrowserUrlWithFallback(newUrl, currentReplace,
-                                          oldState === $location.$$state ? null : $location.$$state);
-              }
-              afterLocationChange(oldUrl, oldState);
+          if (defaultPrevented) {
+            $location.$$parse(oldUrl);
+            $location.$$state = oldState;
+          } else {
+            if (urlOrStateChanged) {
+              setBrowserUrlWithFallback(newUrl, currentReplace,
+                                        oldState === $location.$$state ? null : $location.$$state);
             }
-          });
-        }
+            afterLocationChange(oldUrl, oldState);
+          }
+        });
       }
 
       $location.$$replace = false;
@@ -24628,7 +22604,7 @@ function $LocationProvider() {
  * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
  *
  * @example
-   <example module="logExample" name="log-service">
+   <example module="logExample">
      <file name="script.js">
        angular.module('logExample', [])
          .controller('LogController', ['$scope', '$log', function($scope, $log) {
@@ -24654,8 +22630,6 @@ function $LocationProvider() {
 /**
  * @ngdoc provider
  * @name $logProvider
- * @this
- *
  * @description
  * Use the `$logProvider` to configure how the application logs messages
  */
@@ -24673,22 +22647,13 @@ function $LogProvider() {
   this.debugEnabled = function(flag) {
     if (isDefined(flag)) {
       debug = flag;
-      return this;
+    return this;
     } else {
       return debug;
     }
   };
 
   this.$get = ['$window', function($window) {
-    // Support: IE 9-11, Edge 12-14+
-    // IE/Edge display errors in such a way that it requires the user to click in 4 places
-    // to see the stack trace. There is no way to feature-detect it so there's a chance
-    // of the user agent sniffing to go wrong but since it's only about logging, this shouldn't
-    // break apps. Other browsers display errors in a sensible way and some of them map stack
-    // traces along source maps if available so it makes sense to let browsers display it
-    // as they want.
-    var formatStackTrace = msie || /\bEdge\//.test($window.navigator && $window.navigator.userAgent);
-
     return {
       /**
        * @ngdoc method
@@ -24741,12 +22706,12 @@ function $LogProvider() {
             fn.apply(self, arguments);
           }
         };
-      })()
+      }())
     };
 
     function formatError(arg) {
       if (arg instanceof Error) {
-        if (arg.stack && formatStackTrace) {
+        if (arg.stack) {
           arg = (arg.message && arg.stack.indexOf(arg.message) === -1)
               ? 'Error: ' + arg.message + '\n' + arg.stack
               : arg.stack;
@@ -24766,7 +22731,7 @@ function $LogProvider() {
       // The reason behind this is that console.log has type "object" in IE8...
       try {
         hasApply = !!logFn.apply;
-      } catch (e) { /* empty */ }
+      } catch (e) {}
 
       if (hasApply) {
         return function() {
@@ -24800,23 +22765,41 @@ function $LogProvider() {
 
 var $parseMinErr = minErr('$parse');
 
-var objectValueOf = {}.constructor.prototype.valueOf;
-
 // Sandboxing Angular Expressions
 // ------------------------------
-// Angular expressions are no longer sandboxed. So it is now even easier to access arbitrary JS code by
-// various means such as obtaining a reference to native JS functions like the Function constructor.
+// Angular expressions are generally considered safe because these expressions only have direct
+// access to `$scope` and locals. However, one can obtain the ability to execute arbitrary JS code by
+// obtaining a reference to native JS functions such as the Function constructor.
 //
 // As an example, consider the following Angular expression:
 //
 //   {}.toString.constructor('alert("evil JS code")')
 //
-// It is important to realize that if you create an expression from a string that contains user provided
-// content then it is possible that your application contains a security vulnerability to an XSS style attack.
+// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits
+// against the expression language, but not to prevent exploits that were enabled by exposing
+// sensitive JavaScript or browser APIs on Scope. Exposing such objects on a Scope is never a good
+// practice and therefore we are not even trying to protect against interaction with an object
+// explicitly exposed in this way.
+//
+// In general, it is not possible to access a Window object from an angular expression unless a
+// window or some DOM object that has a reference to window is published onto a Scope.
+// Similarly we prevent invocations of function known to be dangerous, as well as assignments to
+// native objects.
 //
 // See https://docs.angularjs.org/guide/security
 
 
+function ensureSafeMemberName(name, fullExpression) {
+  if (name === "__defineGetter__" || name === "__defineSetter__"
+      || name === "__lookupGetter__" || name === "__lookupSetter__"
+      || name === "__proto__") {
+    throw $parseMinErr('isecfld',
+        'Attempting to access a disallowed field in Angular expressions! '
+        + 'Expression: {0}', fullExpression);
+  }
+  return name;
+}
+
 function getStringValue(name) {
   // Property names must be strings. This means that non-string objects cannot be used
   // as keys in an object. Any non-string object, including a number, is typecasted
@@ -24835,10 +22818,64 @@ function getStringValue(name) {
   return name + '';
 }
 
+function ensureSafeObject(obj, fullExpression) {
+  // nifty check if obj is Function that is fast and works across iframes and other contexts
+  if (obj) {
+    if (obj.constructor === obj) {
+      throw $parseMinErr('isecfn',
+          'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+          fullExpression);
+    } else if (// isWindow(obj)
+        obj.window === obj) {
+      throw $parseMinErr('isecwindow',
+          'Referencing the Window in Angular expressions is disallowed! Expression: {0}',
+          fullExpression);
+    } else if (// isElement(obj)
+        obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {
+      throw $parseMinErr('isecdom',
+          'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',
+          fullExpression);
+    } else if (// block Object so that we can't get hold of dangerous Object.* methods
+        obj === Object) {
+      throw $parseMinErr('isecobj',
+          'Referencing Object in Angular expressions is disallowed! Expression: {0}',
+          fullExpression);
+    }
+  }
+  return obj;
+}
+
+var CALL = Function.prototype.call;
+var APPLY = Function.prototype.apply;
+var BIND = Function.prototype.bind;
+
+function ensureSafeFunction(obj, fullExpression) {
+  if (obj) {
+    if (obj.constructor === obj) {
+      throw $parseMinErr('isecfn',
+        'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+        fullExpression);
+    } else if (obj === CALL || obj === APPLY || obj === BIND) {
+      throw $parseMinErr('isecff',
+        'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',
+        fullExpression);
+    }
+  }
+}
+
+function ensureSafeAssignContext(obj, fullExpression) {
+  if (obj) {
+    if (obj === (0).constructor || obj === (false).constructor || obj === ''.constructor ||
+        obj === {}.constructor || obj === [].constructor || obj === Function.constructor) {
+      throw $parseMinErr('isecaf',
+        'Assigning to a constructor is disallowed! Expression: {0}', fullExpression);
+    }
+  }
+}
 
 var OPERATORS = createMap();
 forEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });
-var ESCAPE = {'n':'\n', 'f':'\f', 'r':'\r', 't':'\t', 'v':'\v', '\'':'\'', '"':'"'};
+var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
 
 
 /////////////////////////////////////////
@@ -24847,7 +22884,7 @@ var ESCAPE = {'n':'\n', 'f':'\f', 'r':'\r', 't':'\t', 'v':'\v', '\'':'\'', '"':'
 /**
  * @constructor
  */
-var Lexer = function Lexer(options) {
+var Lexer = function(options) {
   this.options = options;
 };
 
@@ -24861,7 +22898,7 @@ Lexer.prototype = {
 
     while (this.index < this.text.length) {
       var ch = this.text.charAt(this.index);
-      if (ch === '"' || ch === '\'') {
+      if (ch === '"' || ch === "'") {
         this.readString(ch);
       } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {
         this.readNumber();
@@ -24900,7 +22937,7 @@ Lexer.prototype = {
   },
 
   isNumber: function(ch) {
-    return ('0' <= ch && ch <= '9') && typeof ch === 'string';
+    return ('0' <= ch && ch <= '9') && typeof ch === "string";
   },
 
   isWhitespace: function(ch) {
@@ -24933,8 +22970,9 @@ Lexer.prototype = {
 
   codePointAt: function(ch) {
     if (ch.length === 1) return ch.charCodeAt(0);
-    // eslint-disable-next-line no-bitwise
+    /*jshint bitwise: false*/
     return (ch.charCodeAt(0) << 10) + ch.charCodeAt(1) - 0x35FDC00;
+    /*jshint bitwise: true*/
   },
 
   peekMultichar: function() {
@@ -24969,19 +23007,19 @@ Lexer.prototype = {
     var start = this.index;
     while (this.index < this.text.length) {
       var ch = lowercase(this.text.charAt(this.index));
-      if (ch === '.' || this.isNumber(ch)) {
+      if (ch == '.' || this.isNumber(ch)) {
         number += ch;
       } else {
         var peekCh = this.peek();
-        if (ch === 'e' && this.isExpOperator(peekCh)) {
+        if (ch == 'e' && this.isExpOperator(peekCh)) {
           number += ch;
         } else if (this.isExpOperator(ch) &&
             peekCh && this.isNumber(peekCh) &&
-            number.charAt(number.length - 1) === 'e') {
+            number.charAt(number.length - 1) == 'e') {
           number += ch;
         } else if (this.isExpOperator(ch) &&
             (!peekCh || !this.isNumber(peekCh)) &&
-            number.charAt(number.length - 1) === 'e') {
+            number.charAt(number.length - 1) == 'e') {
           this.throwError('Invalid exponent');
         } else {
           break;
@@ -25056,7 +23094,7 @@ Lexer.prototype = {
   }
 };
 
-var AST = function AST(lexer, options) {
+var AST = function(lexer, options) {
   this.lexer = lexer;
   this.options = options;
 };
@@ -25112,7 +23150,8 @@ AST.prototype = {
 
   filterChain: function() {
     var left = this.expression();
-    while (this.expect('|')) {
+    var token;
+    while ((token = this.expect('|'))) {
       left = this.filter(left);
     }
     return left;
@@ -25125,10 +23164,6 @@ AST.prototype = {
   assignment: function() {
     var result = this.ternary();
     if (this.expect('=')) {
-      if (!isAssignable(result)) {
-        throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');
-      }
-
       result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='};
     }
     return result;
@@ -25262,7 +23297,7 @@ AST.prototype = {
     var args = [];
     if (this.peekToken().text !== ')') {
       do {
-        args.push(this.filterChain());
+        args.push(this.expression());
       } while (this.expect(','));
     }
     return args;
@@ -25308,28 +23343,13 @@ AST.prototype = {
         property = {type: AST.Property, kind: 'init'};
         if (this.peek().constant) {
           property.key = this.constant();
-          property.computed = false;
-          this.consume(':');
-          property.value = this.expression();
         } else if (this.peek().identifier) {
           property.key = this.identifier();
-          property.computed = false;
-          if (this.peek(':')) {
-            this.consume(':');
-            property.value = this.expression();
-          } else {
-            property.value = property.key;
-          }
-        } else if (this.peek('[')) {
-          this.consume('[');
-          property.key = this.expression();
-          this.consume(']');
-          property.computed = true;
-          this.consume(':');
-          property.value = this.expression();
         } else {
-          this.throwError('invalid key', this.peek());
+          this.throwError("invalid key", this.peek());
         }
+        this.consume(':');
+        property.value = this.expression();
         properties.push(property);
       } while (this.expect(','));
     }
@@ -25412,7 +23432,6 @@ function isStateless($filter, filterName) {
 function findConstantAndWatchExpressions(ast, $filter) {
   var allConstants;
   var argsToWatch;
-  var isStatelessFilter;
   switch (ast.type) {
   case AST.Program:
     allConstants = true;
@@ -25463,8 +23482,7 @@ function findConstantAndWatchExpressions(ast, $filter) {
     ast.toWatch = [ast];
     break;
   case AST.CallExpression:
-    isStatelessFilter = ast.filter ? isStateless($filter, ast.callee.name) : false;
-    allConstants = isStatelessFilter;
+    allConstants = ast.filter ? isStateless($filter, ast.callee.name) : false;
     argsToWatch = [];
     forEach(ast.arguments, function(expr) {
       findConstantAndWatchExpressions(expr, $filter);
@@ -25474,7 +23492,7 @@ function findConstantAndWatchExpressions(ast, $filter) {
       }
     });
     ast.constant = allConstants;
-    ast.toWatch = isStatelessFilter ? argsToWatch : [ast];
+    ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ast];
     break;
   case AST.AssignmentExpression:
     findConstantAndWatchExpressions(ast.left, $filter);
@@ -25500,17 +23518,10 @@ function findConstantAndWatchExpressions(ast, $filter) {
     argsToWatch = [];
     forEach(ast.properties, function(property) {
       findConstantAndWatchExpressions(property.value, $filter);
-      allConstants = allConstants && property.value.constant && !property.computed;
+      allConstants = allConstants && property.value.constant;
       if (!property.value.constant) {
         argsToWatch.push.apply(argsToWatch, property.value.toWatch);
       }
-      if (property.computed) {
-        findConstantAndWatchExpressions(property.key, $filter);
-        if (!property.key.constant) {
-          argsToWatch.push.apply(argsToWatch, property.key.toWatch);
-        }
-      }
-
     });
     ast.constant = allConstants;
     ast.toWatch = argsToWatch;
@@ -25527,7 +23538,7 @@ function findConstantAndWatchExpressions(ast, $filter) {
 }
 
 function getInputs(body) {
-  if (body.length !== 1) return;
+  if (body.length != 1) return;
   var lastExpression = body[0].expression;
   var candidate = lastExpression.toWatch;
   if (candidate.length !== 1) return candidate;
@@ -25556,16 +23567,19 @@ function isConstant(ast) {
   return ast.constant;
 }
 
-function ASTCompiler($filter) {
+function ASTCompiler(astBuilder, $filter) {
+  this.astBuilder = astBuilder;
   this.$filter = $filter;
 }
 
 ASTCompiler.prototype = {
-  compile: function(ast) {
+  compile: function(expression, expensiveChecks) {
     var self = this;
+    var ast = this.astBuilder.ast(expression);
     this.state = {
       nextId: 0,
       filters: {},
+      expensiveChecks: expensiveChecks,
       fn: {vars: [], body: [], own: {}},
       assign: {vars: [], body: [], own: {}},
       inputs: []
@@ -25606,17 +23620,30 @@ ASTCompiler.prototype = {
       this.watchFns() +
       'return fn;';
 
-    // eslint-disable-next-line no-new-func
+    /* jshint -W054 */
     var fn = (new Function('$filter',
+        'ensureSafeMemberName',
+        'ensureSafeObject',
+        'ensureSafeFunction',
         'getStringValue',
+        'ensureSafeAssignContext',
         'ifDefined',
         'plus',
+        'text',
         fnString))(
           this.$filter,
+          ensureSafeMemberName,
+          ensureSafeObject,
+          ensureSafeFunction,
           getStringValue,
+          ensureSafeAssignContext,
           ifDefined,
-          plusFn);
+          plusFn,
+          expression);
+    /* jshint +W054 */
     this.state = this.stage = undefined;
+    fn.literal = isLiteral(ast);
+    fn.constant = isConstant(ast);
     return fn;
   },
 
@@ -25663,7 +23690,7 @@ ASTCompiler.prototype = {
   },
 
   recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
-    var left, right, self = this, args, expression, computed;
+    var left, right, self = this, args, expression;
     recursionFn = recursionFn || noop;
     if (!skipWatchIdCheck && isDefined(ast.watchId)) {
       intoId = intoId || this.nextId();
@@ -25687,7 +23714,7 @@ ASTCompiler.prototype = {
     case AST.Literal:
       expression = this.escape(ast.value);
       this.assign(intoId, expression);
-      recursionFn(intoId || expression);
+      recursionFn(expression);
       break;
     case AST.UnaryExpression:
       this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; });
@@ -25727,18 +23754,22 @@ ASTCompiler.prototype = {
         nameId.computed = false;
         nameId.name = ast.name;
       }
+      ensureSafeMemberName(ast.name);
       self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),
         function() {
           self.if_(self.stage === 'inputs' || 's', function() {
             if (create && create !== 1) {
               self.if_(
-                self.isNull(self.nonComputedMember('s', ast.name)),
+                self.not(self.nonComputedMember('s', ast.name)),
                 self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));
             }
             self.assign(intoId, self.nonComputedMember('s', ast.name));
           });
         }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name))
         );
+      if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.name)) {
+        self.addEnsureSafeObject(intoId);
+      }
       recursionFn(intoId);
       break;
     case AST.MemberExpression:
@@ -25746,24 +23777,32 @@ ASTCompiler.prototype = {
       intoId = intoId || this.nextId();
       self.recurse(ast.object, left, undefined, function() {
         self.if_(self.notNull(left), function() {
+          if (create && create !== 1) {
+            self.addEnsureSafeAssignContext(left);
+          }
           if (ast.computed) {
             right = self.nextId();
             self.recurse(ast.property, right);
             self.getStringValue(right);
+            self.addEnsureSafeMemberName(right);
             if (create && create !== 1) {
               self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));
             }
-            expression = self.computedMember(left, right);
+            expression = self.ensureSafeObject(self.computedMember(left, right));
             self.assign(intoId, expression);
             if (nameId) {
               nameId.computed = true;
               nameId.name = right;
             }
           } else {
+            ensureSafeMemberName(ast.property.name);
             if (create && create !== 1) {
-              self.if_(self.isNull(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));
+              self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));
             }
             expression = self.nonComputedMember(left, ast.property.name);
+            if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) {
+              expression = self.ensureSafeObject(expression);
+            }
             self.assign(intoId, expression);
             if (nameId) {
               nameId.computed = false;
@@ -25795,16 +23834,21 @@ ASTCompiler.prototype = {
         args = [];
         self.recurse(ast.callee, right, left, function() {
           self.if_(self.notNull(right), function() {
+            self.addEnsureSafeFunction(right);
             forEach(ast.arguments, function(expr) {
-              self.recurse(expr, ast.constant ? undefined : self.nextId(), undefined, function(argument) {
-                args.push(argument);
+              self.recurse(expr, self.nextId(), undefined, function(argument) {
+                args.push(self.ensureSafeObject(argument));
               });
             });
             if (left.name) {
+              if (!self.state.expensiveChecks) {
+                self.addEnsureSafeObject(left.context);
+              }
               expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')';
             } else {
               expression = right + '(' + args.join(',') + ')';
             }
+            expression = self.ensureSafeObject(expression);
             self.assign(intoId, expression);
           }, function() {
             self.assign(intoId, 'undefined');
@@ -25816,9 +23860,14 @@ ASTCompiler.prototype = {
     case AST.AssignmentExpression:
       right = this.nextId();
       left = {};
+      if (!isAssignable(ast.left)) {
+        throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');
+      }
       this.recurse(ast.left, undefined, left, function() {
         self.if_(self.notNull(left.context), function() {
           self.recurse(ast.right, right);
+          self.addEnsureSafeObject(self.member(left.context, left.name, left.computed));
+          self.addEnsureSafeAssignContext(left.context);
           expression = self.member(left.context, left.name, left.computed) + ast.operator + right;
           self.assign(intoId, expression);
           recursionFn(intoId || expression);
@@ -25828,63 +23877,39 @@ ASTCompiler.prototype = {
     case AST.ArrayExpression:
       args = [];
       forEach(ast.elements, function(expr) {
-        self.recurse(expr, ast.constant ? undefined : self.nextId(), undefined, function(argument) {
+        self.recurse(expr, self.nextId(), undefined, function(argument) {
           args.push(argument);
         });
       });
       expression = '[' + args.join(',') + ']';
       this.assign(intoId, expression);
-      recursionFn(intoId || expression);
+      recursionFn(expression);
       break;
     case AST.ObjectExpression:
       args = [];
-      computed = false;
       forEach(ast.properties, function(property) {
-        if (property.computed) {
-          computed = true;
-        }
-      });
-      if (computed) {
-        intoId = intoId || this.nextId();
-        this.assign(intoId, '{}');
-        forEach(ast.properties, function(property) {
-          if (property.computed) {
-            left = self.nextId();
-            self.recurse(property.key, left);
-          } else {
-            left = property.key.type === AST.Identifier ?
-                       property.key.name :
-                       ('' + property.key.value);
-          }
-          right = self.nextId();
-          self.recurse(property.value, right);
-          self.assign(self.member(intoId, left, property.computed), right);
-        });
-      } else {
-        forEach(ast.properties, function(property) {
-          self.recurse(property.value, ast.constant ? undefined : self.nextId(), undefined, function(expr) {
-            args.push(self.escape(
-                property.key.type === AST.Identifier ? property.key.name :
-                  ('' + property.key.value)) +
-                ':' + expr);
-          });
+        self.recurse(property.value, self.nextId(), undefined, function(expr) {
+          args.push(self.escape(
+              property.key.type === AST.Identifier ? property.key.name :
+                ('' + property.key.value)) +
+              ':' + expr);
         });
-        expression = '{' + args.join(',') + '}';
-        this.assign(intoId, expression);
-      }
-      recursionFn(intoId || expression);
+      });
+      expression = '{' + args.join(',') + '}';
+      this.assign(intoId, expression);
+      recursionFn(expression);
       break;
     case AST.ThisExpression:
       this.assign(intoId, 's');
-      recursionFn(intoId || 's');
+      recursionFn('s');
       break;
     case AST.LocalsExpression:
       this.assign(intoId, 'l');
-      recursionFn(intoId || 'l');
+      recursionFn('l');
       break;
     case AST.NGValueParameter:
       this.assign(intoId, 'v');
-      recursionFn(intoId || 'v');
+      recursionFn('v');
       break;
     }
   },
@@ -25943,16 +23968,12 @@ ASTCompiler.prototype = {
     return '!(' + expression + ')';
   },
 
-  isNull: function(expression) {
-    return expression + '==null';
-  },
-
   notNull: function(expression) {
     return expression + '!=null';
   },
 
   nonComputedMember: function(left, right) {
-    var SAFE_IDENTIFIER = /^[$_a-zA-Z][$_a-zA-Z0-9]*$/;
+    var SAFE_IDENTIFIER = /[$_a-zA-Z][$_a-zA-Z0-9]*/;
     var UNSAFE_CHARACTERS = /[^$_a-zA-Z0-9]/g;
     if (SAFE_IDENTIFIER.test(right)) {
       return left + '.' + right;
@@ -25970,10 +23991,42 @@ ASTCompiler.prototype = {
     return this.nonComputedMember(left, right);
   },
 
+  addEnsureSafeObject: function(item) {
+    this.current().body.push(this.ensureSafeObject(item), ';');
+  },
+
+  addEnsureSafeMemberName: function(item) {
+    this.current().body.push(this.ensureSafeMemberName(item), ';');
+  },
+
+  addEnsureSafeFunction: function(item) {
+    this.current().body.push(this.ensureSafeFunction(item), ';');
+  },
+
+  addEnsureSafeAssignContext: function(item) {
+    this.current().body.push(this.ensureSafeAssignContext(item), ';');
+  },
+
+  ensureSafeObject: function(item) {
+    return 'ensureSafeObject(' + item + ',text)';
+  },
+
+  ensureSafeMemberName: function(item) {
+    return 'ensureSafeMemberName(' + item + ',text)';
+  },
+
+  ensureSafeFunction: function(item) {
+    return 'ensureSafeFunction(' + item + ',text)';
+  },
+
   getStringValue: function(item) {
     this.assign(item, 'getStringValue(' + item + ')');
   },
 
+  ensureSafeAssignContext: function(item) {
+    return 'ensureSafeAssignContext(' + item + ',text)';
+  },
+
   lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
     var self = this;
     return function() {
@@ -25995,7 +24048,7 @@ ASTCompiler.prototype = {
   },
 
   escape: function(value) {
-    if (isString(value)) return '\'' + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + '\'';
+    if (isString(value)) return "'" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + "'";
     if (isNumber(value)) return value.toString();
     if (value === true) return 'true';
     if (value === false) return 'false';
@@ -26019,13 +24072,17 @@ ASTCompiler.prototype = {
 };
 
 
-function ASTInterpreter($filter) {
+function ASTInterpreter(astBuilder, $filter) {
+  this.astBuilder = astBuilder;
   this.$filter = $filter;
 }
 
 ASTInterpreter.prototype = {
-  compile: function(ast) {
+  compile: function(expression, expensiveChecks) {
     var self = this;
+    var ast = this.astBuilder.ast(expression);
+    this.expression = expression;
+    this.expensiveChecks = expensiveChecks;
     findConstantAndWatchExpressions(ast, self.$filter);
     var assignable;
     var assign;
@@ -26064,11 +24121,13 @@ ASTInterpreter.prototype = {
     if (inputs) {
       fn.inputs = inputs;
     }
+    fn.literal = isLiteral(ast);
+    fn.constant = isConstant(ast);
     return fn;
   },
 
   recurse: function(ast, context, create) {
-    var left, right, self = this, args;
+    var left, right, self = this, args, expression;
     if (ast.input) {
       return this.inputs(ast.input, ast.watchId);
     }
@@ -26094,16 +24153,20 @@ ASTInterpreter.prototype = {
         context
       );
     case AST.Identifier:
-      return self.identifier(ast.name, context, create);
+      ensureSafeMemberName(ast.name, self.expression);
+      return self.identifier(ast.name,
+                             self.expensiveChecks || isPossiblyDangerousMemberName(ast.name),
+                             context, create, self.expression);
     case AST.MemberExpression:
       left = this.recurse(ast.object, false, !!create);
       if (!ast.computed) {
+        ensureSafeMemberName(ast.property.name, self.expression);
         right = ast.property.name;
       }
       if (ast.computed) right = this.recurse(ast.property);
       return ast.computed ?
-        this.computedMember(left, right, context, create) :
-        this.nonComputedMember(left, right, context, create);
+        this.computedMember(left, right, context, create, self.expression) :
+        this.nonComputedMember(left, right, self.expensiveChecks, context, create, self.expression);
     case AST.CallExpression:
       args = [];
       forEach(ast.arguments, function(expr) {
@@ -26124,11 +24187,13 @@ ASTInterpreter.prototype = {
           var rhs = right(scope, locals, assign, inputs);
           var value;
           if (rhs.value != null) {
+            ensureSafeObject(rhs.context, self.expression);
+            ensureSafeFunction(rhs.value, self.expression);
             var values = [];
             for (var i = 0; i < args.length; ++i) {
-              values.push(args[i](scope, locals, assign, inputs));
+              values.push(ensureSafeObject(args[i](scope, locals, assign, inputs), self.expression));
             }
-            value = rhs.value.apply(rhs.context, values);
+            value = ensureSafeObject(rhs.value.apply(rhs.context, values), self.expression);
           }
           return context ? {value: value} : value;
         };
@@ -26138,6 +24203,8 @@ ASTInterpreter.prototype = {
       return function(scope, locals, assign, inputs) {
         var lhs = left(scope, locals, assign, inputs);
         var rhs = right(scope, locals, assign, inputs);
+        ensureSafeObject(lhs.value, self.expression);
+        ensureSafeAssignContext(lhs.context);
         lhs.context[lhs.name] = rhs;
         return context ? {value: rhs} : rhs;
       };
@@ -26156,28 +24223,16 @@ ASTInterpreter.prototype = {
     case AST.ObjectExpression:
       args = [];
       forEach(ast.properties, function(property) {
-        if (property.computed) {
-          args.push({key: self.recurse(property.key),
-                     computed: true,
-                     value: self.recurse(property.value)
-          });
-        } else {
-          args.push({key: property.key.type === AST.Identifier ?
-                          property.key.name :
-                          ('' + property.key.value),
-                     computed: false,
-                     value: self.recurse(property.value)
-          });
-        }
+        args.push({key: property.key.type === AST.Identifier ?
+                        property.key.name :
+                        ('' + property.key.value),
+                   value: self.recurse(property.value)
+        });
       });
       return function(scope, locals, assign, inputs) {
         var value = {};
         for (var i = 0; i < args.length; ++i) {
-          if (args[i].computed) {
-            value[args[i].key(scope, locals, assign, inputs)] = args[i].value(scope, locals, assign, inputs);
-          } else {
-            value[args[i].key] = args[i].value(scope, locals, assign, inputs);
-          }
+          value[args[i].key] = args[i].value(scope, locals, assign, inputs);
         }
         return context ? {value: value} : value;
       };
@@ -26213,7 +24268,7 @@ ASTInterpreter.prototype = {
       if (isDefined(arg)) {
         arg = -arg;
       } else {
-        arg = -0;
+        arg = 0;
       }
       return context ? {value: arg} : arg;
     };
@@ -26272,14 +24327,12 @@ ASTInterpreter.prototype = {
   },
   'binary==': function(left, right, context) {
     return function(scope, locals, assign, inputs) {
-      // eslint-disable-next-line eqeqeq
       var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);
       return context ? {value: arg} : arg;
     };
   },
   'binary!=': function(left, right, context) {
     return function(scope, locals, assign, inputs) {
-      // eslint-disable-next-line eqeqeq
       var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);
       return context ? {value: arg} : arg;
     };
@@ -26329,13 +24382,16 @@ ASTInterpreter.prototype = {
   value: function(value, context) {
     return function() { return context ? {context: undefined, name: undefined, value: value} : value; };
   },
-  identifier: function(name, context, create) {
+  identifier: function(name, expensiveChecks, context, create, expression) {
     return function(scope, locals, assign, inputs) {
       var base = locals && (name in locals) ? locals : scope;
-      if (create && create !== 1 && base && base[name] == null) {
+      if (create && create !== 1 && base && !(base[name])) {
         base[name] = {};
       }
       var value = base ? base[name] : undefined;
+      if (expensiveChecks) {
+        ensureSafeObject(value, expression);
+      }
       if (context) {
         return {context: base, name: name, value: value};
       } else {
@@ -26343,7 +24399,7 @@ ASTInterpreter.prototype = {
       }
     };
   },
-  computedMember: function(left, right, context, create) {
+  computedMember: function(left, right, context, create, expression) {
     return function(scope, locals, assign, inputs) {
       var lhs = left(scope, locals, assign, inputs);
       var rhs;
@@ -26351,12 +24407,15 @@ ASTInterpreter.prototype = {
       if (lhs != null) {
         rhs = right(scope, locals, assign, inputs);
         rhs = getStringValue(rhs);
+        ensureSafeMemberName(rhs, expression);
         if (create && create !== 1) {
+          ensureSafeAssignContext(lhs);
           if (lhs && !(lhs[rhs])) {
             lhs[rhs] = {};
           }
         }
         value = lhs[rhs];
+        ensureSafeObject(value, expression);
       }
       if (context) {
         return {context: lhs, name: rhs, value: value};
@@ -26365,15 +24424,19 @@ ASTInterpreter.prototype = {
       }
     };
   },
-  nonComputedMember: function(left, right, context, create) {
+  nonComputedMember: function(left, right, expensiveChecks, context, create, expression) {
     return function(scope, locals, assign, inputs) {
       var lhs = left(scope, locals, assign, inputs);
       if (create && create !== 1) {
-        if (lhs && lhs[right] == null) {
+        ensureSafeAssignContext(lhs);
+        if (lhs && !(lhs[right])) {
           lhs[right] = {};
         }
       }
       var value = lhs != null ? lhs[right] : undefined;
+      if (expensiveChecks || isPossiblyDangerousMemberName(right)) {
+        ensureSafeObject(value, expression);
+      }
       if (context) {
         return {context: lhs, name: right, value: value};
       } else {
@@ -26392,24 +24455,29 @@ ASTInterpreter.prototype = {
 /**
  * @constructor
  */
-function Parser(lexer, $filter, options) {
+var Parser = function(lexer, $filter, options) {
+  this.lexer = lexer;
+  this.$filter = $filter;
+  this.options = options;
   this.ast = new AST(lexer, options);
-  this.astCompiler = options.csp ? new ASTInterpreter($filter) :
-                                   new ASTCompiler($filter);
-}
+  this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) :
+                                   new ASTCompiler(this.ast, $filter);
+};
 
 Parser.prototype = {
   constructor: Parser,
 
   parse: function(text) {
-    var ast = this.ast.ast(text);
-    var fn = this.astCompiler.compile(ast);
-    fn.literal = isLiteral(ast);
-    fn.constant = isConstant(ast);
-    return fn;
+    return this.astCompiler.compile(text, this.options.expensiveChecks);
   }
 };
 
+function isPossiblyDangerousMemberName(name) {
+  return name == 'constructor';
+}
+
+var objectValueOf = Object.prototype.valueOf;
+
 function getValueOf(value) {
   return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);
 }
@@ -26460,14 +24528,14 @@ function getValueOf(value) {
 /**
  * @ngdoc provider
  * @name $parseProvider
- * @this
  *
  * @description
  * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}
  *  service.
  */
 function $ParseProvider() {
-  var cache = createMap();
+  var cacheDefault = createMap();
+  var cacheExpensive = createMap();
   var literals = {
     'true': true,
     'false': false,
@@ -26494,7 +24562,6 @@ function $ParseProvider() {
  /**
   * @ngdoc method
   * @name $parseProvider#setIdentifierFns
-  *
   * @description
   *
   * Allows defining the set of characters that are allowed in Angular expressions. The function
@@ -26507,7 +24574,7 @@ function $ParseProvider() {
   * representation. It is expected for the function to return `true` or `false`, whether that
   * character is allowed or not.
   *
-  * Since this function will be called extensively, keep the implementation of these functions fast,
+  * Since this function will be called extensivelly, keep the implementation of these functions fast,
   * as the performance of these functions have a direct impact on the expressions parsing speed.
   *
   * @param {function=} identifierStart The function that will decide whether the given character is
@@ -26525,20 +24592,37 @@ function $ParseProvider() {
     var noUnsafeEval = csp().noUnsafeEval;
     var $parseOptions = {
           csp: noUnsafeEval,
+          expensiveChecks: false,
+          literals: copy(literals),
+          isIdentifierStart: isFunction(identStart) && identStart,
+          isIdentifierContinue: isFunction(identContinue) && identContinue
+        },
+        $parseOptionsExpensive = {
+          csp: noUnsafeEval,
+          expensiveChecks: true,
           literals: copy(literals),
           isIdentifierStart: isFunction(identStart) && identStart,
           isIdentifierContinue: isFunction(identContinue) && identContinue
         };
+    var runningChecksEnabled = false;
+
+    $parse.$$runningExpensiveChecks = function() {
+      return runningChecksEnabled;
+    };
+
     return $parse;
 
-    function $parse(exp, interceptorFn) {
+    function $parse(exp, interceptorFn, expensiveChecks) {
       var parsedExpression, oneTime, cacheKey;
 
+      expensiveChecks = expensiveChecks || runningChecksEnabled;
+
       switch (typeof exp) {
         case 'string':
           exp = exp.trim();
           cacheKey = exp;
 
+          var cache = (expensiveChecks ? cacheExpensive : cacheDefault);
           parsedExpression = cache[cacheKey];
 
           if (!parsedExpression) {
@@ -26546,17 +24630,21 @@ function $ParseProvider() {
               oneTime = true;
               exp = exp.substring(2);
             }
-            var lexer = new Lexer($parseOptions);
-            var parser = new Parser(lexer, $filter, $parseOptions);
+            var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions;
+            var lexer = new Lexer(parseOptions);
+            var parser = new Parser(lexer, $filter, parseOptions);
             parsedExpression = parser.parse(exp);
             if (parsedExpression.constant) {
               parsedExpression.$$watchDelegate = constantWatchDelegate;
             } else if (oneTime) {
-              parsedExpression.oneTime = true;
-              parsedExpression.$$watchDelegate = oneTimeWatchDelegate;
+              parsedExpression.$$watchDelegate = parsedExpression.literal ?
+                  oneTimeLiteralWatchDelegate : oneTimeWatchDelegate;
             } else if (parsedExpression.inputs) {
               parsedExpression.$$watchDelegate = inputsWatchDelegate;
             }
+            if (expensiveChecks) {
+              parsedExpression = expensiveChecksInterceptor(parsedExpression);
+            }
             cache[cacheKey] = parsedExpression;
           }
           return addInterceptor(parsedExpression, interceptorFn);
@@ -26569,7 +24657,31 @@ function $ParseProvider() {
       }
     }
 
-    function expressionInputDirtyCheck(newValue, oldValueOfValue, compareObjectIdentity) {
+    function expensiveChecksInterceptor(fn) {
+      if (!fn) return fn;
+      expensiveCheckFn.$$watchDelegate = fn.$$watchDelegate;
+      expensiveCheckFn.assign = expensiveChecksInterceptor(fn.assign);
+      expensiveCheckFn.constant = fn.constant;
+      expensiveCheckFn.literal = fn.literal;
+      for (var i = 0; fn.inputs && i < fn.inputs.length; ++i) {
+        fn.inputs[i] = expensiveChecksInterceptor(fn.inputs[i]);
+      }
+      expensiveCheckFn.inputs = fn.inputs;
+
+      return expensiveCheckFn;
+
+      function expensiveCheckFn(scope, locals, assign, inputs) {
+        var expensiveCheckOldValue = runningChecksEnabled;
+        runningChecksEnabled = true;
+        try {
+          return fn(scope, locals, assign, inputs);
+        } finally {
+          runningChecksEnabled = expensiveCheckOldValue;
+        }
+      }
+    }
+
+    function expressionInputDirtyCheck(newValue, oldValueOfValue) {
 
       if (newValue == null || oldValueOfValue == null) { // null/undefined
         return newValue === oldValueOfValue;
@@ -26582,7 +24694,7 @@ function $ParseProvider() {
         //             be cheaply dirty-checked
         newValue = getValueOf(newValue);
 
-        if (typeof newValue === 'object' && !compareObjectIdentity) {
+        if (typeof newValue === 'object') {
           // objects/arrays are not supported - deep-watching them would be too expensive
           return false;
         }
@@ -26591,7 +24703,6 @@ function $ParseProvider() {
       }
 
       //Primitive or NaN
-      // eslint-disable-next-line no-self-compare
       return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue);
     }
 
@@ -26604,7 +24715,7 @@ function $ParseProvider() {
         inputExpressions = inputExpressions[0];
         return scope.$watch(function expressionInputWatch(scope) {
           var newInputValue = inputExpressions(scope);
-          if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf, parsedExpression.literal)) {
+          if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {
             lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);
             oldInputValueOf = newInputValue && getValueOf(newInputValue);
           }
@@ -26624,7 +24735,7 @@ function $ParseProvider() {
 
         for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
           var newInputValue = inputExpressions[i](scope);
-          if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i], parsedExpression.literal))) {
+          if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {
             oldInputValues[i] = newInputValue;
             oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);
           }
@@ -26638,48 +24749,56 @@ function $ParseProvider() {
       }, listener, objectEquality, prettyPrintExpression);
     }
 
-    function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {
-      var isDone = parsedExpression.literal ? isAllDefined : isDefined;
+    function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) {
       var unwatch, lastValue;
-      if (parsedExpression.inputs) {
-        unwatch = inputsWatchDelegate(scope, oneTimeListener, objectEquality, parsedExpression, prettyPrintExpression);
-      } else {
-        unwatch = scope.$watch(oneTimeWatch, oneTimeListener, objectEquality);
-      }
-      return unwatch;
-
-      function oneTimeWatch(scope) {
+      return unwatch = scope.$watch(function oneTimeWatch(scope) {
         return parsedExpression(scope);
-      }
-      function oneTimeListener(value, old, scope) {
+      }, function oneTimeListener(value, old, scope) {
         lastValue = value;
         if (isFunction(listener)) {
-          listener(value, old, scope);
+          listener.apply(this, arguments);
         }
-        if (isDone(value)) {
+        if (isDefined(value)) {
           scope.$$postDigest(function() {
-            if (isDone(lastValue)) {
+            if (isDefined(lastValue)) {
               unwatch();
             }
           });
         }
-      }
+      }, objectEquality);
     }
 
-    function isAllDefined(value) {
-      var allDefined = true;
-      forEach(value, function(val) {
-        if (!isDefined(val)) allDefined = false;
-      });
-      return allDefined;
+    function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+      var unwatch, lastValue;
+      return unwatch = scope.$watch(function oneTimeWatch(scope) {
+        return parsedExpression(scope);
+      }, function oneTimeListener(value, old, scope) {
+        lastValue = value;
+        if (isFunction(listener)) {
+          listener.call(this, value, old, scope);
+        }
+        if (isAllDefined(value)) {
+          scope.$$postDigest(function() {
+            if (isAllDefined(lastValue)) unwatch();
+          });
+        }
+      }, objectEquality);
+
+      function isAllDefined(value) {
+        var allDefined = true;
+        forEach(value, function(val) {
+          if (!isDefined(val)) allDefined = false;
+        });
+        return allDefined;
+      }
     }
 
     function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {
-      var unwatch = scope.$watch(function constantWatch(scope) {
+      var unwatch;
+      return unwatch = scope.$watch(function constantWatch(scope) {
         unwatch();
         return parsedExpression(scope);
       }, listener, objectEquality);
-      return unwatch;
     }
 
     function addInterceptor(parsedExpression, interceptorFn) {
@@ -26687,36 +24806,30 @@ function $ParseProvider() {
       var watchDelegate = parsedExpression.$$watchDelegate;
       var useInputs = false;
 
-      var isDone = parsedExpression.literal ? isAllDefined : isDefined;
+      var regularWatch =
+          watchDelegate !== oneTimeLiteralWatchDelegate &&
+          watchDelegate !== oneTimeWatchDelegate;
 
-      function regularInterceptedExpression(scope, locals, assign, inputs) {
+      var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {
         var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);
         return interceptorFn(value, scope, locals);
-      }
-
-      function oneTimeInterceptedExpression(scope, locals, assign, inputs) {
-        var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);
+      } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {
+        var value = parsedExpression(scope, locals, assign, inputs);
         var result = interceptorFn(value, scope, locals);
         // we only return the interceptor's result if the
         // initial value is defined (for bind-once)
-        return isDone(value) ? result : value;
-      }
-
-      var fn = parsedExpression.oneTime ? oneTimeInterceptedExpression : regularInterceptedExpression;
-
-      // Propogate the literal/oneTime attributes
-      fn.literal = parsedExpression.literal;
-      fn.oneTime = parsedExpression.oneTime;
+        return isDefined(value) ? result : value;
+      };
 
-      // Propagate or create inputs / $$watchDelegates
-      useInputs = !parsedExpression.inputs;
-      if (watchDelegate && watchDelegate !== inputsWatchDelegate) {
-        fn.$$watchDelegate = watchDelegate;
-        fn.inputs = parsedExpression.inputs;
+      // Propagate $$watchDelegates other then inputsWatchDelegate
+      if (parsedExpression.$$watchDelegate &&
+          parsedExpression.$$watchDelegate !== inputsWatchDelegate) {
+        fn.$$watchDelegate = parsedExpression.$$watchDelegate;
       } else if (!interceptorFn.$stateful) {
         // If there is an interceptor, but no watchDelegate then treat the interceptor like
         // we treat filters - it is assumed to be a pure function unless flagged with $stateful
         fn.$$watchDelegate = inputsWatchDelegate;
+        useInputs = !parsedExpression.inputs;
         fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];
       }
 
@@ -26734,8 +24847,8 @@ function $ParseProvider() {
  * A service that helps you run functions asynchronously, and use their return values (or exceptions)
  * when they are done processing.
  *
- * This is a [Promises/A+](https://promisesaplus.com/)-compliant implementation of promises/deferred
- * objects inspired by [Kris Kowal's Q](https://github.com/kriskowal/q).
+ * This is an implementation of promises/deferred objects inspired by
+ * [Kris Kowal's Q](https://github.com/kriskowal/q).
  *
  * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred
  * implementations, and the other which resembles ES6 (ES2015) promises to some degree.
@@ -26860,7 +24973,7 @@ function $ParseProvider() {
  *
  * **Methods**
  *
- * - `then(successCallback, [errorCallback], [notifyCallback])` â€“ regardless of when the promise was or
+ * - `then(successCallback, errorCallback, notifyCallback)` â€“ regardless of when the promise was or
  *   will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously
  *   as soon as the result is available. The callbacks are called with a single argument: the result
  *   or rejection reason. Additionally, the notify callback may be called zero or more times to
@@ -26871,8 +24984,7 @@ function $ParseProvider() {
  *   with the value which is resolved in that promise using
  *   [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).
  *   It also notifies via the return value of the `notifyCallback` method. The promise cannot be
- *   resolved or rejected from the notifyCallback method. The errorCallback and notifyCallback
- *   arguments are optional.
+ *   resolved or rejected from the notifyCallback method.
  *
  * - `catch(errorCallback)` â€“ shorthand for `promise.then(null, errorCallback)`
  *
@@ -26942,61 +25054,21 @@ function $ParseProvider() {
  *
  * @returns {Promise} The newly created promise.
  */
-/**
- * @ngdoc provider
- * @name $qProvider
- * @this
- *
- * @description
- */
 function $QProvider() {
-  var errorOnUnhandledRejections = true;
+
   this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {
     return qFactory(function(callback) {
       $rootScope.$evalAsync(callback);
-    }, $exceptionHandler, errorOnUnhandledRejections);
+    }, $exceptionHandler);
   }];
-
-  /**
-   * @ngdoc method
-   * @name $qProvider#errorOnUnhandledRejections
-   * @kind function
-   *
-   * @description
-   * Retrieves or overrides whether to generate an error when a rejected promise is not handled.
-   * This feature is enabled by default.
-   *
-   * @param {boolean=} value Whether to generate an error when a rejected promise is not handled.
-   * @returns {boolean|ng.$qProvider} Current value when called without a new value or self for
-   *    chaining otherwise.
-   */
-  this.errorOnUnhandledRejections = function(value) {
-    if (isDefined(value)) {
-      errorOnUnhandledRejections = value;
-      return this;
-    } else {
-      return errorOnUnhandledRejections;
-    }
-  };
 }
 
-/** @this */
 function $$QProvider() {
-  var errorOnUnhandledRejections = true;
   this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) {
     return qFactory(function(callback) {
       $browser.defer(callback);
-    }, $exceptionHandler, errorOnUnhandledRejections);
+    }, $exceptionHandler);
   }];
-
-  this.errorOnUnhandledRejections = function(value) {
-    if (isDefined(value)) {
-      errorOnUnhandledRejections = value;
-      return this;
-    } else {
-      return errorOnUnhandledRejections;
-    }
-  };
 }
 
 /**
@@ -27005,14 +25077,10 @@ function $$QProvider() {
  * @param {function(function)} nextTick Function for executing functions in the next turn.
  * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for
  *     debugging purposes.
- @ param {=boolean} errorOnUnhandledRejections Whether an error should be generated on unhandled
- *     promises rejections.
  * @returns {object} Promise manager.
  */
-function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
+function qFactory(nextTick, exceptionHandler) {
   var $qMinErr = minErr('$q', TypeError);
-  var queueSize = 0;
-  var checkQueue = [];
 
   /**
    * @ngdoc method
@@ -27024,18 +25092,14 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
    *
    * @returns {Deferred} Returns a new instance of deferred.
    */
-  function defer() {
-    return new Deferred();
-  }
-
-  function Deferred() {
-    var promise = this.promise = new Promise();
-    //Non prototype methods necessary to support unbound execution :/
-    this.resolve = function(val) { resolvePromise(promise, val); };
-    this.reject = function(reason) { rejectPromise(promise, reason); };
-    this.notify = function(progress) { notifyPromise(promise, progress); };
-  }
-
+  var defer = function() {
+    var d = new Deferred();
+    //Necessary to support unbound execution :/
+    d.resolve = simpleBind(d, d.resolve);
+    d.reject = simpleBind(d, d.reject);
+    d.notify = simpleBind(d, d.notify);
+    return d;
+  };
 
   function Promise() {
     this.$$state = { status: 0 };
@@ -27046,162 +25110,144 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
       if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {
         return this;
       }
-      var result = new Promise();
+      var result = new Deferred();
 
       this.$$state.pending = this.$$state.pending || [];
       this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);
       if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
 
-      return result;
+      return result.promise;
     },
 
-    'catch': function(callback) {
+    "catch": function(callback) {
       return this.then(null, callback);
     },
 
-    'finally': function(callback, progressBack) {
+    "finally": function(callback, progressBack) {
       return this.then(function(value) {
-        return handleCallback(value, resolve, callback);
+        return handleCallback(value, true, callback);
       }, function(error) {
-        return handleCallback(error, reject, callback);
+        return handleCallback(error, false, callback);
       }, progressBack);
     }
   });
 
+  //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native
+  function simpleBind(context, fn) {
+    return function(value) {
+      fn.call(context, value);
+    };
+  }
+
   function processQueue(state) {
-    var fn, promise, pending;
+    var fn, deferred, pending;
 
     pending = state.pending;
     state.processScheduled = false;
     state.pending = undefined;
-    try {
-      for (var i = 0, ii = pending.length; i < ii; ++i) {
-        state.pur = true;
-        promise = pending[i][0];
-        fn = pending[i][state.status];
-        try {
-          if (isFunction(fn)) {
-            resolvePromise(promise, fn(state.value));
-          } else if (state.status === 1) {
-            resolvePromise(promise, state.value);
-          } else {
-            rejectPromise(promise, state.value);
-          }
-        } catch (e) {
-          rejectPromise(promise, e);
-        }
-      }
-    } finally {
-      --queueSize;
-      if (errorOnUnhandledRejections && queueSize === 0) {
-        nextTick(processChecks);
-      }
-    }
-  }
-
-  function processChecks() {
-    // eslint-disable-next-line no-unmodified-loop-condition
-    while (!queueSize && checkQueue.length) {
-      var toCheck = checkQueue.shift();
-      if (!toCheck.pur) {
-        toCheck.pur = true;
-        var errorMessage = 'Possibly unhandled rejection: ' + toDebugString(toCheck.value);
-        if (toCheck.value instanceof Error) {
-          exceptionHandler(toCheck.value, errorMessage);
+    for (var i = 0, ii = pending.length; i < ii; ++i) {
+      deferred = pending[i][0];
+      fn = pending[i][state.status];
+      try {
+        if (isFunction(fn)) {
+          deferred.resolve(fn(state.value));
+        } else if (state.status === 1) {
+          deferred.resolve(state.value);
         } else {
-          exceptionHandler(errorMessage);
+          deferred.reject(state.value);
         }
+      } catch (e) {
+        deferred.reject(e);
+        exceptionHandler(e);
       }
     }
   }
 
   function scheduleProcessQueue(state) {
-    if (errorOnUnhandledRejections && !state.pending && state.status === 2 && !state.pur) {
-      if (queueSize === 0 && checkQueue.length === 0) {
-        nextTick(processChecks);
-      }
-      checkQueue.push(state);
-    }
     if (state.processScheduled || !state.pending) return;
     state.processScheduled = true;
-    ++queueSize;
     nextTick(function() { processQueue(state); });
   }
 
-  function resolvePromise(promise, val) {
-    if (promise.$$state.status) return;
-    if (val === promise) {
-      $$reject(promise, $qMinErr(
-        'qcycle',
-        'Expected promise to be resolved with value other than itself \'{0}\'',
-        val));
-    } else {
-      $$resolve(promise, val);
-    }
-
+  function Deferred() {
+    this.promise = new Promise();
   }
 
-  function $$resolve(promise, val) {
-    var then;
-    var done = false;
-    try {
-      if (isObject(val) || isFunction(val)) then = val.then;
-      if (isFunction(then)) {
-        promise.$$state.status = -1;
-        then.call(val, doResolve, doReject, doNotify);
+  extend(Deferred.prototype, {
+    resolve: function(val) {
+      if (this.promise.$$state.status) return;
+      if (val === this.promise) {
+        this.$$reject($qMinErr(
+          'qcycle',
+          "Expected promise to be resolved with value other than itself '{0}'",
+          val));
       } else {
-        promise.$$state.value = val;
-        promise.$$state.status = 1;
-        scheduleProcessQueue(promise.$$state);
+        this.$$resolve(val);
       }
-    } catch (e) {
-      doReject(e);
-    }
 
-    function doResolve(val) {
-      if (done) return;
-      done = true;
-      $$resolve(promise, val);
-    }
-    function doReject(val) {
-      if (done) return;
-      done = true;
-      $$reject(promise, val);
-    }
-    function doNotify(progress) {
-      notifyPromise(promise, progress);
-    }
-  }
+    },
 
-  function rejectPromise(promise, reason) {
-    if (promise.$$state.status) return;
-    $$reject(promise, reason);
-  }
+    $$resolve: function(val) {
+      var then;
+      var that = this;
+      var done = false;
+      try {
+        if ((isObject(val) || isFunction(val))) then = val && val.then;
+        if (isFunction(then)) {
+          this.promise.$$state.status = -1;
+          then.call(val, resolvePromise, rejectPromise, simpleBind(this, this.notify));
+        } else {
+          this.promise.$$state.value = val;
+          this.promise.$$state.status = 1;
+          scheduleProcessQueue(this.promise.$$state);
+        }
+      } catch (e) {
+        rejectPromise(e);
+        exceptionHandler(e);
+      }
 
-  function $$reject(promise, reason) {
-    promise.$$state.value = reason;
-    promise.$$state.status = 2;
-    scheduleProcessQueue(promise.$$state);
-  }
+      function resolvePromise(val) {
+        if (done) return;
+        done = true;
+        that.$$resolve(val);
+      }
+      function rejectPromise(val) {
+        if (done) return;
+        done = true;
+        that.$$reject(val);
+      }
+    },
 
-  function notifyPromise(promise, progress) {
-    var callbacks = promise.$$state.pending;
+    reject: function(reason) {
+      if (this.promise.$$state.status) return;
+      this.$$reject(reason);
+    },
 
-    if ((promise.$$state.status <= 0) && callbacks && callbacks.length) {
-      nextTick(function() {
-        var callback, result;
-        for (var i = 0, ii = callbacks.length; i < ii; i++) {
-          result = callbacks[i][0];
-          callback = callbacks[i][3];
-          try {
-            notifyPromise(result, isFunction(callback) ? callback(progress) : progress);
-          } catch (e) {
-            exceptionHandler(e);
+    $$reject: function(reason) {
+      this.promise.$$state.value = reason;
+      this.promise.$$state.status = 2;
+      scheduleProcessQueue(this.promise.$$state);
+    },
+
+    notify: function(progress) {
+      var callbacks = this.promise.$$state.pending;
+
+      if ((this.promise.$$state.status <= 0) && callbacks && callbacks.length) {
+        nextTick(function() {
+          var callback, result;
+          for (var i = 0, ii = callbacks.length; i < ii; i++) {
+            result = callbacks[i][0];
+            callback = callbacks[i][3];
+            try {
+              result.notify(isFunction(callback) ? callback(progress) : progress);
+            } catch (e) {
+              exceptionHandler(e);
+            }
           }
-        }
-      });
+        });
+      }
     }
-  }
+  });
 
   /**
    * @ngdoc method
@@ -27239,27 +25285,39 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
    * @param {*} reason Constant, message, exception or an object representing the rejection reason.
    * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
    */
-  function reject(reason) {
-    var result = new Promise();
-    rejectPromise(result, reason);
-    return result;
-  }
+  var reject = function(reason) {
+    var result = new Deferred();
+    result.reject(reason);
+    return result.promise;
+  };
 
-  function handleCallback(value, resolver, callback) {
+  var makePromise = function makePromise(value, resolved) {
+    var result = new Deferred();
+    if (resolved) {
+      result.resolve(value);
+    } else {
+      result.reject(value);
+    }
+    return result.promise;
+  };
+
+  var handleCallback = function handleCallback(value, isResolved, callback) {
     var callbackOutput = null;
     try {
       if (isFunction(callback)) callbackOutput = callback();
     } catch (e) {
-      return reject(e);
+      return makePromise(e, false);
     }
     if (isPromiseLike(callbackOutput)) {
       return callbackOutput.then(function() {
-        return resolver(value);
-      }, reject);
+        return makePromise(value, isResolved);
+      }, function(error) {
+        return makePromise(error, false);
+      });
     } else {
-      return resolver(value);
+      return makePromise(value, isResolved);
     }
-  }
+  };
 
   /**
    * @ngdoc method
@@ -27279,11 +25337,11 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
    */
 
 
-  function when(value, callback, errback, progressBack) {
-    var result = new Promise();
-    resolvePromise(result, value);
-    return result.then(callback, errback, progressBack);
-  }
+  var when = function(value, callback, errback, progressBack) {
+    var result = new Deferred();
+    result.resolve(value);
+    return result.promise.then(callback, errback, progressBack);
+  };
 
   /**
    * @ngdoc method
@@ -27318,70 +25376,48 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
    */
 
   function all(promises) {
-    var result = new Promise(),
+    var deferred = new Deferred(),
         counter = 0,
         results = isArray(promises) ? [] : {};
 
     forEach(promises, function(promise, key) {
       counter++;
       when(promise).then(function(value) {
+        if (results.hasOwnProperty(key)) return;
         results[key] = value;
-        if (!(--counter)) resolvePromise(result, results);
+        if (!(--counter)) deferred.resolve(results);
       }, function(reason) {
-        rejectPromise(result, reason);
+        if (results.hasOwnProperty(key)) return;
+        deferred.reject(reason);
       });
     });
 
     if (counter === 0) {
-      resolvePromise(result, results);
+      deferred.resolve(results);
     }
 
-    return result;
-  }
-
-  /**
-   * @ngdoc method
-   * @name $q#race
-   * @kind function
-   *
-   * @description
-   * Returns a promise that resolves or rejects as soon as one of those promises
-   * resolves or rejects, with the value or reason from that promise.
-   *
-   * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.
-   * @returns {Promise} a promise that resolves or rejects as soon as one of the `promises`
-   * resolves or rejects, with the value or reason from that promise.
-   */
-
-  function race(promises) {
-    var deferred = defer();
-
-    forEach(promises, function(promise) {
-      when(promise).then(deferred.resolve, deferred.reject);
-    });
-
     return deferred.promise;
   }
 
-  function $Q(resolver) {
+  var $Q = function Q(resolver) {
     if (!isFunction(resolver)) {
-      throw $qMinErr('norslvr', 'Expected resolverFn, got \'{0}\'', resolver);
+      throw $qMinErr('norslvr', "Expected resolverFn, got '{0}'", resolver);
     }
 
-    var promise = new Promise();
+    var deferred = new Deferred();
 
     function resolveFn(value) {
-      resolvePromise(promise, value);
+      deferred.resolve(value);
     }
 
     function rejectFn(reason) {
-      rejectPromise(promise, reason);
+      deferred.reject(reason);
     }
 
     resolver(resolveFn, rejectFn);
 
-    return promise;
-  }
+    return deferred.promise;
+  };
 
   // Let's make the instanceof operator work for promises, so that
   // `new $q(fn) instanceof $q` would evaluate to true.
@@ -27392,12 +25428,10 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
   $Q.when = when;
   $Q.resolve = resolve;
   $Q.all = all;
-  $Q.race = race;
 
   return $Q;
 }
 
-/** @this */
 function $$RAFProvider() { //rAF
   this.$get = ['$window', '$timeout', function($window, $timeout) {
     var requestAnimationFrame = $window.requestAnimationFrame ||
@@ -27487,8 +25521,6 @@ function $$RAFProvider() { //rAF
 /**
  * @ngdoc service
  * @name $rootScope
- * @this
- *
  * @description
  *
  * Every application has a single root {@link ng.$rootScope.Scope scope}.
@@ -27533,19 +25565,14 @@ function $RootScopeProvider() {
 
     function cleanUpScope($scope) {
 
-      // Support: IE 9 only
       if (msie === 9) {
         // There is a memory leak in IE9 if all child scopes are not disconnected
         // completely when a scope is destroyed. So this code will recurse up through
         // all this scopes children
         //
         // See issue https://github.com/angular/angular.js/issues/10706
-        if ($scope.$$childHead) {
-          cleanUpScope($scope.$$childHead);
-        }
-        if ($scope.$$nextSibling) {
-          cleanUpScope($scope.$$nextSibling);
-        }
+        $scope.$$childHead && cleanUpScope($scope.$$childHead);
+        $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling);
       }
 
       // The code below works around IE9 and V8's memory leaks
@@ -27697,7 +25724,7 @@ function $RootScopeProvider() {
         // prototypically. In all other cases, this property needs to be set
         // when the parent scope is destroyed.
         // The listener needs to be added after the parent is set
-        if (isolate || parent !== this) child.$on('$destroy', destroyChildScope);
+        if (isolate || parent != this) child.$on('$destroy', destroyChildScope);
 
         return child;
       },
@@ -27714,7 +25741,7 @@ function $RootScopeProvider() {
        *   $digest()} and should return the value that will be watched. (`watchExpression` should not change
        *   its value when executed multiple times with the same input because it may be executed multiple
        *   times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be
-       *   [idempotent](http://en.wikipedia.org/wiki/Idempotence).)
+       *   [idempotent](http://en.wikipedia.org/wiki/Idempotence).
        * - The `listener` is called only when the value from the current `watchExpression` and the
        *   previous call to `watchExpression` are not equal (with the exception of the initial run,
        *   see below). Inequality is determined according to reference inequality,
@@ -27725,8 +25752,6 @@ function $RootScopeProvider() {
        *   according to the {@link angular.equals} function. To save the value of the object for
        *   later comparison, the {@link angular.copy} function is used. This therefore means that
        *   watching complex objects will have adverse memory and performance implications.
-       * - This should not be used to watch for changes in objects that are
-       *   or contain [File](https://developer.mozilla.org/docs/Web/API/File) objects due to limitations with {@link angular.copy `angular.copy`}.
        * - The watch `listener` may change the model, which may trigger other `listener`s to fire.
        *   This is achieved by rerunning the watchers until no changes are detected. The rerun
        *   iteration limit is 10 to prevent an infinite loop deadlock.
@@ -27844,21 +25869,15 @@ function $RootScopeProvider() {
 
         if (!array) {
           array = scope.$$watchers = [];
-          array.$$digestWatchIndex = -1;
         }
         // we use unshift since we use a while loop in $digest for speed.
         // the while loop reads in reverse order.
         array.unshift(watcher);
-        array.$$digestWatchIndex++;
         incrementWatchersCount(this, 1);
 
         return function deregisterWatch() {
-          var index = arrayRemove(array, watcher);
-          if (index >= 0) {
+          if (arrayRemove(array, watcher) >= 0) {
             incrementWatchersCount(scope, -1);
-            if (index < array.$$digestWatchIndex) {
-              array.$$digestWatchIndex--;
-            }
           }
           lastDirtyWatch = null;
         };
@@ -27873,8 +25892,8 @@ function $RootScopeProvider() {
        * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`.
        * If any one expression in the collection changes the `listener` is executed.
        *
-       * - The items in the `watchExpressions` array are observed via the standard `$watch` operation. Their return
-       *   values are examined for changes on every call to `$digest`.
+       * - The items in the `watchExpressions` array are observed via standard $watch operation and are examined on every
+       *   call to $digest() to see if any items changes.
        * - The `listener` is called whenever any expression in the `watchExpressions` array changes.
        *
        * @param {Array.<string|Function(scope)>} watchExpressions Array of expressions that will be individually
@@ -28055,7 +26074,6 @@ function $RootScopeProvider() {
               oldItem = oldValue[i];
               newItem = newValue[i];
 
-              // eslint-disable-next-line no-self-compare
               bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
               if (!bothNaN && (oldItem !== newItem)) {
                 changeDetected++;
@@ -28078,7 +26096,6 @@ function $RootScopeProvider() {
                 oldItem = oldValue[key];
 
                 if (key in oldValue) {
-                  // eslint-disable-next-line no-self-compare
                   bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
                   if (!bothNaN && (oldItem !== newItem)) {
                     changeDetected++;
@@ -28191,6 +26208,7 @@ function $RootScopeProvider() {
       $digest: function() {
         var watch, value, last, fn, get,
             watchers,
+            length,
             dirty, ttl = TTL,
             next, current, target = this,
             watchLog = [],
@@ -28213,29 +26231,24 @@ function $RootScopeProvider() {
           dirty = false;
           current = target;
 
-          // It's safe for asyncQueuePosition to be a local variable here because this loop can't
-          // be reentered recursively. Calling $digest from a function passed to $evalAsync would
-          // lead to a '$digest already in progress' error.
-          for (var asyncQueuePosition = 0; asyncQueuePosition < asyncQueue.length; asyncQueuePosition++) {
+          while (asyncQueue.length) {
             try {
-              asyncTask = asyncQueue[asyncQueuePosition];
-              fn = asyncTask.fn;
-              fn(asyncTask.scope, asyncTask.locals);
+              asyncTask = asyncQueue.shift();
+              asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);
             } catch (e) {
               $exceptionHandler(e);
             }
             lastDirtyWatch = null;
           }
-          asyncQueue.length = 0;
 
           traverseScopesLoop:
           do { // "traverse the scopes" loop
             if ((watchers = current.$$watchers)) {
               // process our watches
-              watchers.$$digestWatchIndex = watchers.length;
-              while (watchers.$$digestWatchIndex--) {
+              length = watchers.length;
+              while (length--) {
                 try {
-                  watch = watchers[watchers.$$digestWatchIndex];
+                  watch = watchers[length];
                   // Most common watches are on primitives, in which case we can short
                   // circuit it with === operator, only when === fails do we use .equals
                   if (watch) {
@@ -28243,7 +26256,8 @@ function $RootScopeProvider() {
                     if ((value = get(current)) !== (last = watch.last) &&
                         !(watch.eq
                             ? equals(value, last)
-                            : (isNumberNaN(value) && isNumberNaN(last)))) {
+                            : (typeof value === 'number' && typeof last === 'number'
+                               && isNaN(value) && isNaN(last)))) {
                       dirty = true;
                       lastDirtyWatch = watch;
                       watch.last = watch.eq ? copy(value, null) : value;
@@ -28296,19 +26310,13 @@ function $RootScopeProvider() {
 
         clearPhase();
 
-        // postDigestQueuePosition isn't local here because this loop can be reentered recursively.
-        while (postDigestQueuePosition < postDigestQueue.length) {
+        while (postDigestQueue.length) {
           try {
-            postDigestQueue[postDigestQueuePosition++]();
+            postDigestQueue.shift()();
           } catch (e) {
             $exceptionHandler(e);
           }
         }
-        postDigestQueue.length = postDigestQueuePosition = 0;
-
-        // Check for changes to browser url that happened during the $digest
-        // (for which no event is fired; e.g. via `history.pushState()`)
-        $browser.$$checkUrlChange();
       },
 
 
@@ -28366,8 +26374,8 @@ function $RootScopeProvider() {
 
         // sever all the references to parent scopes (after this cleanup, the current scope should
         // not be retained by any of our references and should be eligible for garbage collection)
-        if (parent && parent.$$childHead === this) parent.$$childHead = this.$$nextSibling;
-        if (parent && parent.$$childTail === this) parent.$$childTail = this.$$prevSibling;
+        if (parent && parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
+        if (parent && parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
         if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
         if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
 
@@ -28454,7 +26462,7 @@ function $RootScopeProvider() {
           });
         }
 
-        asyncQueue.push({scope: this, fn: $parse(expr), locals: locals});
+        asyncQueue.push({scope: this, expression: $parse(expr), locals: locals});
       },
 
       $$postDigest: function(fn) {
@@ -28521,7 +26529,6 @@ function $RootScopeProvider() {
             $rootScope.$digest();
           } catch (e) {
             $exceptionHandler(e);
-            // eslint-disable-next-line no-unsafe-finally
             throw e;
           }
         }
@@ -28546,9 +26553,7 @@ function $RootScopeProvider() {
        */
       $applyAsync: function(expr) {
         var scope = this;
-        if (expr) {
-          applyAsyncQueue.push($applyAsyncExpression);
-        }
+        expr && applyAsyncQueue.push($applyAsyncExpression);
         expr = $parse(expr);
         scheduleApplyAsync();
 
@@ -28766,8 +26771,6 @@ function $RootScopeProvider() {
     var postDigestQueue = $rootScope.$$postDigestQueue = [];
     var applyAsyncQueue = $rootScope.$$applyAsyncQueue = [];
 
-    var postDigestQueuePosition = 0;
-
     return $rootScope;
 
 
@@ -28842,7 +26845,6 @@ function $RootScopeProvider() {
 // the implementation is in angular.bootstrap
 
 /**
- * @this
  * @description
  * Private service to sanitize uris for links and images. Used by $compile and $sanitize.
  */
@@ -28923,38 +26925,20 @@ function $$SanitizeUriProvider() {
  *     Or gives undesired access to variables likes document or window?    *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-/* exported $SceProvider, $SceDelegateProvider */
-
 var $sceMinErr = minErr('$sce');
 
 var SCE_CONTEXTS = {
-  // HTML is used when there's HTML rendered (e.g. ng-bind-html, iframe srcdoc binding).
   HTML: 'html',
-
-  // Style statements or stylesheets. Currently unused in AngularJS.
   CSS: 'css',
-
-  // An URL used in a context where it does not refer to a resource that loads code. Currently
-  // unused in AngularJS.
   URL: 'url',
-
-  // RESOURCE_URL is a subtype of URL used where the referred-to resource could be interpreted as
-  // code. (e.g. ng-include, script src binding, templateUrl)
+  // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a
+  // url.  (e.g. ng-include, script src, templateUrl)
   RESOURCE_URL: 'resourceUrl',
-
-  // Script. Currently unused in AngularJS.
   JS: 'js'
 };
 
 // Helper functions follow.
 
-var UNDERSCORE_LOWERCASE_REGEXP = /_([a-z])/g;
-
-function snakeToCamel(name) {
-  return name
-    .replace(UNDERSCORE_LOWERCASE_REGEXP, fnCamelCaseReplace);
-}
-
 function adjustMatcher(matcher) {
   if (matcher === 'self') {
     return matcher;
@@ -28968,8 +26952,8 @@ function adjustMatcher(matcher) {
           'Illegal sequence *** in string matcher.  String: {0}', matcher);
     }
     matcher = escapeForRegexp(matcher).
-                  replace(/\\\*\\\*/g, '.*').
-                  replace(/\\\*/g, '[^:/.?&;]*');
+                  replace('\\*\\*', '.*').
+                  replace('\\*', '[^:/.?&;]*');
     return new RegExp('^' + matcher + '$');
   } else if (isRegExp(matcher)) {
     // The only other type of matcher allowed is a Regexp.
@@ -29004,16 +26988,6 @@ function adjustMatchers(matchers) {
  * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict
  * Contextual Escaping (SCE)} services to AngularJS.
  *
- * For an overview of this service and the functionnality it provides in AngularJS, see the main
- * page for {@link ng.$sce SCE}. The current page is targeted for developers who need to alter how
- * SCE works in their application, which shouldn't be needed in most cases.
- *
- * <div class="alert alert-danger">
- * AngularJS strongly relies on contextual escaping for the security of bindings: disabling or
- * modifying this might cause cross site scripting (XSS) vulnerabilities. For libraries owners,
- * changes to this service will also influence users, so be extra careful and document your changes.
- * </div>
- *
  * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of
  * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS.  This is
  * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to
@@ -29034,19 +27008,13 @@ function adjustMatchers(matchers) {
 /**
  * @ngdoc provider
  * @name $sceDelegateProvider
- * @this
- *
  * @description
  *
  * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate
- * $sceDelegate service}, used as a delegate for {@link ng.$sce Strict Contextual Escaping (SCE)}.
- *
- * The `$sceDelegateProvider` allows one to get/set the whitelists and blacklists used to ensure
- * that the URLs used for sourcing AngularJS templates and other script-running URLs are safe (all
- * places that use the `$sce.RESOURCE_URL` context). See
- * {@link ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist}
- * and
- * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist},
+ * $sceDelegate} service.  This allows one to get/set the whitelists and blacklists used to ensure
+ * that the URLs used for sourcing Angular templates are safe.  Refer {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and
+ * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
  *
  * For the general details about this service in Angular, read the main page for {@link ng.$sce
  * Strict Contextual Escaping (SCE)}.
@@ -29055,7 +27023,7 @@ function adjustMatchers(matchers) {
  *
  * - your app is hosted at url `http://myapp.example.com/`
  * - but some of your templates are hosted on other domains you control such as
- *   `http://srv01.assets.example.com/`, `http://srv02.assets.example.com/`, etc.
+ *   `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.
  * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.
  *
  * Here is what a secure configuration for this scenario might look like:
@@ -29075,13 +27043,6 @@ function adjustMatchers(matchers) {
  *    ]);
  *  });
  * ```
- * Note that an empty whitelist will block every resource URL from being loaded, and will require
- * you to manually mark each one as trusted with `$sce.trustAsResourceUrl`. However, templates
- * requested by {@link ng.$templateRequest $templateRequest} that are present in
- * {@link ng.$templateCache $templateCache} will not go through this check. If you have a mechanism
- * to populate your templates in that cache at config time, then it is a good idea to remove 'self'
- * from that whitelist. This helps to mitigate the security impact of certain types of issues, like
- * for instance attacker-controlled `ng-includes`.
  */
 
 function $SceDelegateProvider() {
@@ -29097,23 +27058,23 @@ function $SceDelegateProvider() {
    * @kind function
    *
    * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
-   *     provided.  This must be an array or null.  A snapshot of this array is used so further
-   *     changes to the array are ignored.
-   *     Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
-   *     allowed in this array.
+   *    provided.  This must be an array or null.  A snapshot of this array is used so further
+   *    changes to the array are ignored.
    *
-   * @return {Array} The currently set whitelist array.
+   *    Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+   *    allowed in this array.
    *
-   * @description
-   * Sets/Gets the whitelist of trusted resource URLs.
+   *    <div class="alert alert-warning">
+   *    **Note:** an empty whitelist array will block all URLs!
+   *    </div>
+   *
+   * @return {Array} the currently set whitelist array.
    *
    * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
    * same origin resource requests.
    *
-   * <div class="alert alert-warning">
-   * **Note:** the default whitelist of 'self' is not recommended if your app shares its origin
-   * with other apps! It is a good idea to limit it to only your application's directory.
-   * </div>
+   * @description
+   * Sets/Gets the whitelist of trusted resource URLs.
    */
   this.resourceUrlWhitelist = function(value) {
     if (arguments.length) {
@@ -29128,23 +27089,25 @@ function $SceDelegateProvider() {
    * @kind function
    *
    * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
-   *     provided.  This must be an array or null.  A snapshot of this array is used so further
-   *     changes to the array are ignored.</p><p>
-   *     Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
-   *     allowed in this array.</p><p>
-   *     The typical usage for the blacklist is to **block
-   *     [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
-   *     these would otherwise be trusted but actually return content from the redirected domain.
-   *     </p><p>
-   *     Finally, **the blacklist overrides the whitelist** and has the final say.
-   *
-   * @return {Array} The currently set blacklist array.
+   *    provided.  This must be an array or null.  A snapshot of this array is used so further
+   *    changes to the array are ignored.
    *
-   * @description
-   * Sets/Gets the blacklist of trusted resource URLs.
+   *    Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+   *    allowed in this array.
+   *
+   *    The typical usage for the blacklist is to **block
+   *    [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
+   *    these would otherwise be trusted but actually return content from the redirected domain.
+   *
+   *    Finally, **the blacklist overrides the whitelist** and has the final say.
+   *
+   * @return {Array} the currently set blacklist array.
    *
    * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there
    * is no blacklist.)
+   *
+   * @description
+   * Sets/Gets the blacklist of trusted resource URLs.
    */
 
   this.resourceUrlBlacklist = function(value) {
@@ -29228,24 +27191,17 @@ function $SceDelegateProvider() {
      * @name $sceDelegate#trustAs
      *
      * @description
-     * Returns a trusted representation of the parameter for the specified context. This trusted
-     * object will later on be used as-is, without any security check, by bindings or directives
-     * that require this security context.
-     * For instance, marking a string as trusted for the `$sce.HTML` context will entirely bypass
-     * the potential `$sanitize` call in corresponding `$sce.HTML` bindings or directives, such as
-     * `ng-bind-html`. Note that in most cases you won't need to call this function: if you have the
-     * sanitizer loaded, passing the value itself will render all the HTML that does not pose a
-     * security risk.
-     *
-     * See {@link ng.$sceDelegate#getTrusted getTrusted} for the function that will consume those
-     * trusted values, and {@link ng.$sce $sce} for general documentation about strict contextual
-     * escaping.
-     *
-     * @param {string} type The context in which this value is safe for use, e.g. `$sce.URL`,
-     *     `$sce.RESOURCE_URL`, `$sce.HTML`, `$sce.JS` or `$sce.CSS`.
+     * Returns an object that is trusted by angular for use in specified strict
+     * contextual escaping contexts (such as ng-bind-html, ng-include, any src
+     * attribute interpolation, any dom event binding attribute interpolation
+     * such as for onclick,  etc.) that uses the provided value.
+     * See {@link ng.$sce $sce} for enabling strict contextual escaping.
      *
-     * @param {*} value The value that should be considered trusted.
-     * @return {*} A trusted representation of value, that can be used in the given context.
+     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,
+     *   resourceUrl, html, js and css.
+     * @param {*} value The value that that should be considered trusted/safe.
+     * @returns {*} A value that can be used to stand in for the provided `value` in places
+     * where Angular expects a $sce.trustAs() return value.
      */
     function trustAs(type, trustedValue) {
       var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
@@ -29277,11 +27233,11 @@ function $SceDelegateProvider() {
      * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.
      *
      * If the passed parameter is not a value that had been returned by {@link
-     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, it must be returned as-is.
+     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.
      *
      * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}
-     *     call or anything else.
-     * @return {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs
+     *      call or anything else.
+     * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs
      *     `$sceDelegate.trustAs`} if `value` is the result of such a call.  Otherwise, returns
      *     `value` unchanged.
      */
@@ -29298,38 +27254,33 @@ function $SceDelegateProvider() {
      * @name $sceDelegate#getTrusted
      *
      * @description
-     * Takes any input, and either returns a value that's safe to use in the specified context, or
-     * throws an exception.
+     * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and
+     * returns the originally supplied value if the queried context type is a supertype of the
+     * created type.  If this condition isn't satisfied, throws an exception.
      *
-     * In practice, there are several cases. When given a string, this function runs checks
-     * and sanitization to make it safe without prior assumptions. When given the result of a {@link
-     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call, it returns the originally supplied
-     * value if that value's context is valid for this call's context. Finally, this function can
-     * also throw when there is no way to turn `maybeTrusted` in a safe value (e.g., no sanitization
-     * is available or possible.)
+     * <div class="alert alert-danger">
+     * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting
+     * (XSS) vulnerability in your application.
+     * </div>
      *
-     * @param {string} type The context in which this value is to be used (such as `$sce.HTML`).
+     * @param {string} type The kind of context in which this value is to be used.
      * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs
-     *     `$sceDelegate.trustAs`} call, or anything else (which will not be considered trusted.)
-     * @return {*} A version of the value that's safe to use in the given context, or throws an
-     *     exception if this is impossible.
+     *     `$sceDelegate.trustAs`} call.
+     * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs
+     *     `$sceDelegate.trustAs`} if valid in this context.  Otherwise, throws an exception.
      */
     function getTrusted(type, maybeTrusted) {
       if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') {
         return maybeTrusted;
       }
       var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
-      // If maybeTrusted is a trusted class instance or subclass instance, then unwrap and return
-      // as-is.
       if (constructor && maybeTrusted instanceof constructor) {
         return maybeTrusted.$$unwrapTrustedValue();
       }
-      // Otherwise, if we get here, then we may either make it safe, or throw an exception. This
-      // depends on the context: some are sanitizatible (HTML), some use whitelists (RESOURCE_URL),
-      // some are impossible to do (JS). This step isn't implemented for CSS and URL, as AngularJS
-      // has no corresponding sinks.
+      // If we get here, then we may only take one of two actions.
+      // 1. sanitize the value for the requested type, or
+      // 2. throw an exception.
       if (type === SCE_CONTEXTS.RESOURCE_URL) {
-        // RESOURCE_URL uses a whitelist.
         if (isResourceUrlAllowedByPolicy(maybeTrusted)) {
           return maybeTrusted;
         } else {
@@ -29338,10 +27289,8 @@ function $SceDelegateProvider() {
               maybeTrusted.toString());
         }
       } else if (type === SCE_CONTEXTS.HTML) {
-        // htmlSanitizer throws its own error when no sanitizer is available.
         return htmlSanitizer(maybeTrusted);
       }
-      // Default error when the $sce service has no way to make the input safe.
       throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
     }
 
@@ -29355,8 +27304,6 @@ function $SceDelegateProvider() {
 /**
  * @ngdoc provider
  * @name $sceProvider
- * @this
- *
  * @description
  *
  * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.
@@ -29366,6 +27313,8 @@ function $SceDelegateProvider() {
  * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.
  */
 
+/* jshint maxlen: false*/
+
 /**
  * @ngdoc service
  * @name $sce
@@ -29377,27 +27326,21 @@ function $SceDelegateProvider() {
  *
  * # Strict Contextual Escaping
  *
- * Strict Contextual Escaping (SCE) is a mode in which AngularJS constrains bindings to only render
- * trusted values. Its goal is to assist in writing code in a way that (a) is secure by default, and
- * (b) makes auditing for security vulnerabilities such as XSS, clickjacking, etc. a lot easier.
- *
- * ## Overview
+ * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain
+ * contexts to result in a value that is marked as safe to use for that context.  One example of
+ * such a context is binding arbitrary html controlled by the user via `ng-bind-html`.  We refer
+ * to these contexts as privileged or SCE contexts.
  *
- * To systematically block XSS security bugs, AngularJS treats all values as untrusted by default in
- * HTML or sensitive URL bindings. When binding untrusted values, AngularJS will automatically
- * run security checks on them (sanitizations, whitelists, depending on context), or throw when it
- * cannot guarantee the security of the result. That behavior depends strongly on contexts: HTML
- * can be sanitized, but template URLs cannot, for instance.
+ * As of version 1.2, Angular ships with SCE enabled by default.
  *
- * To illustrate this, consider the `ng-bind-html` directive. It renders its value directly as HTML:
- * we call that the *context*. When given an untrusted input, AngularJS will attempt to sanitize it
- * before rendering if a sanitizer is available, and throw otherwise. To bypass sanitization and
- * render the input as-is, you will need to mark it as trusted for that context before attempting
- * to bind it.
+ * Note:  When enabled (the default), IE<11 in quirks mode is not supported.  In this mode, IE<11 allow
+ * one to execute arbitrary javascript by the use of the expression() syntax.  Refer
+ * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.
+ * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`
+ * to the top of your HTML document.
  *
- * As of version 1.2, AngularJS ships with SCE enabled by default.
- *
- * ## In practice
+ * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for
+ * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.
  *
  * Here's an example of a binding in a privileged context:
  *
@@ -29407,10 +27350,10 @@ function $SceDelegateProvider() {
  * ```
  *
  * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user.  With SCE
- * disabled, this application allows the user to render arbitrary HTML into the DIV, which would
- * be an XSS security bug. In a more realistic example, one may be rendering user comments, blog
- * articles, etc. via bindings. (HTML is just one example of a context where rendering user
- * controlled input creates security vulnerabilities.)
+ * disabled, this application allows the user to render arbitrary HTML into the DIV.
+ * In a more realistic example, one may be rendering user comments, blog articles, etc. via
+ * bindings.  (HTML is just one example of a context where rendering user controlled input creates
+ * security vulnerabilities.)
  *
  * For the case of HTML, you might use a library, either on the client side, or on the server side,
  * to sanitize unsafe HTML before binding to the value and rendering it in the document.
@@ -29420,29 +27363,25 @@ function $SceDelegateProvider() {
  * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some
  * properties/fields and forgot to update the binding to the sanitized value?
  *
- * To be secure by default, AngularJS makes sure bindings go through that sanitization, or
- * any similar validation process, unless there's a good reason to trust the given value in this
- * context.  That trust is formalized with a function call. This means that as a developer, you
- * can assume all untrusted bindings are safe. Then, to audit your code for binding security issues,
- * you just need to ensure the values you mark as trusted indeed are safe - because they were
- * received from your server, sanitized by your library, etc. You can organize your codebase to
- * help with this - perhaps allowing only the files in a specific directory to do this.
- * Ensuring that the internal API exposed by that code doesn't markup arbitrary values as safe then
- * becomes a more manageable task.
+ * To be secure by default, you want to ensure that any such bindings are disallowed unless you can
+ * determine that something explicitly says it's safe to use a value for binding in that
+ * context.  You can then audit your code (a simple grep would do) to ensure that this is only done
+ * for those values that you can easily tell are safe - because they were received from your server,
+ * sanitized by your library, etc.  You can organize your codebase to help with this - perhaps
+ * allowing only the files in a specific directory to do this.  Ensuring that the internal API
+ * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.
  *
  * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}
  * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to
- * build the trusted versions of your values.
+ * obtain values that will be accepted by SCE / privileged contexts.
+ *
  *
  * ## How does it work?
  *
  * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted
- * $sce.getTrusted(context, value)} rather than to the value directly.  Think of this function as
- * a way to enforce the required security context in your data sink. Directives use {@link
- * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs
- * the {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals. Also,
- * when binding without directives, AngularJS will understand the context of your bindings
- * automatically.
+ * $sce.getTrusted(context, value)} rather than to the value directly.  Directives use {@link
+ * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the
+ * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.
  *
  * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link
  * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}.  Here's the actual code (slightly
@@ -29483,12 +27422,11 @@ function $SceDelegateProvider() {
  * It's important to remember that SCE only applies to interpolation expressions.
  *
  * If your expressions are constant literals, they're automatically trusted and you don't need to
- * call `$sce.trustAs` on them (e.g.
- * `<div ng-bind-html="'<b>implicitly trusted</b>'"></div>`) just works. The `$sceDelegate` will
- * also use the `$sanitize` service if it is available when binding untrusted values to
- * `$sce.HTML` context. AngularJS provides an implementation in `angular-sanitize.js`, and if you
- * wish to use it, you will also need to depend on the {@link ngSanitize `ngSanitize`} module in
- * your application.
+ * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.
+ * `<div ng-bind-html="'<b>implicitly trusted</b>'"></div>`) just works.
+ *
+ * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them
+ * through {@link ng.$sce#getTrusted $sce.getTrusted}.  SCE doesn't play a role here.
  *
  * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load
  * templates in `ng-include` from your application's domain without having to even know about SCE.
@@ -29506,17 +27444,11 @@ function $SceDelegateProvider() {
  *
  * | Context             | Notes          |
  * |---------------------|----------------|
- * | `$sce.HTML`         | For HTML that's safe to source into the application.  The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered, and the {@link ngSanitize.$sanitize $sanitize} service is available (implemented by the {@link ngSanitize ngSanitize} module) this will sanitize the value instead of throwing an error. |
- * | `$sce.CSS`          | For CSS that's safe to source into the application.  Currently, no bindings require this context. Feel free to use it in your own directives. |
- * | `$sce.URL`          | For URLs that are safe to follow as links.  Currently unused (`<a href=`, `<img src=`, and some others sanitize their urls and don't constitute an SCE context.) |
- * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application.  Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG`, `VIDEO`, `AUDIO`, `SOURCE`, and `TRACK` (e.g. `IFRAME`, `OBJECT`, etc.)  <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does (it's not just the URL that matters, but also what is at the end of it), and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
- * | `$sce.JS`           | For JavaScript that is safe to execute in your application's context.  Currently, no bindings require this context.  Feel free to use it in your own directives. |
- *
- *
- * Be aware that `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them
- * through {@link ng.$sce#getTrusted $sce.getTrusted}. There's no CSS-, URL-, or JS-context bindings
- * in AngularJS currently, so their corresponding `$sce.trustAs` functions aren't useful yet. This
- * might evolve.
+ * | `$sce.HTML`         | For HTML that's safe to source into the application.  The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |
+ * | `$sce.CSS`          | For CSS that's safe to source into the application.  Currently unused.  Feel free to use it in your own directives. |
+ * | `$sce.URL`          | For URLs that are safe to follow as links.  Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |
+ * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application.  Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)  <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
+ * | `$sce.JS`           | For JavaScript that is safe to execute in your application's context.  Currently unused.  Feel free to use it in your own directives. |
  *
  * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name="resourceUrlPatternItem"></a>
  *
@@ -29567,7 +27499,7 @@ function $SceDelegateProvider() {
  *
  * ## Show me an example using SCE.
  *
- * <example module="mySceApp" deps="angular-sanitize.js" name="sce-service">
+ * <example module="mySceApp" deps="angular-sanitize.js">
  * <file name="index.html">
  *   <div ng-controller="AppController as myCtrl">
  *     <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
@@ -29588,10 +27520,10 @@ function $SceDelegateProvider() {
  * <file name="script.js">
  *   angular.module('mySceApp', ['ngSanitize'])
  *     .controller('AppController', ['$http', '$templateCache', '$sce',
- *       function AppController($http, $templateCache, $sce) {
+ *       function($http, $templateCache, $sce) {
  *         var self = this;
- *         $http.get('test_data.json', {cache: $templateCache}).then(function(response) {
- *           self.userComments = response.data;
+ *         $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
+ *           self.userComments = userComments;
  *         });
  *         self.explicitlyTrustedHtml = $sce.trustAsHtml(
  *             '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
@@ -29614,12 +27546,12 @@ function $SceDelegateProvider() {
  * <file name="protractor.js" type="protractor">
  *   describe('SCE doc demo', function() {
  *     it('should sanitize untrusted values', function() {
- *       expect(element.all(by.css('.htmlComment')).first().getAttribute('innerHTML'))
+ *       expect(element.all(by.css('.htmlComment')).first().getInnerHtml())
  *           .toBe('<span>Is <i>anyone</i> reading this?</span>');
  *     });
  *
  *     it('should NOT sanitize explicitly trusted values', function() {
- *       expect(element(by.id('explicitlyTrustedHtml')).getAttribute('innerHTML')).toBe(
+ *       expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
  *           '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
  *           'sanitization.&quot;">Hover over this text.</span>');
  *     });
@@ -29635,20 +27567,20 @@ function $SceDelegateProvider() {
  * for little coding overhead.  It will be much harder to take an SCE disabled application and
  * either secure it on your own or enable SCE at a later stage.  It might make sense to disable SCE
  * for cases where you have a lot of existing code that was written before SCE was introduced and
- * you're migrating them a module at a time. Also do note that this is an app-wide setting, so if
- * you are writing a library, you will cause security bugs applications using it.
+ * you're migrating them a module at a time.
  *
  * That said, here's how you can completely disable SCE:
  *
  * ```
  * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
  *   // Completely disable SCE.  For demonstration purposes only!
- *   // Do not use in new projects or libraries.
+ *   // Do not use in new projects.
  *   $sceProvider.enabled(false);
  * });
  * ```
  *
  */
+/* jshint maxlen: 100 */
 
 function $SceProvider() {
   var enabled = true;
@@ -29658,8 +27590,8 @@ function $SceProvider() {
    * @name $sceProvider#enabled
    * @kind function
    *
-   * @param {boolean=} value If provided, then enables/disables SCE application-wide.
-   * @return {boolean} True if SCE is enabled, false otherwise.
+   * @param {boolean=} value If provided, then enables/disables SCE.
+   * @return {boolean} true if SCE is enabled, false otherwise.
    *
    * @description
    * Enables/disables SCE and returns the current value.
@@ -29713,14 +27645,13 @@ function $SceProvider() {
    *     getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)
    *     will also succeed.
    *
-   * Inheritance happens to capture this in a natural way. In some future, we may not use
-   * inheritance anymore. That is OK because no code outside of sce.js and sceSpecs.js would need to
-   * be aware of this detail.
+   * Inheritance happens to capture this in a natural way.  In some future, we
+   * may not use inheritance anymore.  That is OK because no code outside of
+   * sce.js and sceSpecs.js would need to be aware of this detail.
    */
 
   this.$get = ['$parse', '$sceDelegate', function(
                 $parse,   $sceDelegate) {
-    // Support: IE 9-11 only
     // Prereq: Ensure that we're not running in IE<11 quirks mode.  In that mode, IE < 11 allow
     // the "expression(javascript expression)" syntax which is insecure.
     if (enabled && msie < 8) {
@@ -29737,8 +27668,8 @@ function $SceProvider() {
      * @name $sce#isEnabled
      * @kind function
      *
-     * @return {Boolean} True if SCE is enabled, false otherwise.  If you want to set the value, you
-     *     have to do it at module config time on {@link ng.$sceProvider $sceProvider}.
+     * @return {Boolean} true if SCE is enabled, false otherwise.  If you want to set the value, you
+     * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.
      *
      * @description
      * Returns a boolean indicating if SCE is enabled.
@@ -29765,14 +27696,14 @@ function $SceProvider() {
      * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,
      * *result*)}
      *
-     * @param {string} type The SCE context in which this result will be used.
+     * @param {string} type The kind of SCE context in which this result will be used.
      * @param {string} expression String expression to compile.
-     * @return {function(context, locals)} A function which represents the compiled expression:
+     * @returns {function(context, locals)} a function which represents the compiled expression:
      *
-     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the
-     *      strings are evaluated against (typically a scope object).
-     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values
-     *      in `context`.
+     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values in
+     *      `context`.
      */
     sce.parseAs = function sceParseAs(type, expr) {
       var parsed = $parse(expr);
@@ -29790,18 +27721,18 @@ function $SceProvider() {
      * @name $sce#trustAs
      *
      * @description
-     * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such, returns a
-     * wrapped object that represents your value, and the trust you have in its safety for the given
-     * context. AngularJS can then use that value as-is in bindings of the specified secure context.
-     * This is used in bindings for `ng-bind-html`, `ng-include`, and most `src` attribute
-     * interpolations. See {@link ng.$sce $sce} for strict contextual escaping.
-     *
-     * @param {string} type The context in which this value is safe for use, e.g. `$sce.URL`,
-     *     `$sce.RESOURCE_URL`, `$sce.HTML`, `$sce.JS` or `$sce.CSS`.
+     * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.  As such,
+     * returns an object that is trusted by angular for use in specified strict contextual
+     * escaping contexts (such as ng-bind-html, ng-include, any src attribute
+     * interpolation, any dom event binding attribute interpolation such as for onclick,  etc.)
+     * that uses the provided value.  See * {@link ng.$sce $sce} for enabling strict contextual
+     * escaping.
      *
-     * @param {*} value The value that that should be considered trusted.
-     * @return {*} A wrapped version of value that can be used as a trusted variant of your `value`
-     *     in the context you specified.
+     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,
+     *   resourceUrl, html, js and css.
+     * @param {*} value The value that that should be considered trusted/safe.
+     * @returns {*} A value that can be used to stand in for the provided `value` in places
+     * where Angular expects a $sce.trustAs() return value.
      */
 
     /**
@@ -29812,23 +27743,11 @@ function $SceProvider() {
      * Shorthand method.  `$sce.trustAsHtml(value)` â†’
      *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}
      *
-     * @param {*} value The value to mark as trusted for `$sce.HTML` context.
-     * @return {*} A wrapped version of value that can be used as a trusted variant of your `value`
-     *     in `$sce.HTML` context (like `ng-bind-html`).
-     */
-
-    /**
-     * @ngdoc method
-     * @name $sce#trustAsCss
-     *
-     * @description
-     * Shorthand method.  `$sce.trustAsCss(value)` â†’
-     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.CSS, value)`}
-     *
-     * @param {*} value The value to mark as trusted for `$sce.CSS` context.
-     * @return {*} A wrapped version of value that can be used as a trusted variant
-     *     of your `value` in `$sce.CSS` context. This context is currently unused, so there are
-     *     almost no reasons to use this function so far.
+     * @param {*} value The value to trustAs.
+     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml
+     *     $sce.getTrustedHtml(value)} to obtain the original value.  (privileged directives
+     *     only accept expressions that are either literal constants or are the
+     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)
      */
 
     /**
@@ -29839,10 +27758,11 @@ function $SceProvider() {
      * Shorthand method.  `$sce.trustAsUrl(value)` â†’
      *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}
      *
-     * @param {*} value The value to mark as trusted for `$sce.URL` context.
-     * @return {*} A wrapped version of value that can be used as a trusted variant of your `value`
-     *     in `$sce.URL` context. That context is currently unused, so there are almost no reasons
-     *     to use this function so far.
+     * @param {*} value The value to trustAs.
+     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl
+     *     $sce.getTrustedUrl(value)} to obtain the original value.  (privileged directives
+     *     only accept expressions that are either literal constants or are the
+     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)
      */
 
     /**
@@ -29853,10 +27773,11 @@ function $SceProvider() {
      * Shorthand method.  `$sce.trustAsResourceUrl(value)` â†’
      *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}
      *
-     * @param {*} value The value to mark as trusted for `$sce.RESOURCE_URL` context.
-     * @return {*} A wrapped version of value that can be used as a trusted variant of your `value`
-     *     in `$sce.RESOURCE_URL` context (template URLs in `ng-include`, most `src` attribute
-     *     bindings, ...)
+     * @param {*} value The value to trustAs.
+     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl
+     *     $sce.getTrustedResourceUrl(value)} to obtain the original value.  (privileged directives
+     *     only accept expressions that are either literal constants or are the return
+     *     value of {@link ng.$sce#trustAs $sce.trustAs}.)
      */
 
     /**
@@ -29867,10 +27788,11 @@ function $SceProvider() {
      * Shorthand method.  `$sce.trustAsJs(value)` â†’
      *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}
      *
-     * @param {*} value The value to mark as trusted for `$sce.JS` context.
-     * @return {*} A wrapped version of value that can be used as a trusted variant of your `value`
-     *     in `$sce.JS` context. That context is currently unused, so there are almost no reasons to
-     *     use this function so far.
+     * @param {*} value The value to trustAs.
+     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs
+     *     $sce.getTrustedJs(value)} to obtain the original value.  (privileged directives
+     *     only accept expressions that are either literal constants or are the
+     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)
      */
 
     /**
@@ -29879,17 +27801,16 @@ function $SceProvider() {
      *
      * @description
      * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}.  As such,
-     * takes any input, and either returns a value that's safe to use in the specified context,
-     * or throws an exception. This function is aware of trusted values created by the `trustAs`
-     * function and its shorthands, and when contexts are appropriate, returns the unwrapped value
-     * as-is. Finally, this function can also throw when there is no way to turn `maybeTrusted` in a
-     * safe value (e.g., no sanitization is available or possible.)
+     * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the
+     * originally supplied value if the queried context type is a supertype of the created type.
+     * If this condition isn't satisfied, throws an exception.
      *
-     * @param {string} type The context in which this value is to be used.
-     * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs
-     *     `$sce.trustAs`} call, or anything else (which will not be considered trusted.)
-     * @return {*} A version of the value that's safe to use in the given context, or throws an
-     *     exception if this is impossible.
+     * @param {string} type The kind of context in which this value is to be used.
+     * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}
+     *                         call.
+     * @returns {*} The value the was originally provided to
+     *              {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.
+     *              Otherwise, throws an exception.
      */
 
     /**
@@ -29901,7 +27822,7 @@ function $SceProvider() {
      *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}
      *
      * @param {*} value The value to pass to `$sce.getTrusted`.
-     * @return {*} The return value of `$sce.getTrusted($sce.HTML, value)`
+     * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`
      */
 
     /**
@@ -29913,7 +27834,7 @@ function $SceProvider() {
      *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}
      *
      * @param {*} value The value to pass to `$sce.getTrusted`.
-     * @return {*} The return value of `$sce.getTrusted($sce.CSS, value)`
+     * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`
      */
 
     /**
@@ -29925,7 +27846,7 @@ function $SceProvider() {
      *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}
      *
      * @param {*} value The value to pass to `$sce.getTrusted`.
-     * @return {*} The return value of `$sce.getTrusted($sce.URL, value)`
+     * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`
      */
 
     /**
@@ -29937,7 +27858,7 @@ function $SceProvider() {
      *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}
      *
      * @param {*} value The value to pass to `$sceDelegate.getTrusted`.
-     * @return {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`
+     * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`
      */
 
     /**
@@ -29949,7 +27870,7 @@ function $SceProvider() {
      *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}
      *
      * @param {*} value The value to pass to `$sce.getTrusted`.
-     * @return {*} The return value of `$sce.getTrusted($sce.JS, value)`
+     * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`
      */
 
     /**
@@ -29961,12 +27882,12 @@ function $SceProvider() {
      *     {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`}
      *
      * @param {string} expression String expression to compile.
-     * @return {function(context, locals)} A function which represents the compiled expression:
+     * @returns {function(context, locals)} a function which represents the compiled expression:
      *
-     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the
-     *      strings are evaluated against (typically a scope object).
-     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values
-     *      in `context`.
+     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values in
+     *      `context`.
      */
 
     /**
@@ -29978,12 +27899,12 @@ function $SceProvider() {
      *     {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`}
      *
      * @param {string} expression String expression to compile.
-     * @return {function(context, locals)} A function which represents the compiled expression:
+     * @returns {function(context, locals)} a function which represents the compiled expression:
      *
-     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the
-     *      strings are evaluated against (typically a scope object).
-     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values
-     *      in `context`.
+     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values in
+     *      `context`.
      */
 
     /**
@@ -29995,12 +27916,12 @@ function $SceProvider() {
      *     {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`}
      *
      * @param {string} expression String expression to compile.
-     * @return {function(context, locals)} A function which represents the compiled expression:
+     * @returns {function(context, locals)} a function which represents the compiled expression:
      *
-     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the
-     *      strings are evaluated against (typically a scope object).
-     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values
-     *      in `context`.
+     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values in
+     *      `context`.
      */
 
     /**
@@ -30012,12 +27933,12 @@ function $SceProvider() {
      *     {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}
      *
      * @param {string} expression String expression to compile.
-     * @return {function(context, locals)} A function which represents the compiled expression:
+     * @returns {function(context, locals)} a function which represents the compiled expression:
      *
-     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the
-     *      strings are evaluated against (typically a scope object).
-     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values
-     *      in `context`.
+     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values in
+     *      `context`.
      */
 
     /**
@@ -30029,12 +27950,12 @@ function $SceProvider() {
      *     {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`}
      *
      * @param {string} expression String expression to compile.
-     * @return {function(context, locals)} A function which represents the compiled expression:
+     * @returns {function(context, locals)} a function which represents the compiled expression:
      *
-     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the
-     *      strings are evaluated against (typically a scope object).
-     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values
-     *      in `context`.
+     *    * `context` â€“ `{object}` â€“ an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` â€“ `{object=}` â€“ local variables context object, useful for overriding values in
+     *      `context`.
      */
 
     // Shorthand delegations.
@@ -30044,13 +27965,13 @@ function $SceProvider() {
 
     forEach(SCE_CONTEXTS, function(enumValue, name) {
       var lName = lowercase(name);
-      sce[snakeToCamel('parse_as_' + lName)] = function(expr) {
+      sce[camelCase("parse_as_" + lName)] = function(expr) {
         return parse(enumValue, expr);
       };
-      sce[snakeToCamel('get_trusted_' + lName)] = function(value) {
+      sce[camelCase("get_trusted_" + lName)] = function(value) {
         return getTrusted(enumValue, value);
       };
-      sce[snakeToCamel('trust_as_' + lName)] = function(value) {
+      sce[camelCase("trust_as_" + lName)] = function(value) {
         return trustAs(enumValue, value);
       };
     });
@@ -30059,15 +27980,12 @@ function $SceProvider() {
   }];
 }
 
-/* exported $SnifferProvider */
-
 /**
  * !!! This is an undocumented "private" service !!!
  *
  * @name $sniffer
  * @requires $window
  * @requires $document
- * @this
  *
  * @property {boolean} history Does the browser support html5 history api ?
  * @property {boolean} transitions Does the browser support CSS transition events ?
@@ -30079,32 +27997,41 @@ function $SceProvider() {
 function $SnifferProvider() {
   this.$get = ['$window', '$document', function($window, $document) {
     var eventSupport = {},
-        // Chrome Packaged Apps are not allowed to access `history.pushState`.
-        // If not sandboxed, they can be detected by the presence of `chrome.app.runtime`
-        // (see https://developer.chrome.com/apps/api_index). If sandboxed, they can be detected by
-        // the presence of an extension runtime ID and the absence of other Chrome runtime APIs
-        // (see https://developer.chrome.com/apps/manifest/sandbox).
-        // (NW.js apps have access to Chrome APIs, but do support `history`.)
-        isNw = $window.nw && $window.nw.process,
-        isChromePackagedApp =
-            !isNw &&
-            $window.chrome &&
-            ($window.chrome.app && $window.chrome.app.runtime ||
-                !$window.chrome.app && $window.chrome.runtime && $window.chrome.runtime.id),
+        // Chrome Packaged Apps are not allowed to access `history.pushState`. They can be detected by
+        // the presence of `chrome.app.runtime` (see https://developer.chrome.com/apps/api_index)
+        isChromePackagedApp = $window.chrome && $window.chrome.app && $window.chrome.app.runtime,
         hasHistoryPushState = !isChromePackagedApp && $window.history && $window.history.pushState,
         android =
           toInt((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
         boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
         document = $document[0] || {},
+        vendorPrefix,
+        vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/,
         bodyStyle = document.body && document.body.style,
         transitions = false,
-        animations = false;
+        animations = false,
+        match;
 
     if (bodyStyle) {
-      // Support: Android <5, Blackberry Browser 10, default Chrome in Android 4.4.x
-      // Mentioned browsers need a -webkit- prefix for transitions & animations.
-      transitions = !!('transition' in bodyStyle || 'webkitTransition' in bodyStyle);
-      animations = !!('animation' in bodyStyle || 'webkitAnimation' in bodyStyle);
+      for (var prop in bodyStyle) {
+        if (match = vendorRegex.exec(prop)) {
+          vendorPrefix = match[0];
+          vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);
+          break;
+        }
+      }
+
+      if (!vendorPrefix) {
+        vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';
+      }
+
+      transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
+      animations  = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));
+
+      if (android && (!transitions ||  !animations)) {
+        transitions = isString(bodyStyle.webkitTransition);
+        animations = isString(bodyStyle.webkitAnimation);
+      }
     }
 
 
@@ -30117,15 +28044,16 @@ function $SnifferProvider() {
       // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has
       // so let's not use the history API also
       // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
+      // jshint -W018
       history: !!(hasHistoryPushState && !(android < 4) && !boxee),
+      // jshint +W018
       hasEvent: function(event) {
-        // Support: IE 9-11 only
         // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
         // it. In particular the event is not fired when backspace or delete key are pressed or
         // when cut operation is performed.
         // IE10+ implements 'input' event but it erroneously fires under various situations,
         // e.g. when placeholder changes, or a form is focused.
-        if (event === 'input' && msie) return false;
+        if (event === 'input' && msie <= 11) return false;
 
         if (isUndefined(eventSupport[event])) {
           var divElm = document.createElement('div');
@@ -30135,6 +28063,7 @@ function $SnifferProvider() {
         return eventSupport[event];
       },
       csp: csp(),
+      vendorPrefix: vendorPrefix,
       transitions: transitions,
       animations: animations,
       android: android
@@ -30147,8 +28076,6 @@ var $templateRequestMinErr = minErr('$compile');
 /**
  * @ngdoc provider
  * @name $templateRequestProvider
- * @this
- *
  * @description
  * Used to configure the options passed to the {@link $http} service when making a template request.
  *
@@ -30202,64 +28129,57 @@ function $TemplateRequestProvider() {
    *
    * @property {number} totalPendingRequests total amount of pending template requests being downloaded.
    */
-  this.$get = ['$exceptionHandler', '$templateCache', '$http', '$q', '$sce',
-    function($exceptionHandler, $templateCache, $http, $q, $sce) {
+  this.$get = ['$templateCache', '$http', '$q', '$sce', function($templateCache, $http, $q, $sce) {
 
-      function handleRequestFn(tpl, ignoreRequestError) {
-        handleRequestFn.totalPendingRequests++;
+    function handleRequestFn(tpl, ignoreRequestError) {
+      handleRequestFn.totalPendingRequests++;
 
-        // We consider the template cache holds only trusted templates, so
-        // there's no need to go through whitelisting again for keys that already
-        // are included in there. This also makes Angular accept any script
-        // directive, no matter its name. However, we still need to unwrap trusted
-        // types.
-        if (!isString(tpl) || isUndefined($templateCache.get(tpl))) {
-          tpl = $sce.getTrustedResourceUrl(tpl);
-        }
+      // We consider the template cache holds only trusted templates, so
+      // there's no need to go through whitelisting again for keys that already
+      // are included in there. This also makes Angular accept any script
+      // directive, no matter its name. However, we still need to unwrap trusted
+      // types.
+      if (!isString(tpl) || !$templateCache.get(tpl)) {
+        tpl = $sce.getTrustedResourceUrl(tpl);
+      }
 
-        var transformResponse = $http.defaults && $http.defaults.transformResponse;
+      var transformResponse = $http.defaults && $http.defaults.transformResponse;
 
-        if (isArray(transformResponse)) {
-          transformResponse = transformResponse.filter(function(transformer) {
-            return transformer !== defaultHttpResponseTransform;
-          });
-        } else if (transformResponse === defaultHttpResponseTransform) {
-          transformResponse = null;
-        }
-
-        return $http.get(tpl, extend({
-            cache: $templateCache,
-            transformResponse: transformResponse
-          }, httpOptions))
-          .finally(function() {
-            handleRequestFn.totalPendingRequests--;
-          })
-          .then(function(response) {
-            $templateCache.put(tpl, response.data);
-            return response.data;
-          }, handleError);
-
-        function handleError(resp) {
-          if (!ignoreRequestError) {
-            resp = $templateRequestMinErr('tpload',
-                'Failed to load template: {0} (HTTP status: {1} {2})',
-                tpl, resp.status, resp.statusText);
-
-            $exceptionHandler(resp);
-          }
+      if (isArray(transformResponse)) {
+        transformResponse = transformResponse.filter(function(transformer) {
+          return transformer !== defaultHttpResponseTransform;
+        });
+      } else if (transformResponse === defaultHttpResponseTransform) {
+        transformResponse = null;
+      }
 
-          return $q.reject(resp);
+      return $http.get(tpl, extend({
+          cache: $templateCache,
+          transformResponse: transformResponse
+        }, httpOptions))
+        ['finally'](function() {
+          handleRequestFn.totalPendingRequests--;
+        })
+        .then(function(response) {
+          $templateCache.put(tpl, response.data);
+          return response.data;
+        }, handleError);
+
+      function handleError(resp) {
+        if (!ignoreRequestError) {
+          throw $templateRequestMinErr('tpload', 'Failed to load template: {0} (HTTP status: {1} {2})',
+            tpl, resp.status, resp.statusText);
         }
+        return $q.reject(resp);
       }
+    }
 
-      handleRequestFn.totalPendingRequests = 0;
+    handleRequestFn.totalPendingRequests = 0;
 
-      return handleRequestFn;
-    }
-  ];
+    return handleRequestFn;
+  }];
 }
 
-/** @this */
 function $$TestabilityProvider() {
   this.$get = ['$rootScope', '$browser', '$location',
        function($rootScope,   $browser,   $location) {
@@ -30298,7 +28218,7 @@ function $$TestabilityProvider() {
                 matches.push(binding);
               }
             } else {
-              if (bindingName.indexOf(expression) !== -1) {
+              if (bindingName.indexOf(expression) != -1) {
                 matches.push(binding);
               }
             }
@@ -30375,7 +28295,6 @@ function $$TestabilityProvider() {
   }];
 }
 
-/** @this */
 function $TimeoutProvider() {
   this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',
        function($rootScope,   $browser,   $q,   $$q,   $exceptionHandler) {
@@ -30431,7 +28350,8 @@ function $TimeoutProvider() {
         } catch (e) {
           deferred.reject(e);
           $exceptionHandler(e);
-        } finally {
+        }
+        finally {
           delete deferreds[promise.$$timeoutId];
         }
 
@@ -30459,8 +28379,6 @@ function $TimeoutProvider() {
       */
     timeout.cancel = function(promise) {
       if (promise && promise.$$timeoutId in deferreds) {
-        // Timeout cancels should not report an unhandled promise.
-        deferreds[promise.$$timeoutId].promise.catch(noop);
         deferreds[promise.$$timeoutId].reject('canceled');
         delete deferreds[promise.$$timeoutId];
         return $browser.defer.cancel(promise.$$timeoutId);
@@ -30479,7 +28397,7 @@ function $TimeoutProvider() {
 // doesn't know about mocked locations and resolves URLs to the real document - which is
 // exactly the behavior needed here.  There is little value is mocking these out for this
 // service.
-var urlParsingNode = window.document.createElement('a');
+var urlParsingNode = window.document.createElement("a");
 var originUrl = urlResolve(window.location.href);
 
 
@@ -30492,7 +28410,7 @@ var originUrl = urlResolve(window.location.href);
  * URL will be resolved into an absolute URL in the context of the application document.
  * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related
  * properties are all populated to reflect the normalized URL.  This approach has wide
- * compatibility - Safari 1+, Mozilla 1+ etc.  See
+ * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc.  See
  * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
  *
  * Implementation Notes for IE
@@ -30531,11 +28449,10 @@ var originUrl = urlResolve(window.location.href);
 function urlResolve(url) {
   var href = url;
 
-  // Support: IE 9-11 only
   if (msie) {
     // Normalize before parse.  Refer Implementation Notes on why this is
     // done in two steps on IE.
-    urlParsingNode.setAttribute('href', href);
+    urlParsingNode.setAttribute("href", href);
     href = urlParsingNode.href;
   }
 
@@ -30572,7 +28489,6 @@ function urlIsSameOrigin(requestUrl) {
 /**
  * @ngdoc service
  * @name $window
- * @this
  *
  * @description
  * A reference to the browser's `window` object. While `window`
@@ -30586,7 +28502,7 @@ function urlIsSameOrigin(requestUrl) {
  * expression.
  *
  * @example
-   <example module="windowExample" name="window-service">
+   <example module="windowExample">
      <file name="index.html">
        <script>
          angular.module('windowExample', [])
@@ -30629,14 +28545,6 @@ function $$CookieReader($document) {
   var lastCookies = {};
   var lastCookieString = '';
 
-  function safeGetCookie(rawDocument) {
-    try {
-      return rawDocument.cookie || '';
-    } catch (e) {
-      return '';
-    }
-  }
-
   function safeDecodeURIComponent(str) {
     try {
       return decodeURIComponent(str);
@@ -30647,7 +28555,7 @@ function $$CookieReader($document) {
 
   return function() {
     var cookieArray, cookie, i, index, name;
-    var currentCookieString = safeGetCookie(rawDocument);
+    var currentCookieString = rawDocument.cookie || '';
 
     if (currentCookieString !== lastCookieString) {
       lastCookieString = currentCookieString;
@@ -30674,7 +28582,6 @@ function $$CookieReader($document) {
 
 $$CookieReader.$inject = ['$document'];
 
-/** @this */
 function $$CookieReaderProvider() {
   this.$get = $$CookieReader;
 }
@@ -30754,15 +28661,9 @@ function $$CookieReaderProvider() {
  * @description
  * Filters are used for formatting data displayed to the user.
  *
- * They can be used in view templates, controllers or services.Angular comes
- * with a collection of [built-in filters](api/ng/filter), but it is easy to
- * define your own as well.
- *
  * The general syntax in templates is as follows:
  *
- * ```html
- * {{ expression [| filter_name[:parameter_value] ... ] }}
- * ```
+ *         {{ expression [| filter_name[:parameter_value] ... ] }}
  *
  * @param {String} name Name of the filter function to retrieve
  * @return {Function} the filter function
@@ -30785,7 +28686,6 @@ function $$CookieReaderProvider() {
    </example>
   */
 $FilterProvider.$inject = ['$provide'];
-/** @this */
 function $FilterProvider($provide) {
   var suffix = 'Filter';
 
@@ -30835,7 +28735,7 @@ function $FilterProvider($provide) {
     lowercaseFilter: false,
     numberFilter: false,
     orderByFilter: false,
-    uppercaseFilter: false
+    uppercaseFilter: false,
   */
 
   register('currency', currencyFilter);
@@ -30858,9 +28758,6 @@ function $FilterProvider($provide) {
  * Selects a subset of items from `array` and returns it as a new array.
  *
  * @param {Array} array The source array.
- * <div class="alert alert-info">
- *   **Note**: If the array contains objects that reference themselves, filtering is not possible.
- * </div>
  * @param {string|Object|function()} expression The predicate to be used for selecting items from
  *   `array`.
  *
@@ -30874,11 +28771,10 @@ function $FilterProvider($provide) {
  *   - `Object`: A pattern object can be used to filter specific properties on objects contained
  *     by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items
  *     which have property `name` containing "M" and property `phone` containing "1". A special
- *     property name (`$` by default) can be used (e.g. as in `{$: "text"}`) to accept a match
- *     against any property of the object or its nested object properties. That's equivalent to the
- *     simple substring match with a `string` as described above. The special property name can be
- *     overwritten, using the `anyPropertyKey` parameter.
- *     The predicate can be negated by prefixing the string with `!`.
+ *     property name `$` can be used (as in `{$:"text"}`) to accept a match against any
+ *     property of the object or its nested object properties. That's equivalent to the simple
+ *     substring match with a `string` as described above. The predicate can be negated by prefixing
+ *     the string with `!`.
  *     For example `{name: "!M"}` predicate will return an array of items which have property `name`
  *     not containing "M".
  *
@@ -30893,10 +28789,9 @@ function $FilterProvider($provide) {
  *
  *     The final result is an array of those elements that the predicate returned true for.
  *
- * @param {function(actual, expected)|true|false} [comparator] Comparator which is used in
- *     determining if values retrieved using `expression` (when it is not a function) should be
- *     considered a match based on the the expected value (from the filter expression) and actual
- *     value (from the object in the array).
+ * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in
+ *     determining if the expected value (from the filter expression) and actual value (from
+ *     the object in the array) should be considered a match.
  *
  *   Can be one of:
  *
@@ -30907,18 +28802,14 @@ function $FilterProvider($provide) {
  *   - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`.
  *     This is essentially strict comparison of expected and actual.
  *
- *   - `false`: A short hand for a function which will look for a substring match in a case
- *     insensitive way. Primitive values are converted to strings. Objects are not compared against
- *     primitives, unless they have a custom `toString` method (e.g. `Date` objects).
- *
+ *   - `false|undefined`: A short hand for a function which will look for a substring match in case
+ *     insensitive way.
  *
- *   Defaults to `false`.
- *
- * @param {string} [anyPropertyKey] The special property name that matches against any property.
- *     By default `$`.
+ *     Primitive values are converted to strings. Objects are not compared against primitives,
+ *     unless they have a custom `toString` method (e.g. `Date` objects).
  *
  * @example
-   <example name="filter-filter">
+   <example>
      <file name="index.html">
        <div ng-init="friends = [{name:'John', phone:'555-1276'},
                                 {name:'Mary', phone:'800-BIG-MARY'},
@@ -30985,9 +28876,8 @@ function $FilterProvider($provide) {
      </file>
    </example>
  */
-
 function filterFilter() {
-  return function(array, expression, comparator, anyPropertyKey) {
+  return function(array, expression, comparator) {
     if (!isArrayLike(array)) {
       if (array == null) {
         return array;
@@ -30996,7 +28886,6 @@ function filterFilter() {
       }
     }
 
-    anyPropertyKey = anyPropertyKey || '$';
     var expressionType = getTypeForFilter(expression);
     var predicateFn;
     var matchAgainstAnyProp;
@@ -31010,9 +28899,10 @@ function filterFilter() {
       case 'number':
       case 'string':
         matchAgainstAnyProp = true;
-        // falls through
+        //jshint -W086
       case 'object':
-        predicateFn = createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp);
+        //jshint +W086
+        predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp);
         break;
       default:
         return array;
@@ -31023,8 +28913,8 @@ function filterFilter() {
 }
 
 // Helper functions for `filterFilter`
-function createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp) {
-  var shouldMatchPrimitives = isObject(expression) && (anyPropertyKey in expression);
+function createPredicateFn(expression, comparator, matchAgainstAnyProp) {
+  var shouldMatchPrimitives = isObject(expression) && ('$' in expression);
   var predicateFn;
 
   if (comparator === true) {
@@ -31052,25 +28942,25 @@ function createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstA
 
   predicateFn = function(item) {
     if (shouldMatchPrimitives && !isObject(item)) {
-      return deepCompare(item, expression[anyPropertyKey], comparator, anyPropertyKey, false);
+      return deepCompare(item, expression.$, comparator, false);
     }
-    return deepCompare(item, expression, comparator, anyPropertyKey, matchAgainstAnyProp);
+    return deepCompare(item, expression, comparator, matchAgainstAnyProp);
   };
 
   return predicateFn;
 }
 
-function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstAnyProp, dontMatchWholeObject) {
+function deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatchWholeObject) {
   var actualType = getTypeForFilter(actual);
   var expectedType = getTypeForFilter(expected);
 
   if ((expectedType === 'string') && (expected.charAt(0) === '!')) {
-    return !deepCompare(actual, expected.substring(1), comparator, anyPropertyKey, matchAgainstAnyProp);
+    return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp);
   } else if (isArray(actual)) {
     // In case `actual` is an array, consider it a match
     // if ANY of it's items matches `expected`
     return actual.some(function(item) {
-      return deepCompare(item, expected, comparator, anyPropertyKey, matchAgainstAnyProp);
+      return deepCompare(item, expected, comparator, matchAgainstAnyProp);
     });
   }
 
@@ -31079,14 +28969,11 @@ function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstA
       var key;
       if (matchAgainstAnyProp) {
         for (key in actual) {
-          // Under certain, rare, circumstances, key may not be a string and `charAt` will be undefined
-          // See: https://github.com/angular/angular.js/issues/15644
-          if (key.charAt && (key.charAt(0) !== '$') &&
-              deepCompare(actual[key], expected, comparator, anyPropertyKey, true)) {
+          if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, true)) {
             return true;
           }
         }
-        return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, anyPropertyKey, false);
+        return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, false);
       } else if (expectedType === 'object') {
         for (key in expected) {
           var expectedVal = expected[key];
@@ -31094,9 +28981,9 @@ function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstA
             continue;
           }
 
-          var matchAnyProperty = key === anyPropertyKey;
+          var matchAnyProperty = key === '$';
           var actualVal = matchAnyProperty ? actual : actual[key];
-          if (!deepCompare(actualVal, expectedVal, comparator, anyPropertyKey, matchAnyProperty, matchAnyProperty)) {
+          if (!deepCompare(actualVal, expectedVal, comparator, matchAnyProperty, matchAnyProperty)) {
             return false;
           }
         }
@@ -31104,6 +28991,7 @@ function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstA
       } else {
         return comparator(actual, expected);
       }
+      break;
     case 'function':
       return false;
     default:
@@ -31136,7 +29024,7 @@ var ZERO_CHAR = '0';
  *
  *
  * @example
-   <example module="currencyExample" name="currency-filter">
+   <example module="currencyExample">
      <file name="index.html">
        <script>
          angular.module('currencyExample', [])
@@ -31147,7 +29035,7 @@ var ZERO_CHAR = '0';
        <div ng-controller="ExampleController">
          <input type="number" ng-model="amount" aria-label="amount"> <br>
          default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
-         custom currency identifier (USD$): <span id="currency-custom">{{amount | currency:"USD$"}}</span><br>
+         custom currency identifier (USD$): <span id="currency-custom">{{amount | currency:"USD$"}}</span>
          no fractions (0): <span id="currency-no-fractions">{{amount | currency:"USD$":0}}</span>
        </div>
      </file>
@@ -31158,7 +29046,7 @@ var ZERO_CHAR = '0';
          expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235');
        });
        it('should update', function() {
-         if (browser.params.browser === 'safari') {
+         if (browser.params.browser == 'safari') {
            // Safari does not understand the minus key. See
            // https://github.com/angular/protractor/issues/481
            return;
@@ -31214,7 +29102,7 @@ function currencyFilter($locale) {
  *                   include "," group separators after each third digit).
  *
  * @example
-   <example module="numberFilterExample" name="number-filter">
+   <example module="numberFilterExample">
      <file name="index.html">
        <script>
          angular.module('numberFilterExample', [])
@@ -31293,16 +29181,16 @@ function parse(numStr) {
   }
 
   // Count the number of leading zeros.
-  for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) { /* empty */ }
+  for (i = 0; numStr.charAt(i) == ZERO_CHAR; i++) {/* jshint noempty: false */}
 
-  if (i === (zeros = numStr.length)) {
+  if (i == (zeros = numStr.length)) {
     // The digits are all zero.
     digits = [0];
     numberOfIntegerDigits = 1;
   } else {
     // Count the number of trailing zeros
     zeros--;
-    while (numStr.charAt(zeros) === ZERO_CHAR) zeros--;
+    while (numStr.charAt(zeros) == ZERO_CHAR) zeros--;
 
     // Trailing zeros are insignificant so ignore them
     numberOfIntegerDigits -= i;
@@ -31433,7 +29321,7 @@ function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
 
     // extract decimals digits
     if (integerLen > 0) {
-      decimals = digits.splice(integerLen, digits.length);
+      decimals = digits.splice(integerLen);
     } else {
       decimals = digits;
       digits = [0];
@@ -31442,10 +29330,10 @@ function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
     // format the integer digits with grouping separators
     var groups = [];
     if (digits.length >= pattern.lgSize) {
-      groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
+      groups.unshift(digits.splice(-pattern.lgSize).join(''));
     }
     while (digits.length > pattern.gSize) {
-      groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
+      groups.unshift(digits.splice(-pattern.gSize).join(''));
     }
     if (digits.length) {
       groups.unshift(digits.join(''));
@@ -31494,7 +29382,7 @@ function dateGetter(name, size, offset, trim, negWrap) {
     if (offset > 0 || value > -offset) {
       value += offset;
     }
-    if (value === 0 && offset === -12) value = 12;
+    if (value === 0 && offset == -12) value = 12;
     return padNumber(value, size, trim, negWrap);
   };
 }
@@ -31511,7 +29399,7 @@ function dateStrGetter(name, shortForm, standAlone) {
 
 function timeZoneGetter(date, formats, offset) {
   var zone = -1 * offset;
-  var paddedZone = (zone >= 0) ? '+' : '';
+  var paddedZone = (zone >= 0) ? "+" : "";
 
   paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
                 padNumber(Math.abs(zone % 60), 2);
@@ -31591,8 +29479,8 @@ var DATE_FORMATS = {
      GGGG: longEraGetter
 };
 
-var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,
-    NUMBER_STRING = /^-?\d+$/;
+var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,
+    NUMBER_STRING = /^\-?\d+$/;
 
 /**
  * @ngdoc filter
@@ -31650,8 +29538,6 @@ var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+
  *   `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence
  *   (e.g. `"h 'o''clock'"`).
  *
- *   Any other characters in the `format` string will be output as-is.
- *
  * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
  *    number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its
  *    shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
@@ -31665,7 +29551,7 @@ var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+
  * @returns {string} Formatted string or the input if input is not recognized as date/millis.
  *
  * @example
-   <example name="filter-date">
+   <example>
      <file name="index.html">
        <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
            <span>{{1288323623006 | date:'medium'}}</span><br>
@@ -31681,7 +29567,7 @@ var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+
          expect(element(by.binding("1288323623006 | date:'medium'")).getText()).
             toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
          expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()).
-            toMatch(/2010-10-2\d \d{2}:\d{2}:\d{2} (-|\+)?\d{4}/);
+            toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
          expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()).
             toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
          expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()).
@@ -31698,7 +29584,7 @@ function dateFilter($locale) {
                      // 1        2       3         4          5          6          7          8  9     10      11
   function jsonStringToDate(string) {
     var match;
-    if ((match = string.match(R_ISO8601_STR))) {
+    if (match = string.match(R_ISO8601_STR)) {
       var date = new Date(0),
           tzHour = 0,
           tzMin  = 0,
@@ -31759,7 +29645,7 @@ function dateFilter($locale) {
     forEach(parts, function(value) {
       fn = DATE_FORMATS[value];
       text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)
-                 : value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
+                 : value === "''" ? "'" : value.replace(/(^'|'$)/g, '').replace(/''/g, "'");
     });
 
     return text;
@@ -31784,15 +29670,15 @@ function dateFilter($locale) {
  *
  *
  * @example
-   <example name="filter-json">
+   <example>
      <file name="index.html">
        <pre id="default-spacing">{{ {'name':'value'} | json }}</pre>
        <pre id="custom-spacing">{{ {'name':'value'} | json:4 }}</pre>
      </file>
      <file name="protractor.js" type="protractor">
        it('should jsonify filtered objects', function() {
-         expect(element(by.id('default-spacing')).getText()).toMatch(/\{\n {2}"name": ?"value"\n}/);
-         expect(element(by.id('custom-spacing')).getText()).toMatch(/\{\n {4}"name": ?"value"\n}/);
+         expect(element(by.id('default-spacing')).getText()).toMatch(/\{\n  "name": ?"value"\n}/);
+         expect(element(by.id('custom-spacing')).getText()).toMatch(/\{\n    "name": ?"value"\n}/);
        });
      </file>
    </example>
@@ -31835,25 +29721,24 @@ var uppercaseFilter = valueFn(uppercase);
  * @kind function
  *
  * @description
- * Creates a new array or string containing only a specified number of elements. The elements are
- * taken from either the beginning or the end of the source array, string or number, as specified by
- * the value and sign (positive or negative) of `limit`. Other array-like objects are also supported
- * (e.g. array subclasses, NodeLists, jqLite/jQuery collections etc). If a number is used as input,
- * it is converted to a string.
- *
- * @param {Array|ArrayLike|string|number} input - Array/array-like, string or number to be limited.
- * @param {string|number} limit - The length of the returned array or string. If the `limit` number
+ * Creates a new array or string containing only a specified number of elements. The elements
+ * are taken from either the beginning or the end of the source array, string or number, as specified by
+ * the value and sign (positive or negative) of `limit`. If a number is used as input, it is
+ * converted to a string.
+ *
+ * @param {Array|string|number} input Source array, string or number to be limited.
+ * @param {string|number} limit The length of the returned array or string. If the `limit` number
  *     is positive, `limit` number of items from the beginning of the source array/string are copied.
  *     If the number is negative, `limit` number  of items from the end of the source array/string
  *     are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined,
  *     the input will be returned unchanged.
- * @param {(string|number)=} begin - Index at which to begin limitation. As a negative index,
- *     `begin` indicates an offset from the end of `input`. Defaults to `0`.
- * @returns {Array|string} A new sub-array or substring of length `limit` or less if the input had
- *     less than `limit` elements.
+ * @param {(string|number)=} begin Index at which to begin limitation. As a negative index, `begin`
+ *     indicates an offset from the end of `input`. Defaults to `0`.
+ * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array
+ *     had less than `limit` elements.
  *
  * @example
-   <example module="limitToExample" name="limit-to-filter">
+   <example module="limitToExample">
      <file name="index.html">
        <script>
          angular.module('limitToExample', [])
@@ -31935,163 +29820,70 @@ function limitToFilter() {
     } else {
       limit = toInt(limit);
     }
-    if (isNumberNaN(limit)) return input;
+    if (isNaN(limit)) return input;
 
     if (isNumber(input)) input = input.toString();
-    if (!isArrayLike(input)) return input;
+    if (!isArray(input) && !isString(input)) return input;
 
     begin = (!begin || isNaN(begin)) ? 0 : toInt(begin);
     begin = (begin < 0) ? Math.max(0, input.length + begin) : begin;
 
     if (limit >= 0) {
-      return sliceFn(input, begin, begin + limit);
+      return input.slice(begin, begin + limit);
     } else {
       if (begin === 0) {
-        return sliceFn(input, limit, input.length);
+        return input.slice(limit, input.length);
       } else {
-        return sliceFn(input, Math.max(0, begin + limit), begin);
+        return input.slice(Math.max(0, begin + limit), begin);
       }
     }
   };
 }
 
-function sliceFn(input, begin, end) {
-  if (isString(input)) return input.slice(begin, end);
-
-  return slice.call(input, begin, end);
-}
-
 /**
  * @ngdoc filter
  * @name orderBy
  * @kind function
  *
  * @description
- * Returns an array containing the items from the specified `collection`, ordered by a `comparator`
- * function based on the values computed using the `expression` predicate.
- *
- * For example, `[{id: 'foo'}, {id: 'bar'}] | orderBy:'id'` would result in
- * `[{id: 'bar'}, {id: 'foo'}]`.
- *
- * The `collection` can be an Array or array-like object (e.g. NodeList, jQuery object, TypedArray,
- * String, etc).
- *
- * The `expression` can be a single predicate, or a list of predicates each serving as a tie-breaker
- * for the preceding one. The `expression` is evaluated against each item and the output is used
- * for comparing with other items.
- *
- * You can change the sorting order by setting `reverse` to `true`. By default, items are sorted in
- * ascending order.
- *
- * The comparison is done using the `comparator` function. If none is specified, a default, built-in
- * comparator is used (see below for details - in a nutshell, it compares numbers numerically and
- * strings alphabetically).
- *
- * ### Under the hood
+ * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically
+ * for strings and numerically for numbers. Note: if you notice numbers are not being sorted
+ * as expected, make sure they are actually being saved as numbers and not strings.
+ * Array-like values (e.g. NodeLists, jQuery objects, TypedArrays, Strings, etc) are also supported.
  *
- * Ordering the specified `collection` happens in two phases:
- *
- * 1. All items are passed through the predicate (or predicates), and the returned values are saved
- *    along with their type (`string`, `number` etc). For example, an item `{label: 'foo'}`, passed
- *    through a predicate that extracts the value of the `label` property, would be transformed to:
- *    ```
- *    {
- *      value: 'foo',
- *      type: 'string',
- *      index: ...
- *    }
- *    ```
- * 2. The comparator function is used to sort the items, based on the derived values, types and
- *    indices.
- *
- * If you use a custom comparator, it will be called with pairs of objects of the form
- * `{value: ..., type: '...', index: ...}` and is expected to return `0` if the objects are equal
- * (as far as the comparator is concerned), `-1` if the 1st one should be ranked higher than the
- * second, or `1` otherwise.
- *
- * In order to ensure that the sorting will be deterministic across platforms, if none of the
- * specified predicates can distinguish between two items, `orderBy` will automatically introduce a
- * dummy predicate that returns the item's index as `value`.
- * (If you are using a custom comparator, make sure it can handle this predicate as well.)
- *
- * Finally, in an attempt to simplify things, if a predicate returns an object as the extracted
- * value for an item, `orderBy` will try to convert that object to a primitive value, before passing
- * it to the comparator. The following rules govern the conversion:
- *
- * 1. If the object has a `valueOf()` method that returns a primitive, its return value will be
- *    used instead.<br />
- *    (If the object has a `valueOf()` method that returns another object, then the returned object
- *    will be used in subsequent steps.)
- * 2. If the object has a custom `toString()` method (i.e. not the one inherited from `Object`) that
- *    returns a primitive, its return value will be used instead.<br />
- *    (If the object has a `toString()` method that returns another object, then the returned object
- *    will be used in subsequent steps.)
- * 3. No conversion; the object itself is used.
- *
- * ### The default comparator
- *
- * The default, built-in comparator should be sufficient for most usecases. In short, it compares
- * numbers numerically, strings alphabetically (and case-insensitively), for objects falls back to
- * using their index in the original collection, and sorts values of different types by type.
- *
- * More specifically, it follows these steps to determine the relative order of items:
- *
- * 1. If the compared values are of different types, compare the types themselves alphabetically.
- * 2. If both values are of type `string`, compare them alphabetically in a case- and
- *    locale-insensitive way.
- * 3. If both values are objects, compare their indices instead.
- * 4. Otherwise, return:
- *    -  `0`, if the values are equal (by strict equality comparison, i.e. using `===`).
- *    - `-1`, if the 1st value is "less than" the 2nd value (compared using the `<` operator).
- *    -  `1`, otherwise.
- *
- * **Note:** If you notice numbers not being sorted as expected, make sure they are actually being
- *           saved as numbers and not strings.
- * **Note:** For the purpose of sorting, `null` values are treated as the string `'null'` (i.e.
- *           `type: 'string'`, `value: 'null'`). This may cause unexpected sort order relative to
- *           other values.
- *
- * @param {Array|ArrayLike} collection - The collection (array or array-like object) to sort.
- * @param {(Function|string|Array.<Function|string>)=} expression - A predicate (or list of
- *    predicates) to be used by the comparator to determine the order of elements.
+ * @param {Array} array The array (or array-like object) to sort.
+ * @param {function(*)|string|Array.<(function(*)|string)>=} expression A predicate to be
+ *    used by the comparator to determine the order of elements.
  *
  *    Can be one of:
  *
- *    - `Function`: A getter function. This function will be called with each item as argument and
- *      the return value will be used for sorting.
- *    - `string`: An Angular expression. This expression will be evaluated against each item and the
- *      result will be used for sorting. For example, use `'label'` to sort by a property called
- *      `label` or `'label.substring(0, 3)'` to sort by the first 3 characters of the `label`
- *      property.<br />
- *      (The result of a constant expression is interpreted as a property name to be used for
- *      comparison. For example, use `'"special name"'` (note the extra pair of quotes) to sort by a
- *      property called `special name`.)<br />
- *      An expression can be optionally prefixed with `+` or `-` to control the sorting direction,
- *      ascending or descending. For example, `'+label'` or `'-label'`. If no property is provided,
- *      (e.g. `'+'` or `'-'`), the collection element itself is used in comparisons.
- *    - `Array`: An array of function and/or string predicates. If a predicate cannot determine the
- *      relative order of two items, the next predicate is used as a tie-breaker.
- *
- * **Note:** If the predicate is missing or empty then it defaults to `'+'`.
+ *    - `function`: Getter function. The result of this function will be sorted using the
+ *      `<`, `===`, `>` operator.
+ *    - `string`: An Angular expression. The result of this expression is used to compare elements
+ *      (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by
+ *      3 first characters of a property called `name`). The result of a constant expression
+ *      is interpreted as a property name to be used in comparisons (for example `"special name"`
+ *      to sort object by the value of their `special name` property). An expression can be
+ *      optionally prefixed with `+` or `-` to control ascending or descending sort order
+ *      (for example, `+name` or `-name`). If no property is provided, (e.g. `'+'`) then the array
+ *      element itself is used to compare where sorting.
+ *    - `Array`: An array of function or string predicates. The first predicate in the array
+ *      is used for sorting, but when two items are equivalent, the next predicate is used.
  *
- * @param {boolean=} reverse - If `true`, reverse the sorting order.
- * @param {(Function)=} comparator - The comparator function used to determine the relative order of
- *    value pairs. If omitted, the built-in comparator will be used.
+ *    If the predicate is missing or empty then it defaults to `'+'`.
  *
- * @returns {Array} - The sorted array.
+ * @param {boolean=} reverse Reverse the order of the array.
+ * @returns {Array} Sorted copy of the source array.
  *
  *
  * @example
- * ### Ordering a table with `ngRepeat`
- *
- * The example below demonstrates a simple {@link ngRepeat ngRepeat}, where the data is sorted by
- * age in descending order (expression is set to `'-age'`). The `comparator` is not set, which means
- * it defaults to the built-in comparator.
- *
-   <example name="orderBy-static" module="orderByExample1">
+ * The example below demonstrates a simple ngRepeat, where the data is sorted
+ * by age in descending order (predicate is set to `'-age'`).
+ * `reverse` is not set, which means it defaults to `false`.
+   <example module="orderByExample">
      <file name="index.html">
        <div ng-controller="ExampleController">
-         <table class="friends">
+         <table class="friend">
            <tr>
              <th>Name</th>
              <th>Phone Number</th>
@@ -32106,77 +29898,43 @@ function sliceFn(input, begin, end) {
        </div>
      </file>
      <file name="script.js">
-       angular.module('orderByExample1', [])
+       angular.module('orderByExample', [])
          .controller('ExampleController', ['$scope', function($scope) {
-           $scope.friends = [
-             {name: 'John',   phone: '555-1212',  age: 10},
-             {name: 'Mary',   phone: '555-9876',  age: 19},
-             {name: 'Mike',   phone: '555-4321',  age: 21},
-             {name: 'Adam',   phone: '555-5678',  age: 35},
-             {name: 'Julie',  phone: '555-8765',  age: 29}
-           ];
+           $scope.friends =
+               [{name:'John', phone:'555-1212', age:10},
+                {name:'Mary', phone:'555-9876', age:19},
+                {name:'Mike', phone:'555-4321', age:21},
+                {name:'Adam', phone:'555-5678', age:35},
+                {name:'Julie', phone:'555-8765', age:29}];
          }]);
      </file>
-     <file name="style.css">
-       .friends {
-         border-collapse: collapse;
-       }
-
-       .friends th {
-         border-bottom: 1px solid;
-       }
-       .friends td, .friends th {
-         border-left: 1px solid;
-         padding: 5px 10px;
-       }
-       .friends td:first-child, .friends th:first-child {
-         border-left: none;
-       }
-     </file>
-     <file name="protractor.js" type="protractor">
-       // Element locators
-       var names = element.all(by.repeater('friends').column('friend.name'));
-
-       it('should sort friends by age in reverse order', function() {
-         expect(names.get(0).getText()).toBe('Adam');
-         expect(names.get(1).getText()).toBe('Julie');
-         expect(names.get(2).getText()).toBe('Mike');
-         expect(names.get(3).getText()).toBe('Mary');
-         expect(names.get(4).getText()).toBe('John');
-       });
-     </file>
    </example>
- * <hr />
  *
+ * The predicate and reverse parameters can be controlled dynamically through scope properties,
+ * as shown in the next example.
  * @example
- * ### Changing parameters dynamically
- *
- * All parameters can be changed dynamically. The next example shows how you can make the columns of
- * a table sortable, by binding the `expression` and `reverse` parameters to scope properties.
- *
-   <example name="orderBy-dynamic" module="orderByExample2">
+   <example module="orderByExample">
      <file name="index.html">
        <div ng-controller="ExampleController">
-         <pre>Sort by = {{propertyName}}; reverse = {{reverse}}</pre>
-         <hr/>
-         <button ng-click="propertyName = null; reverse = false">Set to unsorted</button>
+         <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
          <hr/>
-         <table class="friends">
+         <button ng-click="predicate=''">Set to unsorted</button>
+         <table class="friend">
            <tr>
-             <th>
-               <button ng-click="sortBy('name')">Name</button>
-               <span class="sortorder" ng-show="propertyName === 'name'" ng-class="{reverse: reverse}"></span>
-             </th>
-             <th>
-               <button ng-click="sortBy('phone')">Phone Number</button>
-               <span class="sortorder" ng-show="propertyName === 'phone'" ng-class="{reverse: reverse}"></span>
-             </th>
-             <th>
-               <button ng-click="sortBy('age')">Age</button>
-               <span class="sortorder" ng-show="propertyName === 'age'" ng-class="{reverse: reverse}"></span>
-             </th>
+            <th>
+                <button ng-click="order('name')">Name</button>
+                <span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
+            </th>
+            <th>
+                <button ng-click="order('phone')">Phone Number</button>
+                <span class="sortorder" ng-show="predicate === 'phone'" ng-class="{reverse:reverse}"></span>
+            </th>
+            <th>
+                <button ng-click="order('age')">Age</button>
+                <span class="sortorder" ng-show="predicate === 'age'" ng-class="{reverse:reverse}"></span>
+            </th>
            </tr>
-           <tr ng-repeat="friend in friends | orderBy:propertyName:reverse">
+           <tr ng-repeat="friend in friends | orderBy:predicate:reverse">
              <td>{{friend.name}}</td>
              <td>{{friend.phone}}</td>
              <td>{{friend.age}}</td>
@@ -32185,335 +29943,100 @@ function sliceFn(input, begin, end) {
        </div>
      </file>
      <file name="script.js">
-       angular.module('orderByExample2', [])
+       angular.module('orderByExample', [])
          .controller('ExampleController', ['$scope', function($scope) {
-           var friends = [
-             {name: 'John',   phone: '555-1212',  age: 10},
-             {name: 'Mary',   phone: '555-9876',  age: 19},
-             {name: 'Mike',   phone: '555-4321',  age: 21},
-             {name: 'Adam',   phone: '555-5678',  age: 35},
-             {name: 'Julie',  phone: '555-8765',  age: 29}
-           ];
-
-           $scope.propertyName = 'age';
+           $scope.friends =
+               [{name:'John', phone:'555-1212', age:10},
+                {name:'Mary', phone:'555-9876', age:19},
+                {name:'Mike', phone:'555-4321', age:21},
+                {name:'Adam', phone:'555-5678', age:35},
+                {name:'Julie', phone:'555-8765', age:29}];
+           $scope.predicate = 'age';
            $scope.reverse = true;
-           $scope.friends = friends;
-
-           $scope.sortBy = function(propertyName) {
-             $scope.reverse = ($scope.propertyName === propertyName) ? !$scope.reverse : false;
-             $scope.propertyName = propertyName;
+           $scope.order = function(predicate) {
+             $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
+             $scope.predicate = predicate;
            };
          }]);
-     </file>
+      </file>
      <file name="style.css">
-       .friends {
-         border-collapse: collapse;
-       }
-
-       .friends th {
-         border-bottom: 1px solid;
-       }
-       .friends td, .friends th {
-         border-left: 1px solid;
-         padding: 5px 10px;
-       }
-       .friends td:first-child, .friends th:first-child {
-         border-left: none;
-       }
-
        .sortorder:after {
-         content: '\25b2';   // BLACK UP-POINTING TRIANGLE
+         content: '\25b2';
        }
        .sortorder.reverse:after {
-         content: '\25bc';   // BLACK DOWN-POINTING TRIANGLE
+         content: '\25bc';
        }
      </file>
-     <file name="protractor.js" type="protractor">
-       // Element locators
-       var unsortButton = element(by.partialButtonText('unsorted'));
-       var nameHeader = element(by.partialButtonText('Name'));
-       var phoneHeader = element(by.partialButtonText('Phone'));
-       var ageHeader = element(by.partialButtonText('Age'));
-       var firstName = element(by.repeater('friends').column('friend.name').row(0));
-       var lastName = element(by.repeater('friends').column('friend.name').row(4));
-
-       it('should sort friends by some property, when clicking on the column header', function() {
-         expect(firstName.getText()).toBe('Adam');
-         expect(lastName.getText()).toBe('John');
-
-         phoneHeader.click();
-         expect(firstName.getText()).toBe('John');
-         expect(lastName.getText()).toBe('Mary');
-
-         nameHeader.click();
-         expect(firstName.getText()).toBe('Adam');
-         expect(lastName.getText()).toBe('Mike');
-
-         ageHeader.click();
-         expect(firstName.getText()).toBe('John');
-         expect(lastName.getText()).toBe('Adam');
-       });
-
-       it('should sort friends in reverse order, when clicking on the same column', function() {
-         expect(firstName.getText()).toBe('Adam');
-         expect(lastName.getText()).toBe('John');
-
-         ageHeader.click();
-         expect(firstName.getText()).toBe('John');
-         expect(lastName.getText()).toBe('Adam');
-
-         ageHeader.click();
-         expect(firstName.getText()).toBe('Adam');
-         expect(lastName.getText()).toBe('John');
-       });
-
-       it('should restore the original order, when clicking "Set to unsorted"', function() {
-         expect(firstName.getText()).toBe('Adam');
-         expect(lastName.getText()).toBe('John');
-
-         unsortButton.click();
-         expect(firstName.getText()).toBe('John');
-         expect(lastName.getText()).toBe('Julie');
-       });
-     </file>
    </example>
- * <hr />
  *
- * @example
- * ### Using `orderBy` inside a controller
+ * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the
+ * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the
+ * desired parameters.
  *
- * It is also possible to call the `orderBy` filter manually, by injecting `orderByFilter`, and
- * calling it with the desired parameters. (Alternatively, you could inject the `$filter` factory
- * and retrieve the `orderBy` filter with `$filter('orderBy')`.)
+ * Example:
  *
-   <example name="orderBy-call-manually" module="orderByExample3">
-     <file name="index.html">
-       <div ng-controller="ExampleController">
-         <pre>Sort by = {{propertyName}}; reverse = {{reverse}}</pre>
-         <hr/>
-         <button ng-click="sortBy(null)">Set to unsorted</button>
-         <hr/>
-         <table class="friends">
-           <tr>
-             <th>
-               <button ng-click="sortBy('name')">Name</button>
-               <span class="sortorder" ng-show="propertyName === 'name'" ng-class="{reverse: reverse}"></span>
-             </th>
-             <th>
-               <button ng-click="sortBy('phone')">Phone Number</button>
-               <span class="sortorder" ng-show="propertyName === 'phone'" ng-class="{reverse: reverse}"></span>
-             </th>
-             <th>
-               <button ng-click="sortBy('age')">Age</button>
-               <span class="sortorder" ng-show="propertyName === 'age'" ng-class="{reverse: reverse}"></span>
-             </th>
-           </tr>
-           <tr ng-repeat="friend in friends">
-             <td>{{friend.name}}</td>
-             <td>{{friend.phone}}</td>
-             <td>{{friend.age}}</td>
-           </tr>
-         </table>
-       </div>
-     </file>
-     <file name="script.js">
-       angular.module('orderByExample3', [])
-         .controller('ExampleController', ['$scope', 'orderByFilter', function($scope, orderBy) {
-           var friends = [
-             {name: 'John',   phone: '555-1212',  age: 10},
-             {name: 'Mary',   phone: '555-9876',  age: 19},
-             {name: 'Mike',   phone: '555-4321',  age: 21},
-             {name: 'Adam',   phone: '555-5678',  age: 35},
-             {name: 'Julie',  phone: '555-8765',  age: 29}
-           ];
-
-           $scope.propertyName = 'age';
-           $scope.reverse = true;
-           $scope.friends = orderBy(friends, $scope.propertyName, $scope.reverse);
-
-           $scope.sortBy = function(propertyName) {
-             $scope.reverse = (propertyName !== null && $scope.propertyName === propertyName)
-                 ? !$scope.reverse : false;
-             $scope.propertyName = propertyName;
-             $scope.friends = orderBy(friends, $scope.propertyName, $scope.reverse);
-           };
-         }]);
-     </file>
-     <file name="style.css">
-       .friends {
-         border-collapse: collapse;
-       }
+ * @example
+  <example module="orderByExample">
+    <file name="index.html">
+    <div ng-controller="ExampleController">
+      <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
+      <table class="friend">
+        <tr>
+          <th>
+              <button ng-click="order('name')">Name</button>
+              <span class="sortorder" ng-show="predicate === 'name'" ng-class="{reverse:reverse}"></span>
+          </th>
+          <th>
+              <button ng-click="order('phone')">Phone Number</button>
+              <span class="sortorder" ng-show="predicate === 'phone'" ng-class="{reverse:reverse}"></span>
+          </th>
+          <th>
+              <button ng-click="order('age')">Age</button>
+              <span class="sortorder" ng-show="predicate === 'age'" ng-class="{reverse:reverse}"></span>
+          </th>
+        </tr>
+        <tr ng-repeat="friend in friends">
+          <td>{{friend.name}}</td>
+          <td>{{friend.phone}}</td>
+          <td>{{friend.age}}</td>
+        </tr>
+      </table>
+    </div>
+    </file>
 
-       .friends th {
-         border-bottom: 1px solid;
-       }
-       .friends td, .friends th {
-         border-left: 1px solid;
-         padding: 5px 10px;
-       }
-       .friends td:first-child, .friends th:first-child {
-         border-left: none;
-       }
+    <file name="script.js">
+      angular.module('orderByExample', [])
+        .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {
+          var orderBy = $filter('orderBy');
+          $scope.friends = [
+            { name: 'John',    phone: '555-1212',    age: 10 },
+            { name: 'Mary',    phone: '555-9876',    age: 19 },
+            { name: 'Mike',    phone: '555-4321',    age: 21 },
+            { name: 'Adam',    phone: '555-5678',    age: 35 },
+            { name: 'Julie',   phone: '555-8765',    age: 29 }
+          ];
+          $scope.order = function(predicate) {
+            $scope.predicate = predicate;
+            $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
+            $scope.friends = orderBy($scope.friends, predicate, $scope.reverse);
+          };
+          $scope.order('age', true);
+        }]);
+    </file>
 
+    <file name="style.css">
        .sortorder:after {
-         content: '\25b2';   // BLACK UP-POINTING TRIANGLE
+         content: '\25b2';
        }
        .sortorder.reverse:after {
-         content: '\25bc';   // BLACK DOWN-POINTING TRIANGLE
-       }
-     </file>
-     <file name="protractor.js" type="protractor">
-       // Element locators
-       var unsortButton = element(by.partialButtonText('unsorted'));
-       var nameHeader = element(by.partialButtonText('Name'));
-       var phoneHeader = element(by.partialButtonText('Phone'));
-       var ageHeader = element(by.partialButtonText('Age'));
-       var firstName = element(by.repeater('friends').column('friend.name').row(0));
-       var lastName = element(by.repeater('friends').column('friend.name').row(4));
-
-       it('should sort friends by some property, when clicking on the column header', function() {
-         expect(firstName.getText()).toBe('Adam');
-         expect(lastName.getText()).toBe('John');
-
-         phoneHeader.click();
-         expect(firstName.getText()).toBe('John');
-         expect(lastName.getText()).toBe('Mary');
-
-         nameHeader.click();
-         expect(firstName.getText()).toBe('Adam');
-         expect(lastName.getText()).toBe('Mike');
-
-         ageHeader.click();
-         expect(firstName.getText()).toBe('John');
-         expect(lastName.getText()).toBe('Adam');
-       });
-
-       it('should sort friends in reverse order, when clicking on the same column', function() {
-         expect(firstName.getText()).toBe('Adam');
-         expect(lastName.getText()).toBe('John');
-
-         ageHeader.click();
-         expect(firstName.getText()).toBe('John');
-         expect(lastName.getText()).toBe('Adam');
-
-         ageHeader.click();
-         expect(firstName.getText()).toBe('Adam');
-         expect(lastName.getText()).toBe('John');
-       });
-
-       it('should restore the original order, when clicking "Set to unsorted"', function() {
-         expect(firstName.getText()).toBe('Adam');
-         expect(lastName.getText()).toBe('John');
-
-         unsortButton.click();
-         expect(firstName.getText()).toBe('John');
-         expect(lastName.getText()).toBe('Julie');
-       });
-     </file>
-   </example>
- * <hr />
- *
- * @example
- * ### Using a custom comparator
- *
- * If you have very specific requirements about the way items are sorted, you can pass your own
- * comparator function. For example, you might need to compare some strings in a locale-sensitive
- * way. (When specifying a custom comparator, you also need to pass a value for the `reverse`
- * argument - passing `false` retains the default sorting order, i.e. ascending.)
- *
-   <example name="orderBy-custom-comparator" module="orderByExample4">
-     <file name="index.html">
-       <div ng-controller="ExampleController">
-         <div class="friends-container custom-comparator">
-           <h3>Locale-sensitive Comparator</h3>
-           <table class="friends">
-             <tr>
-               <th>Name</th>
-               <th>Favorite Letter</th>
-             </tr>
-             <tr ng-repeat="friend in friends | orderBy:'favoriteLetter':false:localeSensitiveComparator">
-               <td>{{friend.name}}</td>
-               <td>{{friend.favoriteLetter}}</td>
-             </tr>
-           </table>
-         </div>
-         <div class="friends-container default-comparator">
-           <h3>Default Comparator</h3>
-           <table class="friends">
-             <tr>
-               <th>Name</th>
-               <th>Favorite Letter</th>
-             </tr>
-             <tr ng-repeat="friend in friends | orderBy:'favoriteLetter'">
-               <td>{{friend.name}}</td>
-               <td>{{friend.favoriteLetter}}</td>
-             </tr>
-           </table>
-         </div>
-       </div>
-     </file>
-     <file name="script.js">
-       angular.module('orderByExample4', [])
-         .controller('ExampleController', ['$scope', function($scope) {
-           $scope.friends = [
-             {name: 'John',   favoriteLetter: 'Ä'},
-             {name: 'Mary',   favoriteLetter: 'Ãœ'},
-             {name: 'Mike',   favoriteLetter: 'Ö'},
-             {name: 'Adam',   favoriteLetter: 'H'},
-             {name: 'Julie',  favoriteLetter: 'Z'}
-           ];
-
-           $scope.localeSensitiveComparator = function(v1, v2) {
-             // If we don't get strings, just compare by index
-             if (v1.type !== 'string' || v2.type !== 'string') {
-               return (v1.index < v2.index) ? -1 : 1;
-             }
-
-             // Compare strings alphabetically, taking locale into account
-             return v1.value.localeCompare(v2.value);
-           };
-         }]);
-     </file>
-     <file name="style.css">
-       .friends-container {
-         display: inline-block;
-         margin: 0 30px;
+         content: '\25bc';
        }
-
-       .friends {
-         border-collapse: collapse;
-       }
-
-       .friends th {
-         border-bottom: 1px solid;
-       }
-       .friends td, .friends th {
-         border-left: 1px solid;
-         padding: 5px 10px;
-       }
-       .friends td:first-child, .friends th:first-child {
-         border-left: none;
-       }
-     </file>
-     <file name="protractor.js" type="protractor">
-       // Element locators
-       var container = element(by.css('.custom-comparator'));
-       var names = container.all(by.repeater('friends').column('friend.name'));
-
-       it('should sort friends by favorite letter (in correct alphabetical order)', function() {
-         expect(names.get(0).getText()).toBe('John');
-         expect(names.get(1).getText()).toBe('Adam');
-         expect(names.get(2).getText()).toBe('Mike');
-         expect(names.get(3).getText()).toBe('Mary');
-         expect(names.get(4).getText()).toBe('Julie');
-       });
-     </file>
-   </example>
- *
+    </file>
+</example>
  */
 orderByFilter.$inject = ['$parse'];
 function orderByFilter($parse) {
-  return function(array, sortPredicate, reverseOrder, compareFn) {
+  return function(array, sortPredicate, reverseOrder) {
 
     if (array == null) return array;
     if (!isArrayLike(array)) {
@@ -32523,12 +30046,11 @@ function orderByFilter($parse) {
     if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; }
     if (sortPredicate.length === 0) { sortPredicate = ['+']; }
 
-    var predicates = processPredicates(sortPredicate);
-
-    var descending = reverseOrder ? -1 : 1;
-
-    // Define the `compare()` function. Use a default comparator if none is specified.
-    var compare = isFunction(compareFn) ? compareFn : defaultCompare;
+    var predicates = processPredicates(sortPredicate, reverseOrder);
+    // Add a predicate at the end that evaluates to the element index. This makes the
+    // sort stable as it works as a tie-breaker when all the input predicates cannot
+    // distinguish between two elements.
+    predicates.push({ get: function() { return {}; }, descending: reverseOrder ? -1 : 1});
 
     // The next three lines are a version of a Swartzian Transform idiom from Perl
     // (sometimes called the Decorate-Sort-Undecorate idiom)
@@ -32540,12 +30062,8 @@ function orderByFilter($parse) {
     return array;
 
     function getComparisonObject(value, index) {
-      // NOTE: We are adding an extra `tieBreaker` value based on the element's index.
-      // This will be used to keep the sort stable when none of the input predicates can
-      // distinguish between two elements.
       return {
         value: value,
-        tieBreaker: {value: index, type: 'number', index: index},
         predicateValues: predicates.map(function(predicate) {
           return getPredicateValue(predicate.get(value), index);
         })
@@ -32553,26 +30071,25 @@ function orderByFilter($parse) {
     }
 
     function doComparison(v1, v2) {
-      for (var i = 0, ii = predicates.length; i < ii; i++) {
-        var result = compare(v1.predicateValues[i], v2.predicateValues[i]);
-        if (result) {
-          return result * predicates[i].descending * descending;
-        }
+      var result = 0;
+      for (var index=0, length = predicates.length; index < length; ++index) {
+        result = compare(v1.predicateValues[index], v2.predicateValues[index]) * predicates[index].descending;
+        if (result) break;
       }
-
-      return compare(v1.tieBreaker, v2.tieBreaker) * descending;
+      return result;
     }
   };
 
-  function processPredicates(sortPredicates) {
-    return sortPredicates.map(function(predicate) {
+  function processPredicates(sortPredicate, reverseOrder) {
+    reverseOrder = reverseOrder ? -1 : 1;
+    return sortPredicate.map(function(predicate) {
       var descending = 1, get = identity;
 
       if (isFunction(predicate)) {
         get = predicate;
       } else if (isString(predicate)) {
-        if ((predicate.charAt(0) === '+' || predicate.charAt(0) === '-')) {
-          descending = predicate.charAt(0) === '-' ? -1 : 1;
+        if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
+          descending = predicate.charAt(0) == '-' ? -1 : 1;
           predicate = predicate.substring(1);
         }
         if (predicate !== '') {
@@ -32583,7 +30100,7 @@ function orderByFilter($parse) {
           }
         }
       }
-      return {get: get, descending: descending};
+      return { get: get, descending: descending * reverseOrder };
     });
   }
 
@@ -32598,9 +30115,9 @@ function orderByFilter($parse) {
     }
   }
 
-  function objectValue(value) {
+  function objectValue(value, index) {
     // If `valueOf` is a valid function use that
-    if (isFunction(value.valueOf)) {
+    if (typeof value.valueOf === 'function') {
       value = value.valueOf();
       if (isPrimitive(value)) return value;
     }
@@ -32609,8 +30126,8 @@ function orderByFilter($parse) {
       value = value.toString();
       if (isPrimitive(value)) return value;
     }
-
-    return value;
+    // We have a basic object so we use the position of the object in the collection
+    return index;
   }
 
   function getPredicateValue(value, index) {
@@ -32618,39 +30135,23 @@ function orderByFilter($parse) {
     if (value === null) {
       type = 'string';
       value = 'null';
+    } else if (type === 'string') {
+      value = value.toLowerCase();
     } else if (type === 'object') {
-      value = objectValue(value);
+      value = objectValue(value, index);
     }
-    return {value: value, type: type, index: index};
+    return { value: value, type: type };
   }
 
-  function defaultCompare(v1, v2) {
+  function compare(v1, v2) {
     var result = 0;
-    var type1 = v1.type;
-    var type2 = v2.type;
-
-    if (type1 === type2) {
-      var value1 = v1.value;
-      var value2 = v2.value;
-
-      if (type1 === 'string') {
-        // Compare strings case-insensitively
-        value1 = value1.toLowerCase();
-        value2 = value2.toLowerCase();
-      } else if (type1 === 'object') {
-        // For basic objects, use the position of the object
-        // in the collection instead of the value
-        if (isObject(value1)) value1 = v1.index;
-        if (isObject(value2)) value2 = v2.index;
-      }
-
-      if (value1 !== value2) {
-        result = value1 < value2 ? -1 : 1;
+    if (v1.type === v2.type) {
+      if (v1.value !== v2.value) {
+        result = v1.value < v2.value ? -1 : 1;
       }
     } else {
-      result = type1 < type2 ? -1 : 1;
+      result = v1.type < v2.type ? -1 : 1;
     }
-
     return result;
   }
 }
@@ -32671,10 +30172,12 @@ function ngDirective(directive) {
  * @restrict E
  *
  * @description
- * Modifies the default behavior of the html a tag so that the default action is prevented when
+ * Modifies the default behavior of the html A tag so that the default action is prevented when
  * the href attribute is empty.
  *
- * For dynamically creating `href` attributes for a tags, see the {@link ng.ngHref `ngHref`} directive.
+ * This change permits the easy creation of action links with the `ngClick` directive
+ * without changing the location or causing page reloads, e.g.:
+ * `<a href="" ng-click="list.addItem()">Add Item</a>`
  */
 var htmlAnchorDirective = valueFn({
   restrict: 'E',
@@ -32728,7 +30231,7 @@ var htmlAnchorDirective = valueFn({
  * @example
  * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes
  * in links and their different behaviors:
-    <example name="ng-href">
+    <example>
       <file name="index.html">
         <input ng-model="value" /><br />
         <a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br />
@@ -32857,15 +30360,14 @@ var htmlAnchorDirective = valueFn({
  *
  * @description
  *
- * This directive sets the `disabled` attribute on the element (typically a form control,
- * e.g. `input`, `button`, `select` etc.) if the
+ * This directive sets the `disabled` attribute on the element if the
  * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
  *
  * A special directive is necessary because we cannot use interpolation inside the `disabled`
  * attribute. See the {@link guide/interpolation interpolation guide} for more info.
  *
  * @example
-    <example name="ng-disabled">
+    <example>
       <file name="index.html">
         <label>Click me to toggle: <input type="checkbox" ng-model="checked"></label><br/>
         <button ng-model="button" ng-disabled="checked">Button</button>
@@ -32901,7 +30403,7 @@ var htmlAnchorDirective = valueFn({
  * attribute. See the {@link guide/interpolation interpolation guide} for more info.
  *
  * @example
-    <example name="ng-checked">
+    <example>
       <file name="index.html">
         <label>Check me to check both: <input type="checkbox" ng-model="master"></label><br/>
         <input id="checkSlave" type="checkbox" ng-checked="master" aria-label="Slave input">
@@ -32929,15 +30431,13 @@ var htmlAnchorDirective = valueFn({
  *
  * @description
  *
- * Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy.
- * Note that `readonly` applies only to `input` elements with specific types. [See the input docs on
- * MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information.
+ * Sets the `readOnly` attribute on the element, if the expression inside `ngReadonly` is truthy.
  *
- * A special directive is necessary because we cannot use interpolation inside the `readonly`
+ * A special directive is necessary because we cannot use interpolation inside the `readOnly`
  * attribute. See the {@link guide/interpolation interpolation guide} for more info.
  *
  * @example
-    <example name="ng-readonly">
+    <example>
       <file name="index.html">
         <label>Check me to make text readonly: <input type="checkbox" ng-model="checked"></label><br/>
         <input type="text" ng-readonly="checked" value="I'm Angular" aria-label="Readonly field" />
@@ -32970,15 +30470,8 @@ var htmlAnchorDirective = valueFn({
  * A special directive is necessary because we cannot use interpolation inside the `selected`
  * attribute. See the {@link guide/interpolation interpolation guide} for more info.
  *
- * <div class="alert alert-warning">
- *   **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only
- *   sets the `selected` attribute on the element. If you are using `ngModel` on the select, you
- *   should not use `ngSelected` on the options, as `ngModel` will set the select value and
- *   selected options.
- * </div>
- *
  * @example
-    <example name="ng-selected">
+    <example>
       <file name="index.html">
         <label>Check me to select: <input type="checkbox" ng-model="selected"></label><br/>
         <select aria-label="ngSelected demo">
@@ -33013,13 +30506,8 @@ var htmlAnchorDirective = valueFn({
  * A special directive is necessary because we cannot use interpolation inside the `open`
  * attribute. See the {@link guide/interpolation interpolation guide} for more info.
  *
- * ## A note about browser compatibility
- *
- * Edge, Firefox, and Internet Explorer do not support the `details` element, it is
- * recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead.
- *
  * @example
-     <example name="ng-open">
+     <example>
        <file name="index.html">
          <label>Check me check multiple: <input type="checkbox" ng-model="open"></label><br/>
          <details id="details" ng-open="open">
@@ -33045,7 +30533,7 @@ var ngAttributeAliasDirectives = {};
 // boolean attrs are evaluated
 forEach(BOOLEAN_ATTR, function(propName, attrName) {
   // binding to multiple is not supported
-  if (propName === 'multiple') return;
+  if (propName == "multiple") return;
 
   function defaultLinkFn(scope, element, attr) {
     scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
@@ -33082,10 +30570,10 @@ forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {
       link: function(scope, element, attr) {
         //special case ngPattern when a literal regular expression value
         //is used as the expression (this way we don't have to watch anything).
-        if (ngAttr === 'ngPattern' && attr.ngPattern.charAt(0) === '/') {
+        if (ngAttr === "ngPattern" && attr.ngPattern.charAt(0) == "/") {
           var match = attr.ngPattern.match(REGEX_STRING_REGEXP);
           if (match) {
-            attr.$set('ngPattern', new RegExp(match[1], match[2]));
+            attr.$set("ngPattern", new RegExp(match[1], match[2]));
             return;
           }
         }
@@ -33125,11 +30613,10 @@ forEach(['src', 'srcset', 'href'], function(attrName) {
 
           attr.$set(name, value);
 
-          // Support: IE 9-11 only
-          // On IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
+          // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
           // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
           // to set the property as well to achieve the desired effect.
-          // We use attr[attrName] value since $set can sanitize the url.
+          // we use attr[attrName] value since $set can sanitize the url.
           if (msie && propName) element.prop(propName, attr[name]);
         });
       }
@@ -33137,7 +30624,7 @@ forEach(['src', 'srcset', 'href'], function(attrName) {
   };
 });
 
-/* global -nullFormCtrl, -PENDING_CLASS, -SUBMITTED_CLASS
+/* global -nullFormCtrl, -SUBMITTED_CLASS, addSetValidityMethod: true
  */
 var nullFormCtrl = {
   $addControl: noop,
@@ -33148,7 +30635,6 @@ var nullFormCtrl = {
   $setPristine: noop,
   $setSubmitted: noop
 },
-PENDING_CLASS = 'ng-pending',
 SUBMITTED_CLASS = 'ng-submitted';
 
 function nullFormRenameControl(control, name) {
@@ -33199,28 +30685,22 @@ function nullFormRenameControl(control, name) {
  */
 //asks for $scope to fool the BC controller module
 FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];
-function FormController($element, $attrs, $scope, $animate, $interpolate) {
-  this.$$controls = [];
+function FormController(element, attrs, $scope, $animate, $interpolate) {
+  var form = this,
+      controls = [];
 
   // init state
-  this.$error = {};
-  this.$$success = {};
-  this.$pending = undefined;
-  this.$name = $interpolate($attrs.name || $attrs.ngForm || '')($scope);
-  this.$dirty = false;
-  this.$pristine = true;
-  this.$valid = true;
-  this.$invalid = false;
-  this.$submitted = false;
-  this.$$parentForm = nullFormCtrl;
-
-  this.$$element = $element;
-  this.$$animate = $animate;
+  form.$error = {};
+  form.$$success = {};
+  form.$pending = undefined;
+  form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope);
+  form.$dirty = false;
+  form.$pristine = true;
+  form.$valid = true;
+  form.$invalid = false;
+  form.$submitted = false;
+  form.$$parentForm = nullFormCtrl;
 
-  setupValidity(this);
-}
-
-FormController.prototype = {
   /**
    * @ngdoc method
    * @name form.FormController#$rollbackViewValue
@@ -33232,11 +30712,11 @@ FormController.prototype = {
    * event defined in `ng-model-options`. This method is typically needed by the reset button of
    * a form that uses `ng-model-options` to pend updates.
    */
-  $rollbackViewValue: function() {
-    forEach(this.$$controls, function(control) {
+  form.$rollbackViewValue = function() {
+    forEach(controls, function(control) {
       control.$rollbackViewValue();
     });
-  },
+  };
 
   /**
    * @ngdoc method
@@ -33249,11 +30729,11 @@ FormController.prototype = {
    * event defined in `ng-model-options`. This method is rarely needed as `NgModelController`
    * usually handles calling this in response to input events.
    */
-  $commitViewValue: function() {
-    forEach(this.$$controls, function(control) {
+  form.$commitViewValue = function() {
+    forEach(controls, function(control) {
       control.$commitViewValue();
     });
-  },
+  };
 
   /**
    * @ngdoc method
@@ -33276,29 +30756,29 @@ FormController.prototype = {
    * For example, if an input control is added that is already `$dirty` and has `$error` properties,
    * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.
    */
-  $addControl: function(control) {
+  form.$addControl = function(control) {
     // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
     // and not added to the scope.  Now we throw an error.
     assertNotHasOwnProperty(control.$name, 'input');
-    this.$$controls.push(control);
+    controls.push(control);
 
     if (control.$name) {
-      this[control.$name] = control;
+      form[control.$name] = control;
     }
 
-    control.$$parentForm = this;
-  },
+    control.$$parentForm = form;
+  };
 
   // Private API: rename a form control
-  $$renameControl: function(control, newName) {
+  form.$$renameControl = function(control, newName) {
     var oldName = control.$name;
 
-    if (this[oldName] === control) {
-      delete this[oldName];
+    if (form[oldName] === control) {
+      delete form[oldName];
     }
-    this[newName] = control;
+    form[newName] = control;
     control.$name = newName;
-  },
+  };
 
   /**
    * @ngdoc method
@@ -33316,26 +30796,60 @@ FormController.prototype = {
    * different from case to case. For example, removing the only `$dirty` control from a form may or
    * may not mean that the form is still `$dirty`.
    */
-  $removeControl: function(control) {
-    if (control.$name && this[control.$name] === control) {
-      delete this[control.$name];
-    }
-    forEach(this.$pending, function(value, name) {
-      // eslint-disable-next-line no-invalid-this
-      this.$setValidity(name, null, control);
-    }, this);
-    forEach(this.$error, function(value, name) {
-      // eslint-disable-next-line no-invalid-this
-      this.$setValidity(name, null, control);
-    }, this);
-    forEach(this.$$success, function(value, name) {
-      // eslint-disable-next-line no-invalid-this
-      this.$setValidity(name, null, control);
-    }, this);
-
-    arrayRemove(this.$$controls, control);
+  form.$removeControl = function(control) {
+    if (control.$name && form[control.$name] === control) {
+      delete form[control.$name];
+    }
+    forEach(form.$pending, function(value, name) {
+      form.$setValidity(name, null, control);
+    });
+    forEach(form.$error, function(value, name) {
+      form.$setValidity(name, null, control);
+    });
+    forEach(form.$$success, function(value, name) {
+      form.$setValidity(name, null, control);
+    });
+
+    arrayRemove(controls, control);
     control.$$parentForm = nullFormCtrl;
-  },
+  };
+
+
+  /**
+   * @ngdoc method
+   * @name form.FormController#$setValidity
+   *
+   * @description
+   * Sets the validity of a form control.
+   *
+   * This method will also propagate to parent forms.
+   */
+  addSetValidityMethod({
+    ctrl: this,
+    $element: element,
+    set: function(object, property, controller) {
+      var list = object[property];
+      if (!list) {
+        object[property] = [controller];
+      } else {
+        var index = list.indexOf(controller);
+        if (index === -1) {
+          list.push(controller);
+        }
+      }
+    },
+    unset: function(object, property, controller) {
+      var list = object[property];
+      if (!list) {
+        return;
+      }
+      arrayRemove(list, controller);
+      if (list.length === 0) {
+        delete object[property];
+      }
+    },
+    $animate: $animate
+  });
 
   /**
    * @ngdoc method
@@ -33347,13 +30861,13 @@ FormController.prototype = {
    * This method can be called to add the 'ng-dirty' class and set the form to a dirty
    * state (ng-dirty class). This method will also propagate to parent forms.
    */
-  $setDirty: function() {
-    this.$$animate.removeClass(this.$$element, PRISTINE_CLASS);
-    this.$$animate.addClass(this.$$element, DIRTY_CLASS);
-    this.$dirty = true;
-    this.$pristine = false;
-    this.$$parentForm.$setDirty();
-  },
+  form.$setDirty = function() {
+    $animate.removeClass(element, PRISTINE_CLASS);
+    $animate.addClass(element, DIRTY_CLASS);
+    form.$dirty = true;
+    form.$pristine = false;
+    form.$$parentForm.$setDirty();
+  };
 
   /**
    * @ngdoc method
@@ -33362,24 +30876,22 @@ FormController.prototype = {
    * @description
    * Sets the form to its pristine state.
    *
-   * This method sets the form's `$pristine` state to true, the `$dirty` state to false, removes
-   * the `ng-dirty` class and adds the `ng-pristine` class. Additionally, it sets the `$submitted`
-   * state to false.
-   *
-   * This method will also propagate to all the controls contained in this form.
+   * This method can be called to remove the 'ng-dirty' class and set the form to its pristine
+   * state (ng-pristine class). This method will also propagate to all the controls contained
+   * in this form.
    *
    * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after
    * saving or resetting it.
    */
-  $setPristine: function() {
-    this.$$animate.setClass(this.$$element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);
-    this.$dirty = false;
-    this.$pristine = true;
-    this.$submitted = false;
-    forEach(this.$$controls, function(control) {
+  form.$setPristine = function() {
+    $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);
+    form.$dirty = false;
+    form.$pristine = true;
+    form.$submitted = false;
+    forEach(controls, function(control) {
       control.$setPristine();
     });
-  },
+  };
 
   /**
    * @ngdoc method
@@ -33394,11 +30906,11 @@ FormController.prototype = {
    * Setting a form controls back to their untouched state is often useful when setting the form
    * back to its pristine state.
    */
-  $setUntouched: function() {
-    forEach(this.$$controls, function(control) {
+  form.$setUntouched = function() {
+    forEach(controls, function(control) {
       control.$setUntouched();
     });
-  },
+  };
 
   /**
    * @ngdoc method
@@ -33407,46 +30919,12 @@ FormController.prototype = {
    * @description
    * Sets the form to its submitted state.
    */
-  $setSubmitted: function() {
-    this.$$animate.addClass(this.$$element, SUBMITTED_CLASS);
-    this.$submitted = true;
-    this.$$parentForm.$setSubmitted();
-  }
-};
-
-/**
- * @ngdoc method
- * @name form.FormController#$setValidity
- *
- * @description
- * Sets the validity of a form control.
- *
- * This method will also propagate to parent forms.
- */
-addSetValidityMethod({
-  clazz: FormController,
-  set: function(object, property, controller) {
-    var list = object[property];
-    if (!list) {
-      object[property] = [controller];
-    } else {
-      var index = list.indexOf(controller);
-      if (index === -1) {
-        list.push(controller);
-      }
-    }
-  },
-  unset: function(object, property, controller) {
-    var list = object[property];
-    if (!list) {
-      return;
-    }
-    arrayRemove(list, controller);
-    if (list.length === 0) {
-      delete object[property];
-    }
-  }
-});
+  form.$setSubmitted = function() {
+    $animate.addClass(element, SUBMITTED_CLASS);
+    form.$submitted = true;
+    form.$$parentForm.$setSubmitted();
+  };
+}
 
 /**
  * @ngdoc directive
@@ -33556,7 +31034,7 @@ addSetValidityMethod({
  * </pre>
  *
  * @example
-    <example name="ng-form" deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
+    <example deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
       <file name="index.html">
        <script>
          angular.module('formExample', [])
@@ -33643,13 +31121,13 @@ var formDirectiveFactory = function(isNgForm) {
                 event.preventDefault();
               };
 
-              formElement[0].addEventListener('submit', handleFormSubmission);
+              addEventListenerFn(formElement[0], 'submit', handleFormSubmission);
 
               // unregister the preventDefault listener so that we don't not leak memory but in a
               // way that will achieve the prevention of the default action.
               formElement.on('$destroy', function() {
                 $timeout(function() {
-                  formElement[0].removeEventListener('submit', handleFormSubmission);
+                  removeEventListenerFn(formElement[0], 'submit', handleFormSubmission);
                 }, 0, false);
               });
             }
@@ -33694,117 +31172,13 @@ var formDirectiveFactory = function(isNgForm) {
 var formDirective = formDirectiveFactory();
 var ngFormDirective = formDirectiveFactory(true);
 
-
-
-// helper methods
-function setupValidity(instance) {
-  instance.$$classCache = {};
-  instance.$$classCache[INVALID_CLASS] = !(instance.$$classCache[VALID_CLASS] = instance.$$element.hasClass(VALID_CLASS));
-}
-function addSetValidityMethod(context) {
-  var clazz = context.clazz,
-      set = context.set,
-      unset = context.unset;
-
-  clazz.prototype.$setValidity = function(validationErrorKey, state, controller) {
-    if (isUndefined(state)) {
-      createAndSet(this, '$pending', validationErrorKey, controller);
-    } else {
-      unsetAndCleanup(this, '$pending', validationErrorKey, controller);
-    }
-    if (!isBoolean(state)) {
-      unset(this.$error, validationErrorKey, controller);
-      unset(this.$$success, validationErrorKey, controller);
-    } else {
-      if (state) {
-        unset(this.$error, validationErrorKey, controller);
-        set(this.$$success, validationErrorKey, controller);
-      } else {
-        set(this.$error, validationErrorKey, controller);
-        unset(this.$$success, validationErrorKey, controller);
-      }
-    }
-    if (this.$pending) {
-      cachedToggleClass(this, PENDING_CLASS, true);
-      this.$valid = this.$invalid = undefined;
-      toggleValidationCss(this, '', null);
-    } else {
-      cachedToggleClass(this, PENDING_CLASS, false);
-      this.$valid = isObjectEmpty(this.$error);
-      this.$invalid = !this.$valid;
-      toggleValidationCss(this, '', this.$valid);
-    }
-
-    // re-read the state as the set/unset methods could have
-    // combined state in this.$error[validationError] (used for forms),
-    // where setting/unsetting only increments/decrements the value,
-    // and does not replace it.
-    var combinedState;
-    if (this.$pending && this.$pending[validationErrorKey]) {
-      combinedState = undefined;
-    } else if (this.$error[validationErrorKey]) {
-      combinedState = false;
-    } else if (this.$$success[validationErrorKey]) {
-      combinedState = true;
-    } else {
-      combinedState = null;
-    }
-
-    toggleValidationCss(this, validationErrorKey, combinedState);
-    this.$$parentForm.$setValidity(validationErrorKey, combinedState, this);
-  };
-
-  function createAndSet(ctrl, name, value, controller) {
-    if (!ctrl[name]) {
-      ctrl[name] = {};
-    }
-    set(ctrl[name], value, controller);
-  }
-
-  function unsetAndCleanup(ctrl, name, value, controller) {
-    if (ctrl[name]) {
-      unset(ctrl[name], value, controller);
-    }
-    if (isObjectEmpty(ctrl[name])) {
-      ctrl[name] = undefined;
-    }
-  }
-
-  function cachedToggleClass(ctrl, className, switchValue) {
-    if (switchValue && !ctrl.$$classCache[className]) {
-      ctrl.$$animate.addClass(ctrl.$$element, className);
-      ctrl.$$classCache[className] = true;
-    } else if (!switchValue && ctrl.$$classCache[className]) {
-      ctrl.$$animate.removeClass(ctrl.$$element, className);
-      ctrl.$$classCache[className] = false;
-    }
-  }
-
-  function toggleValidationCss(ctrl, validationErrorKey, isValid) {
-    validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
-
-    cachedToggleClass(ctrl, VALID_CLASS + validationErrorKey, isValid === true);
-    cachedToggleClass(ctrl, INVALID_CLASS + validationErrorKey, isValid === false);
-  }
-}
-
-function isObjectEmpty(obj) {
-  if (obj) {
-    for (var prop in obj) {
-      if (obj.hasOwnProperty(prop)) {
-        return false;
-      }
-    }
-  }
-  return true;
-}
-
-/* global
-  VALID_CLASS: false,
+/* global VALID_CLASS: false,
   INVALID_CLASS: false,
   PRISTINE_CLASS: false,
   DIRTY_CLASS: false,
-  ngModelMinErr: false
+  UNTOUCHED_CLASS: false,
+  TOUCHED_CLASS: false,
+  ngModelMinErr: false,
 */
 
 // Regex code was initially obtained from SO prior to modification: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231
@@ -33820,11 +31194,10 @@ var ISO_DATE_REGEXP = /^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-
 //   7. Path
 //   8. Query
 //   9. Fragment
-//                 1111111111111111 222   333333    44444        55555555555555555555555     666     77777777     8888888     999
-var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i;
-// eslint-disable-next-line max-len
-var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;
-var NUMBER_REGEXP = /^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
+//                 1111111111111111 222   333333    44444        555555555555555555555555    666     77777777     8888888     999
+var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i;
+var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
+var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
 var DATE_REGEXP = /^(\d{4,})-(\d{2})-(\d{2})$/;
 var DATETIMELOCAL_REGEXP = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
 var WEEK_REGEXP = /^(\d{4,})-W(\d\d)$/;
@@ -33899,11 +31272,11 @@ var inputType = {
              <span class="error" ng-show="myForm.input.$error.pattern">
                Single word only!</span>
            </div>
-           <code>text = {{example.text}}</code><br/>
-           <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br/>
-           <code>myForm.input.$error = {{myForm.input.$error}}</code><br/>
-           <code>myForm.$valid = {{myForm.$valid}}</code><br/>
-           <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br/>
+           <tt>text = {{example.text}}</tt><br/>
+           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
           </form>
         </file>
         <file name="protractor.js" type="protractor">
@@ -34004,6 +31377,7 @@ var inputType = {
      <file name="protractor.js" type="protractor">
         var value = element(by.binding('example.value | date: "yyyy-MM-dd"'));
         var valid = element(by.binding('myForm.input.$valid'));
+        var input = element(by.model('example.value'));
 
         // currently protractor/webdriver does not support
         // sending keys to all known HTML5 input controls
@@ -34106,6 +31480,7 @@ var inputType = {
     <file name="protractor.js" type="protractor">
       var value = element(by.binding('example.value | date: "yyyy-MM-ddTHH:mm:ss"'));
       var valid = element(by.binding('myForm.input.$valid'));
+      var input = element(by.model('example.value'));
 
       // currently protractor/webdriver does not support
       // sending keys to all known HTML5 input controls
@@ -34209,6 +31584,7 @@ var inputType = {
    <file name="protractor.js" type="protractor">
       var value = element(by.binding('example.value | date: "HH:mm:ss"'));
       var valid = element(by.binding('myForm.input.$valid'));
+      var input = element(by.model('example.value'));
 
       // currently protractor/webdriver does not support
       // sending keys to all known HTML5 input controls
@@ -34313,6 +31689,7 @@ var inputType = {
     <file name="protractor.js" type="protractor">
       var value = element(by.binding('example.value | date: "yyyy-Www"'));
       var valid = element(by.binding('myForm.input.$valid'));
+      var input = element(by.model('example.value'));
 
       // currently protractor/webdriver does not support
       // sending keys to all known HTML5 input controls
@@ -34416,6 +31793,7 @@ var inputType = {
    <file name="protractor.js" type="protractor">
       var value = element(by.binding('example.value | date: "yyyy-MM"'));
       var valid = element(by.binding('myForm.input.$valid'));
+      var input = element(by.model('example.value'));
 
       // currently protractor/webdriver does not support
       // sending keys to all known HTML5 input controls
@@ -34478,17 +31856,7 @@ var inputType = {
    * @param {string} ngModel Assignable angular expression to data-bind to.
    * @param {string=} name Property name of the form under which the control is published.
    * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
-   *    Can be interpolated.
    * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
-   *    Can be interpolated.
-   * @param {string=} ngMin Like `min`, sets the `min` validation error key if the value entered is less than `ngMin`,
-   *    but does not trigger HTML5 native validation. Takes an expression.
-   * @param {string=} ngMax Like `max`, sets the `max` validation error key if the value entered is greater than `ngMax`,
-   *    but does not trigger HTML5 native validation. Takes an expression.
-   * @param {string=} step Sets the `step` validation error key if the value entered does not fit the `step` constraint.
-   *    Can be interpolated.
-   * @param {string=} ngStep Like `step`, sets the `step` validation error key if the value entered does not fit the `ngStep` constraint,
-   *    but does not trigger HTML5 native validation. Takes an expression.
    * @param {string=} required Sets `required` validation error key if the value is not entered.
    * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
    *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
@@ -34820,140 +32188,19 @@ var inputType = {
         </file>
         <file name="protractor.js" type="protractor">
           it('should change state', function() {
-            var inputs = element.all(by.model('color.name'));
             var color = element(by.binding('color.name'));
 
             expect(color.getText()).toContain('blue');
 
-            inputs.get(0).click();
-            expect(color.getText()).toContain('red');
+            element.all(by.model('color.name')).get(0).click();
 
-            inputs.get(1).click();
-            expect(color.getText()).toContain('green');
+            expect(color.getText()).toContain('red');
           });
         </file>
       </example>
    */
   'radio': radioInputType,
 
-  /**
-   * @ngdoc input
-   * @name input[range]
-   *
-   * @description
-   * Native range input with validation and transformation.
-   *
-   * The model for the range input must always be a `Number`.
-   *
-   * IE9 and other browsers that do not support the `range` type fall back
-   * to a text input without any default values for `min`, `max` and `step`. Model binding,
-   * validation and number parsing are nevertheless supported.
-   *
-   * Browsers that support range (latest Chrome, Safari, Firefox, Edge) treat `input[range]`
-   * in a way that never allows the input to hold an invalid value. That means:
-   * - any non-numerical value is set to `(max + min) / 2`.
-   * - any numerical value that is less than the current min val, or greater than the current max val
-   * is set to the min / max val respectively.
-   * - additionally, the current `step` is respected, so the nearest value that satisfies a step
-   * is used.
-   *
-   * See the [HTML Spec on input[type=range]](https://www.w3.org/TR/html5/forms.html#range-state-(type=range))
-   * for more info.
-   *
-   * This has the following consequences for Angular:
-   *
-   * Since the element value should always reflect the current model value, a range input
-   * will set the bound ngModel expression to the value that the browser has set for the
-   * input element. For example, in the following input `<input type="range" ng-model="model.value">`,
-   * if the application sets `model.value = null`, the browser will set the input to `'50'`.
-   * Angular will then set the model to `50`, to prevent input and model value being out of sync.
-   *
-   * That means the model for range will immediately be set to `50` after `ngModel` has been
-   * initialized. It also means a range input can never have the required error.
-   *
-   * This does not only affect changes to the model value, but also to the values of the `min`,
-   * `max`, and `step` attributes. When these change in a way that will cause the browser to modify
-   * the input value, Angular will also update the model value.
-   *
-   * Automatic value adjustment also means that a range input element can never have the `required`,
-   * `min`, or `max` errors.
-   *
-   * However, `step` is currently only fully implemented by Firefox. Other browsers have problems
-   * when the step value changes dynamically - they do not adjust the element value correctly, but
-   * instead may set the `stepMismatch` error. If that's the case, the Angular will set the `step`
-   * error on the input, and set the model to `undefined`.
-   *
-   * Note that `input[range]` is not compatible with`ngMax`, `ngMin`, and `ngStep`, because they do
-   * not set the `min` and `max` attributes, which means that the browser won't automatically adjust
-   * the input value based on their values, and will always assume min = 0, max = 100, and step = 1.
-   *
-   * @param {string}  ngModel Assignable angular expression to data-bind to.
-   * @param {string=} name Property name of the form under which the control is published.
-   * @param {string=} min Sets the `min` validation to ensure that the value entered is greater
-   *                  than `min`. Can be interpolated.
-   * @param {string=} max Sets the `max` validation to ensure that the value entered is less than `max`.
-   *                  Can be interpolated.
-   * @param {string=} step Sets the `step` validation to ensure that the value entered matches the `step`
-   *                  Can be interpolated.
-   * @param {string=} ngChange Angular expression to be executed when the ngModel value changes due
-   *                  to user interaction with the input element.
-   * @param {expression=} ngChecked If the expression is truthy, then the `checked` attribute will be set on the
-   *                      element. **Note** : `ngChecked` should not be used alongside `ngModel`.
-   *                      Checkout {@link ng.directive:ngChecked ngChecked} for usage.
-   *
-   * @example
-      <example name="range-input-directive" module="rangeExample">
-        <file name="index.html">
-          <script>
-            angular.module('rangeExample', [])
-              .controller('ExampleController', ['$scope', function($scope) {
-                $scope.value = 75;
-                $scope.min = 10;
-                $scope.max = 90;
-              }]);
-          </script>
-          <form name="myForm" ng-controller="ExampleController">
-
-            Model as range: <input type="range" name="range" ng-model="value" min="{{min}}"  max="{{max}}">
-            <hr>
-            Model as number: <input type="number" ng-model="value"><br>
-            Min: <input type="number" ng-model="min"><br>
-            Max: <input type="number" ng-model="max"><br>
-            value = <code>{{value}}</code><br/>
-            myForm.range.$valid = <code>{{myForm.range.$valid}}</code><br/>
-            myForm.range.$error = <code>{{myForm.range.$error}}</code>
-          </form>
-        </file>
-      </example>
-
-   * ## Range Input with ngMin & ngMax attributes
-
-   * @example
-      <example name="range-input-directive-ng" module="rangeExample">
-        <file name="index.html">
-          <script>
-            angular.module('rangeExample', [])
-              .controller('ExampleController', ['$scope', function($scope) {
-                $scope.value = 75;
-                $scope.min = 10;
-                $scope.max = 90;
-              }]);
-          </script>
-          <form name="myForm" ng-controller="ExampleController">
-            Model as range: <input type="range" name="range" ng-model="value" ng-min="min" ng-max="max">
-            <hr>
-            Model as number: <input type="number" ng-model="value"><br>
-            Min: <input type="number" ng-model="min"><br>
-            Max: <input type="number" ng-model="max"><br>
-            value = <code>{{value}}</code><br/>
-            myForm.range.$valid = <code>{{myForm.range.$valid}}</code><br/>
-            myForm.range.$error = <code>{{myForm.range.$error}}</code>
-          </form>
-        </file>
-      </example>
-
-   */
-  'range': rangeInputType,
 
   /**
    * @ngdoc input
@@ -35033,7 +32280,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
 function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
   var type = lowercase(element[0].type);
 
-  // In composition mode, users are still inputting intermediate text buffer,
+  // In composition mode, users are still inputing intermediate text buffer,
   // hold the listener until composition is done.
   // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
   if (!$sniffer.android) {
@@ -35091,7 +32338,7 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
       }
     };
 
-    element.on('keydown', /** @this */ function(event) {
+    element.on('keydown', function(event) {
       var key = event.keyCode;
 
       // ignore
@@ -35116,7 +32363,7 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
   // For these event types, when native validators are present and the browser supports the type,
   // check for validity changes on various DOM events.
   if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) {
-    element.on(PARTIAL_VALIDATION_EVENTS, /** @this */ function(ev) {
+    element.on(PARTIAL_VALIDATION_EVENTS, function(ev) {
       if (!timeout) {
         var validity = this[VALIDITY_STATE_PROPERTY];
         var origBadInput = validity.badInput;
@@ -35184,7 +32431,7 @@ function createDateParser(regexp, mapping) {
       // When a date is JSON'ified to wraps itself inside of an extra
       // set of double quotes. This makes the date parsing code unable
       // to match the date string and parse it as a date.
-      if (iso.charAt(0) === '"' && iso.charAt(iso.length - 1) === '"') {
+      if (iso.charAt(0) == '"' && iso.charAt(iso.length - 1) == '"') {
         iso = iso.substring(1, iso.length - 1);
       }
       if (ISO_DATE_REGEXP.test(iso)) {
@@ -35226,7 +32473,7 @@ function createDateInputType(type, regexp, parseDate, format) {
   return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) {
     badInputChecker(scope, element, attr, ctrl);
     baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
-    var timezone = ctrl && ctrl.$options.getOption('timezone');
+    var timezone = ctrl && ctrl.$options && ctrl.$options.timezone;
     var previousDate;
 
     ctrl.$$parserName = type;
@@ -35305,7 +32552,10 @@ function badInputChecker(scope, element, attr, ctrl) {
   }
 }
 
-function numberFormatterParser(ctrl) {
+function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+  badInputChecker(scope, element, attr, ctrl);
+  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
   ctrl.$$parserName = 'number';
   ctrl.$parsers.push(function(value) {
     if (ctrl.$isEmpty(value))      return null;
@@ -35322,252 +32572,37 @@ function numberFormatterParser(ctrl) {
     }
     return value;
   });
-}
-
-function parseNumberAttrVal(val) {
-  if (isDefined(val) && !isNumber(val)) {
-    val = parseFloat(val);
-  }
-  return !isNumberNaN(val) ? val : undefined;
-}
-
-function isNumberInteger(num) {
-  // See http://stackoverflow.com/questions/14636536/how-to-check-if-a-variable-is-an-integer-in-javascript#14794066
-  // (minus the assumption that `num` is a number)
-
-  // eslint-disable-next-line no-bitwise
-  return (num | 0) === num;
-}
-
-function countDecimals(num) {
-  var numString = num.toString();
-  var decimalSymbolIndex = numString.indexOf('.');
-
-  if (decimalSymbolIndex === -1) {
-    if (-1 < num && num < 1) {
-      // It may be in the exponential notation format (`1e-X`)
-      var match = /e-(\d+)$/.exec(numString);
-
-      if (match) {
-        return Number(match[1]);
-      }
-    }
-
-    return 0;
-  }
-
-  return numString.length - decimalSymbolIndex - 1;
-}
-
-function isValidForStep(viewValue, stepBase, step) {
-  // At this point `stepBase` and `step` are expected to be non-NaN values
-  // and `viewValue` is expected to be a valid stringified number.
-  var value = Number(viewValue);
-
-  var isNonIntegerValue = !isNumberInteger(value);
-  var isNonIntegerStepBase = !isNumberInteger(stepBase);
-  var isNonIntegerStep = !isNumberInteger(step);
-
-  // Due to limitations in Floating Point Arithmetic (e.g. `0.3 - 0.2 !== 0.1` or
-  // `0.5 % 0.1 !== 0`), we need to convert all numbers to integers.
-  if (isNonIntegerValue || isNonIntegerStepBase || isNonIntegerStep) {
-    var valueDecimals = isNonIntegerValue ? countDecimals(value) : 0;
-    var stepBaseDecimals = isNonIntegerStepBase ? countDecimals(stepBase) : 0;
-    var stepDecimals = isNonIntegerStep ? countDecimals(step) : 0;
-
-    var decimalCount = Math.max(valueDecimals, stepBaseDecimals, stepDecimals);
-    var multiplier = Math.pow(10, decimalCount);
-
-    value = value * multiplier;
-    stepBase = stepBase * multiplier;
-    step = step * multiplier;
-
-    if (isNonIntegerValue) value = Math.round(value);
-    if (isNonIntegerStepBase) stepBase = Math.round(stepBase);
-    if (isNonIntegerStep) step = Math.round(step);
-  }
-
-  return (value - stepBase) % step === 0;
-}
-
-function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
-  badInputChecker(scope, element, attr, ctrl);
-  numberFormatterParser(ctrl);
-  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
-
-  var minVal;
-  var maxVal;
 
   if (isDefined(attr.min) || attr.ngMin) {
+    var minVal;
     ctrl.$validators.min = function(value) {
       return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal;
     };
 
     attr.$observe('min', function(val) {
-      minVal = parseNumberAttrVal(val);
+      if (isDefined(val) && !isNumber(val)) {
+        val = parseFloat(val, 10);
+      }
+      minVal = isNumber(val) && !isNaN(val) ? val : undefined;
       // TODO(matsko): implement validateLater to reduce number of validations
       ctrl.$validate();
     });
   }
 
   if (isDefined(attr.max) || attr.ngMax) {
+    var maxVal;
     ctrl.$validators.max = function(value) {
       return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;
     };
 
     attr.$observe('max', function(val) {
-      maxVal = parseNumberAttrVal(val);
-      // TODO(matsko): implement validateLater to reduce number of validations
-      ctrl.$validate();
-    });
-  }
-
-  if (isDefined(attr.step) || attr.ngStep) {
-    var stepVal;
-    ctrl.$validators.step = function(modelValue, viewValue) {
-      return ctrl.$isEmpty(viewValue) || isUndefined(stepVal) ||
-             isValidForStep(viewValue, minVal || 0, stepVal);
-    };
-
-    attr.$observe('step', function(val) {
-      stepVal = parseNumberAttrVal(val);
-      // TODO(matsko): implement validateLater to reduce number of validations
-      ctrl.$validate();
-    });
-  }
-}
-
-function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) {
-  badInputChecker(scope, element, attr, ctrl);
-  numberFormatterParser(ctrl);
-  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
-
-  var supportsRange = ctrl.$$hasNativeValidators && element[0].type === 'range',
-      minVal = supportsRange ? 0 : undefined,
-      maxVal = supportsRange ? 100 : undefined,
-      stepVal = supportsRange ? 1 : undefined,
-      validity = element[0].validity,
-      hasMinAttr = isDefined(attr.min),
-      hasMaxAttr = isDefined(attr.max),
-      hasStepAttr = isDefined(attr.step);
-
-  var originalRender = ctrl.$render;
-
-  ctrl.$render = supportsRange && isDefined(validity.rangeUnderflow) && isDefined(validity.rangeOverflow) ?
-    //Browsers that implement range will set these values automatically, but reading the adjusted values after
-    //$render would cause the min / max validators to be applied with the wrong value
-    function rangeRender() {
-      originalRender();
-      ctrl.$setViewValue(element.val());
-    } :
-    originalRender;
-
-  if (hasMinAttr) {
-    ctrl.$validators.min = supportsRange ?
-      // Since all browsers set the input to a valid value, we don't need to check validity
-      function noopMinValidator() { return true; } :
-      // non-support browsers validate the min val
-      function minValidator(modelValue, viewValue) {
-        return ctrl.$isEmpty(viewValue) || isUndefined(minVal) || viewValue >= minVal;
-      };
-
-    setInitialValueAndObserver('min', minChange);
-  }
-
-  if (hasMaxAttr) {
-    ctrl.$validators.max = supportsRange ?
-      // Since all browsers set the input to a valid value, we don't need to check validity
-      function noopMaxValidator() { return true; } :
-      // non-support browsers validate the max val
-      function maxValidator(modelValue, viewValue) {
-        return ctrl.$isEmpty(viewValue) || isUndefined(maxVal) || viewValue <= maxVal;
-      };
-
-    setInitialValueAndObserver('max', maxChange);
-  }
-
-  if (hasStepAttr) {
-    ctrl.$validators.step = supportsRange ?
-      function nativeStepValidator() {
-        // Currently, only FF implements the spec on step change correctly (i.e. adjusting the
-        // input element value to a valid value). It's possible that other browsers set the stepMismatch
-        // validity error instead, so we can at least report an error in that case.
-        return !validity.stepMismatch;
-      } :
-      // ngStep doesn't set the setp attr, so the browser doesn't adjust the input value as setting step would
-      function stepValidator(modelValue, viewValue) {
-        return ctrl.$isEmpty(viewValue) || isUndefined(stepVal) ||
-               isValidForStep(viewValue, minVal || 0, stepVal);
-      };
-
-    setInitialValueAndObserver('step', stepChange);
-  }
-
-  function setInitialValueAndObserver(htmlAttrName, changeFn) {
-    // interpolated attributes set the attribute value only after a digest, but we need the
-    // attribute value when the input is first rendered, so that the browser can adjust the
-    // input value based on the min/max value
-    element.attr(htmlAttrName, attr[htmlAttrName]);
-    attr.$observe(htmlAttrName, changeFn);
-  }
-
-  function minChange(val) {
-    minVal = parseNumberAttrVal(val);
-    // ignore changes before model is initialized
-    if (isNumberNaN(ctrl.$modelValue)) {
-      return;
-    }
-
-    if (supportsRange) {
-      var elVal = element.val();
-      // IE11 doesn't set the el val correctly if the minVal is greater than the element value
-      if (minVal > elVal) {
-        elVal = minVal;
-        element.val(elVal);
+      if (isDefined(val) && !isNumber(val)) {
+        val = parseFloat(val, 10);
       }
-      ctrl.$setViewValue(elVal);
-    } else {
+      maxVal = isNumber(val) && !isNaN(val) ? val : undefined;
       // TODO(matsko): implement validateLater to reduce number of validations
       ctrl.$validate();
-    }
-  }
-
-  function maxChange(val) {
-    maxVal = parseNumberAttrVal(val);
-    // ignore changes before model is initialized
-    if (isNumberNaN(ctrl.$modelValue)) {
-      return;
-    }
-
-    if (supportsRange) {
-      var elVal = element.val();
-      // IE11 doesn't set the el val correctly if the maxVal is less than the element value
-      if (maxVal < elVal) {
-        element.val(maxVal);
-        // IE11 and Chrome don't set the value to the minVal when max < min
-        elVal = maxVal < minVal ? minVal : maxVal;
-      }
-      ctrl.$setViewValue(elVal);
-    } else {
-      // TODO(matsko): implement validateLater to reduce number of validations
-      ctrl.$validate();
-    }
-  }
-
-  function stepChange(val) {
-    stepVal = parseNumberAttrVal(val);
-    // ignore changes before model is initialized
-    if (isNumberNaN(ctrl.$modelValue)) {
-      return;
-    }
-
-    // Some browsers don't adjust the input value correctly, but set the stepMismatch error
-    if (supportsRange && ctrl.$viewValue !== element.val()) {
-      ctrl.$setViewValue(element.val());
-    } else {
-      // TODO(matsko): implement validateLater to reduce number of validations
-      ctrl.$validate();
-    }
+    });
   }
 }
 
@@ -35598,20 +32633,14 @@ function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
 }
 
 function radioInputType(scope, element, attr, ctrl) {
-  var doTrim = !attr.ngTrim || trim(attr.ngTrim) !== 'false';
   // make the name unique, if not defined
   if (isUndefined(attr.name)) {
     element.attr('name', nextUid());
   }
 
   var listener = function(ev) {
-    var value;
     if (element[0].checked) {
-      value = attr.value;
-      if (doTrim) {
-        value = trim(value);
-      }
-      ctrl.$setViewValue(value, ev && ev.type);
+      ctrl.$setViewValue(attr.value, ev && ev.type);
     }
   };
 
@@ -35619,10 +32648,7 @@ function radioInputType(scope, element, attr, ctrl) {
 
   ctrl.$render = function() {
     var value = attr.value;
-    if (doTrim) {
-      value = trim(value);
-    }
-    element[0].checked = (value === ctrl.$viewValue);
+    element[0].checked = (value == ctrl.$viewValue);
   };
 
   attr.$observe('value', ctrl.$render);
@@ -35705,20 +32731,6 @@ function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filt
  * @param {string=} ngChange Angular expression to be executed when input changes due to user
  *    interaction with the input element.
  * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
- *
- * @knownIssue
- *
- * When specifying the `placeholder` attribute of `<textarea>`, Internet Explorer will temporarily
- * insert the placeholder value as the textarea's content. If the placeholder value contains
- * interpolation (`{{ ... }}`), an error will be logged in the console when Angular tries to update
- * the value of the by-then-removed text node. This doesn't affect the functionality of the
- * textarea, but can be undesirable.
- *
- * You can work around this Internet Explorer issue by using `ng-attr-placeholder` instead of
- * `placeholder` on textareas, whenever you need interpolation in the placeholder value. You can
- * find more details on `ngAttr` in the
- * [Interpolation](guide/interpolation#-ngattr-for-binding-to-arbitrary-attributes) section of the
- * Developer Guide.
  */
 
 
@@ -35883,19 +32895,21 @@ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
  * @name ngValue
  *
  * @description
- * Binds the given expression to the value of the element.
+ * Binds the given expression to the value of `<option>` or {@link input[radio] `input[radio]`},
+ * so that when the element is selected, the {@link ngModel `ngModel`} of that element is set to
+ * the bound value.
  *
- * It is mainly used on {@link input[radio] `input[radio]`} and option elements,
- * so that when the element is selected, the {@link ngModel `ngModel`} of that element (or its
- * {@link select `select`} parent element) is set to the bound value. It is especially useful
- * for dynamically generated lists using {@link ngRepeat `ngRepeat`}, as shown below.
+ * `ngValue` is useful when dynamically generating lists of radio buttons using
+ * {@link ngRepeat `ngRepeat`}, as shown below.
  *
- * It can also be used to achieve one-way binding of a given expression to an input element
- * such as an `input[text]` or a `textarea`, when that element does not use ngModel.
+ * Likewise, `ngValue` can be used to generate `<option>` elements for
+ * the {@link select `select`} element. In that case however, only strings are supported
+ * for the `value `attribute, so the resulting `ngModel` will always be a string.
+ * Support for `select` models with non-string values is available via `ngOptions`.
  *
  * @element input
  * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute
- * and `value` property of the element.
+ *   of the `input` element
  *
  * @example
     <example name="ngValue-directive" module="valueExample">
@@ -35934,33 +32948,18 @@ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
     </example>
  */
 var ngValueDirective = function() {
-  /**
-   *  inputs use the value attribute as their default value if the value property is not set.
-   *  Once the value property has been set (by adding input), it will not react to changes to
-   *  the value attribute anymore. Setting both attribute and property fixes this behavior, and
-   *  makes it possible to use ngValue as a sort of one-way bind.
-   */
-  function updateElementValue(element, attr, value) {
-    // Support: IE9 only
-    // In IE9 values are converted to string (e.g. `input.value = null` results in `input.value === 'null'`).
-    var propValue = isDefined(value) ? value : (msie === 9) ? '' : null;
-    element.prop('value', propValue);
-    attr.$set('value', value);
-  }
-
   return {
     restrict: 'A',
     priority: 100,
     compile: function(tpl, tplAttr) {
       if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
         return function ngValueConstantLink(scope, elm, attr) {
-          var value = scope.$eval(attr.ngValue);
-          updateElementValue(elm, attr, value);
+          attr.$set('value', scope.$eval(attr.ngValue));
         };
       } else {
         return function ngValueLink(scope, elm, attr) {
           scope.$watch(attr.ngValue, function valueWatchAction(value) {
-            updateElementValue(elm, attr, value);
+            attr.$set('value', value);
           });
         };
       }
@@ -35994,7 +32993,7 @@ var ngValueDirective = function() {
  *
  * @example
  * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
-   <example module="bindExample" name="ng-bind">
+   <example module="bindExample">
      <file name="index.html">
        <script>
          angular.module('bindExample', [])
@@ -36028,7 +33027,7 @@ var ngBindDirective = ['$compile', function($compile) {
         $compile.$$addBindingInfo(element, attr.ngBind);
         element = element[0];
         scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
-          element.textContent = stringify(value);
+          element.textContent = isUndefined(value) ? '' : value;
         });
       };
     }
@@ -36054,7 +33053,7 @@ var ngBindDirective = ['$compile', function($compile) {
  *
  * @example
  * Try it here: enter text in text box and watch the greeting change.
-   <example module="bindExample" name="ng-bind-template">
+   <example module="bindExample">
      <file name="index.html">
        <script>
          angular.module('bindExample', [])
@@ -36127,7 +33126,7 @@ var ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate
  *
  * @example
 
-   <example module="bindHtmlExample" deps="angular-sanitize.js" name="ng-bind-html">
+   <example module="bindHtmlExample" deps="angular-sanitize.js">
      <file name="index.html">
        <div ng-controller="ExampleController">
         <p ng-bind-html="myHTML"></p>
@@ -36156,9 +33155,8 @@ var ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse,
     restrict: 'A',
     compile: function ngBindHtmlCompile(tElement, tAttrs) {
       var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);
-      var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function sceValueOf(val) {
-        // Unwrap the value to compare the actual inner safe value, not the wrapper object.
-        return $sce.valueOf(val);
+      var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function getStringValue(value) {
+        return (value || '').toString();
       });
       $compile.$$addBindingClass(tElement);
 
@@ -36166,9 +33164,9 @@ var ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse,
         $compile.$$addBindingInfo(element, attr.ngBindHtml);
 
         scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {
-          // The watched value is the unwrapped value. To avoid re-escaping, use the direct getter.
-          var value = ngBindHtmlGetter(scope);
-          element.html($sce.getTrustedHtml(value) || '');
+          // we re-evaluate the expr because we want a TrustedValueHolderType
+          // for $sce, not a string
+          element.html($sce.getTrustedHtml(ngBindHtmlGetter(scope)) || '');
         });
       };
     }
@@ -36252,72 +33250,50 @@ var ngChangeDirective = valueFn({
   }
 });
 
-/* exported
-  ngClassDirective,
-  ngClassEvenDirective,
-  ngClassOddDirective
-*/
-
 function classDirective(name, selector) {
   name = 'ngClass' + name;
-  var indexWatchExpression;
-
-  return ['$parse', function($parse) {
+  return ['$animate', function($animate) {
     return {
       restrict: 'AC',
       link: function(scope, element, attr) {
-        var classCounts = element.data('$classCounts');
-        var oldModulo = true;
-        var oldClassString;
+        var oldVal;
 
-        if (!classCounts) {
-          // Use createMap() to prevent class assumptions involving property
-          // names in Object.prototype
-          classCounts = createMap();
-          element.data('$classCounts', classCounts);
-        }
+        scope.$watch(attr[name], ngClassWatchAction, true);
 
-        if (name !== 'ngClass') {
-          if (!indexWatchExpression) {
-            indexWatchExpression = $parse('$index', function moduloTwo($index) {
-              // eslint-disable-next-line no-bitwise
-              return $index & 1;
-            });
-          }
-
-          scope.$watch(indexWatchExpression, ngClassIndexWatchAction);
-        }
+        attr.$observe('class', function(value) {
+          ngClassWatchAction(scope.$eval(attr[name]));
+        });
 
-        scope.$watch($parse(attr[name], toClassString), ngClassWatchAction);
 
-        function addClasses(classString) {
-          classString = digestClassCounts(split(classString), 1);
-          attr.$addClass(classString);
+        if (name !== 'ngClass') {
+          scope.$watch('$index', function($index, old$index) {
+            // jshint bitwise: false
+            var mod = $index & 1;
+            if (mod !== (old$index & 1)) {
+              var classes = arrayClasses(scope.$eval(attr[name]));
+              mod === selector ?
+                addClasses(classes) :
+                removeClasses(classes);
+            }
+          });
         }
 
-        function removeClasses(classString) {
-          classString = digestClassCounts(split(classString), -1);
-          attr.$removeClass(classString);
+        function addClasses(classes) {
+          var newClasses = digestClassCounts(classes, 1);
+          attr.$addClass(newClasses);
         }
 
-        function updateClasses(oldClassString, newClassString) {
-          var oldClassArray = split(oldClassString);
-          var newClassArray = split(newClassString);
-
-          var toRemoveArray = arrayDifference(oldClassArray, newClassArray);
-          var toAddArray = arrayDifference(newClassArray, oldClassArray);
-
-          var toRemoveString = digestClassCounts(toRemoveArray, -1);
-          var toAddString = digestClassCounts(toAddArray, 1);
-
-          attr.$addClass(toAddString);
-          attr.$removeClass(toRemoveString);
+        function removeClasses(classes) {
+          var newClasses = digestClassCounts(classes, -1);
+          attr.$removeClass(newClasses);
         }
 
-        function digestClassCounts(classArray, count) {
+        function digestClassCounts(classes, count) {
+          // Use createMap() to prevent class assumptions involving property
+          // names in Object.prototype
+          var classCounts = element.data('$classCounts') || createMap();
           var classesToUpdate = [];
-
-          forEach(classArray, function(className) {
+          forEach(classes, function(className) {
             if (count > 0 || classCounts[className]) {
               classCounts[className] = (classCounts[className] || 0) + count;
               if (classCounts[className] === +(count > 0)) {
@@ -36325,76 +33301,76 @@ function classDirective(name, selector) {
               }
             }
           });
-
+          element.data('$classCounts', classCounts);
           return classesToUpdate.join(' ');
         }
 
-        function ngClassIndexWatchAction(newModulo) {
-          // This watch-action should run before the `ngClassWatchAction()`, thus it
-          // adds/removes `oldClassString`. If the `ngClass` expression has changed as well, the
-          // `ngClassWatchAction()` will update the classes.
-          if (newModulo === selector) {
-            addClasses(oldClassString);
-          } else {
-            removeClasses(oldClassString);
+        function updateClasses(oldClasses, newClasses) {
+          var toAdd = arrayDifference(newClasses, oldClasses);
+          var toRemove = arrayDifference(oldClasses, newClasses);
+          toAdd = digestClassCounts(toAdd, 1);
+          toRemove = digestClassCounts(toRemove, -1);
+          if (toAdd && toAdd.length) {
+            $animate.addClass(element, toAdd);
+          }
+          if (toRemove && toRemove.length) {
+            $animate.removeClass(element, toRemove);
           }
-
-          oldModulo = newModulo;
         }
 
-        function ngClassWatchAction(newClassString) {
-          // When using a one-time binding the newClassString will return
-          // the pre-interceptor value until the one-time is complete
-          if (!isString(newClassString)) {
-            newClassString = toClassString(newClassString);
+        function ngClassWatchAction(newVal) {
+          if (selector === true || scope.$index % 2 === selector) {
+            var newClasses = arrayClasses(newVal || []);
+            if (!oldVal) {
+              addClasses(newClasses);
+            } else if (!equals(newVal,oldVal)) {
+              var oldClasses = arrayClasses(oldVal);
+              updateClasses(oldClasses, newClasses);
+            }
           }
-
-          if (oldModulo === selector) {
-            updateClasses(oldClassString, newClassString);
+          if (isArray(newVal)) {
+            oldVal = newVal.map(function(v) { return shallowCopy(v); });
+          } else {
+            oldVal = shallowCopy(newVal);
           }
-
-          oldClassString = newClassString;
         }
       }
     };
-  }];
-
-  // Helpers
-  function arrayDifference(tokens1, tokens2) {
-    if (!tokens1 || !tokens1.length) return [];
-    if (!tokens2 || !tokens2.length) return tokens1;
 
-    var values = [];
+    function arrayDifference(tokens1, tokens2) {
+      var values = [];
 
-    outer:
-    for (var i = 0; i < tokens1.length; i++) {
-      var token = tokens1[i];
-      for (var j = 0; j < tokens2.length; j++) {
-        if (token === tokens2[j]) continue outer;
+      outer:
+      for (var i = 0; i < tokens1.length; i++) {
+        var token = tokens1[i];
+        for (var j = 0; j < tokens2.length; j++) {
+          if (token == tokens2[j]) continue outer;
+        }
+        values.push(token);
       }
-      values.push(token);
+      return values;
     }
 
-    return values;
-  }
-
-  function split(classString) {
-    return classString && classString.split(' ');
-  }
-
-  function toClassString(classValue) {
-    var classString = classValue;
-
-    if (isArray(classValue)) {
-      classString = classValue.map(toClassString).join(' ');
-    } else if (isObject(classValue)) {
-      classString = Object.keys(classValue).
-        filter(function(key) { return classValue[key]; }).
-        join(' ');
+    function arrayClasses(classVal) {
+      var classes = [];
+      if (isArray(classVal)) {
+        forEach(classVal, function(v) {
+          classes = classes.concat(arrayClasses(v));
+        });
+        return classes;
+      } else if (isString(classVal)) {
+        return classVal.split(' ');
+      } else if (isObject(classVal)) {
+        forEach(classVal, function(v, k) {
+          if (v) {
+            classes = classes.concat(k.split(' '));
+          }
+        });
+        return classes;
+      }
+      return classVal;
     }
-
-    return classString;
-  }
+  }];
 }
 
 /**
@@ -36425,11 +33401,6 @@ function classDirective(name, selector) {
  * When the expression changes, the previously added classes are removed and only then are the
  * new classes added.
  *
- * @knownIssue
- * You should not use {@link guide/interpolation interpolation} in the value of the `class`
- * attribute, when using the `ngClass` directive on the same element.
- * See {@link guide/interpolation#known-issues here} for more info.
- *
  * @animations
  * | Animation                        | Occurs                              |
  * |----------------------------------|-------------------------------------|
@@ -36444,7 +33415,7 @@ function classDirective(name, selector) {
  *   element.
  *
  * @example Example that demonstrates basic bindings via ngClass directive.
-   <example name="ng-class">
+   <example>
      <file name="index.html">
        <p ng-class="{strike: deleted, bold: important, 'has-error': error}">Map Syntax Example</p>
        <label>
@@ -36537,7 +33508,7 @@ function classDirective(name, selector) {
 
    The example below demonstrates how to perform animations using ngClass.
 
-   <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-class">
+   <example module="ngAnimate" deps="angular-animate.js" animations="true">
      <file name="index.html">
       <input id="setbtn" type="button" value="set" ng-click="myVar='my-class'">
       <input id="clearbtn" type="button" value="clear" ng-click="myVar=''">
@@ -36600,7 +33571,7 @@ var ngClassDirective = classDirective('', true);
  *   of the evaluation can be a string representing space delimited class names or an array.
  *
  * @example
-   <example name="ng-class-odd">
+   <example>
      <file name="index.html">
         <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
           <li ng-repeat="name in names">
@@ -36648,7 +33619,7 @@ var ngClassOddDirective = classDirective('Odd', 0);
  *   result of the evaluation can be a string representing space delimited class names or an array.
  *
  * @example
-   <example name="ng-class-even">
+   <example>
      <file name="index.html">
         <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
           <li ng-repeat="name in names">
@@ -36714,7 +33685,7 @@ var ngClassEvenDirective = classDirective('Even', 1);
  * @element ANY
  *
  * @example
-   <example name="ng-cloak">
+   <example>
      <file name="index.html">
         <div id="template1" ng-cloak>{{ 'hello' }}</div>
         <div id="template2" class="ng-cloak">{{ 'world' }}</div>
@@ -36770,7 +33741,7 @@ var ngCloakDirective = ngDirective({
  *
  * If the current `$controllerProvider` is configured to use globals (via
  * {@link ng.$controllerProvider#allowGlobals `$controllerProvider.allowGlobals()` }), this may
- * also be the name of a globally accessible constructor function (deprecated, not recommended).
+ * also be the name of a globally accessible constructor function (not recommended).
  *
  * @example
  * Here is a simple form for editing user contact information. Adding, removing, clearing, and
@@ -36823,11 +33794,10 @@ var ngCloakDirective = ngDirective({
  *      .controller('SettingsController1', SettingsController1);
  *
  *    function SettingsController1() {
- *      this.name = 'John Smith';
+ *      this.name = "John Smith";
  *      this.contacts = [
  *        {type: 'phone', value: '408 555 1212'},
- *        {type: 'email', value: 'john.smith@example.org'}
- *      ];
+ *        {type: 'email', value: 'john.smith@example.org'} ];
  *    }
  *
  *    SettingsController1.prototype.greet = function() {
@@ -36907,11 +33877,10 @@ var ngCloakDirective = ngDirective({
  *     .controller('SettingsController2', ['$scope', SettingsController2]);
  *
  *   function SettingsController2($scope) {
- *     $scope.name = 'John Smith';
+ *     $scope.name = "John Smith";
  *     $scope.contacts = [
  *       {type:'phone', value:'408 555 1212'},
- *       {type:'email', value:'john.smith@example.org'}
- *     ];
+ *       {type:'email', value:'john.smith@example.org'} ];
  *
  *     $scope.greet = function() {
  *       alert($scope.name);
@@ -36978,38 +33947,31 @@ var ngControllerDirective = [function() {
  * @ngdoc directive
  * @name ngCsp
  *
- * @restrict A
- * @element ANY
+ * @element html
  * @description
  *
- * Angular has some features that can conflict with certain restrictions that are applied when using
+ * Angular has some features that can break certain
  * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.
  *
- * If you intend to implement CSP with these rules then you must tell Angular not to use these
- * features.
+ * If you intend to implement these rules then you must tell Angular not to use these features.
  *
  * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.
  *
  *
- * The following default rules in CSP affect Angular:
+ * The following rules affect Angular:
  *
- * * The use of `eval()`, `Function(string)` and similar functions to dynamically create and execute
- * code from strings is forbidden. Angular makes use of this in the {@link $parse} service to
- * provide a 30% increase in the speed of evaluating Angular expressions. (This CSP rule can be
- * disabled with the CSP keyword `unsafe-eval`, but it is generally not recommended as it would
- * weaken the protections offered by CSP.)
+ * * `unsafe-eval`: this rule forbids apps to use `eval` or `Function(string)` generated functions
+ * (among other things). Angular makes use of this in the {@link $parse} service to provide a 30%
+ * increase in the speed of evaluating Angular expressions.
  *
- * * The use of inline resources, such as inline `<script>` and `<style>` elements, are forbidden.
- * This prevents apps from injecting custom styles directly into the document. Angular makes use of
- * this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}). To make these
- * directives work when a CSP rule is blocking inline styles, you must link to the `angular-csp.css`
- * in your HTML manually. (This CSP rule can be disabled with the CSP keyword `unsafe-inline`, but
- * it is generally not recommended as it would weaken the protections offered by CSP.)
+ * * `unsafe-inline`: this rule forbids apps from inject custom styles into the document. Angular
+ * makes use of this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}).
+ * To make these directives work when a CSP rule is blocking inline styles, you must link to the
+ * `angular-csp.css` in your HTML manually.
  *
- * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking dynamic code
- * creation from strings (e.g., `unsafe-eval` not specified in CSP header) and automatically
- * deactivates this feature in the {@link $parse} service. This autodetection, however, triggers a
- * CSP error to be logged in the console:
+ * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking unsafe-eval
+ * and automatically deactivates this feature in the {@link $parse} service. This autodetection,
+ * however, triggers a CSP error to be logged in the console:
  *
  * ```
  * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
@@ -37034,15 +33996,15 @@ var ngControllerDirective = [function() {
  *
  *
  * * No declaration means that Angular will assume that you can do inline styles, but it will do
- * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous
- * versions of Angular.
+ * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions
+ * of Angular.
  *
  * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell Angular to deactivate both inline
- * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous
- * versions of Angular.
+ * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions
+ * of Angular.
  *
- * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can
- * inject inline styles. E.g. `<body ng-csp="no-unsafe-eval">`.
+ * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can inject
+ * inline styles. E.g. `<body ng-csp="no-unsafe-eval">`.
  *
  * * Specifying only `no-inline-style` tells Angular that we must not inject styles, but that we can
  * run eval - no automatic check for unsafe eval will occur. E.g. `<body ng-csp="no-inline-style">`
@@ -37061,7 +34023,8 @@ var ngControllerDirective = [function() {
      </html>
    ```
   * @example
-      <!-- Note: the `.csp` suffix in the example name triggers CSP mode in our http server! -->
+      // Note: the suffix `.csp` in the example name triggers
+      // csp mode in our http server!
       <example name="example.csp" module="cspExample" ng-csp="true">
         <file name="index.html">
           <div ng-controller="MainController as ctrl">
@@ -37082,14 +34045,15 @@ var ngControllerDirective = [function() {
         </file>
         <file name="script.js">
            angular.module('cspExample', [])
-             .controller('MainController', function MainController() {
+             .controller('MainController', function() {
                 this.counter = 0;
                 this.inc = function() {
                   this.counter++;
                 };
                 this.evil = function() {
+                  // jshint evil:true
                   try {
-                    eval('1+2'); // eslint-disable-line no-eval
+                    eval('1+2');
                   } catch (e) {
                     this.evilError = e.message;
                   }
@@ -37141,7 +34105,7 @@ var ngControllerDirective = [function() {
 
           beforeEach(function() {
             util = require('util');
-            webdriver = require('selenium-webdriver');
+            webdriver = require('protractor/node_modules/selenium-webdriver');
           });
 
           // For now, we only test on Chrome,
@@ -37178,9 +34142,9 @@ var ngControllerDirective = [function() {
       </example>
   */
 
-// `ngCsp` is not implemented as a proper directive any more, because we need it be processed while
-// we bootstrap the app (before `$parse` is instantiated). For this reason, we just have the `csp()`
-// fn that looks for the `ng-csp` attribute anywhere in the current doc.
+// ngCsp is not implemented as a proper directive any more, because we need it be processed while we
+// bootstrap the system (before $parse is instantiated), for this reason we just have
+// the csp() fn that looks for the `ng-csp` attribute anywhere in the current doc
 
 /**
  * @ngdoc directive
@@ -37196,7 +34160,7 @@ var ngControllerDirective = [function() {
  * click. ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example name="ng-click">
+   <example>
      <file name="index.html">
       <button ng-click="count = count + 1" ng-init="count=0">
         Increment
@@ -37235,15 +34199,15 @@ forEach(
       return {
         restrict: 'A',
         compile: function($element, attr) {
-          // NOTE:
-          // We expose the powerful `$event` object on the scope that provides access to the Window,
-          // etc. This is OK, because expressions are not sandboxed any more (and the expression
-          // sandbox was never meant to be a security feature anyway).
-          var fn = $parse(attr[directiveName]);
+          // We expose the powerful $event object on the scope that provides access to the Window,
+          // etc. that isn't protected by the fast paths in $parse.  We explicitly request better
+          // checks at the cost of speed since event handler expressions are not executed as
+          // frequently as regular change detection.
+          var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);
           return function ngEventHandler(scope, element) {
             element.on(eventName, function(event) {
               var callback = function() {
-                fn(scope, {$event: event});
+                fn(scope, {$event:event});
               };
               if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
                 scope.$evalAsync(callback);
@@ -37271,7 +34235,7 @@ forEach(
  * a dblclick. (The Event object is available as `$event`)
  *
  * @example
-   <example name="ng-dblclick">
+   <example>
      <file name="index.html">
       <button ng-dblclick="count = count + 1" ng-init="count=0">
         Increment (on double click)
@@ -37295,7 +34259,7 @@ forEach(
  * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example name="ng-mousedown">
+   <example>
      <file name="index.html">
       <button ng-mousedown="count = count + 1" ng-init="count=0">
         Increment (on mouse down)
@@ -37319,7 +34283,7 @@ forEach(
  * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example name="ng-mouseup">
+   <example>
      <file name="index.html">
       <button ng-mouseup="count = count + 1" ng-init="count=0">
         Increment (on mouse up)
@@ -37342,7 +34306,7 @@ forEach(
  * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example name="ng-mouseover">
+   <example>
      <file name="index.html">
       <button ng-mouseover="count = count + 1" ng-init="count=0">
         Increment (when mouse is over)
@@ -37366,7 +34330,7 @@ forEach(
  * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example name="ng-mouseenter">
+   <example>
      <file name="index.html">
       <button ng-mouseenter="count = count + 1" ng-init="count=0">
         Increment (when mouse enters)
@@ -37390,7 +34354,7 @@ forEach(
  * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example name="ng-mouseleave">
+   <example>
      <file name="index.html">
       <button ng-mouseleave="count = count + 1" ng-init="count=0">
         Increment (when mouse leaves)
@@ -37414,7 +34378,7 @@ forEach(
  * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example name="ng-mousemove">
+   <example>
      <file name="index.html">
       <button ng-mousemove="count = count + 1" ng-init="count=0">
         Increment (when mouse moves)
@@ -37438,7 +34402,7 @@ forEach(
  * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
  *
  * @example
-   <example name="ng-keydown">
+   <example>
      <file name="index.html">
       <input ng-keydown="count = count + 1" ng-init="count=0">
       key down count: {{count}}
@@ -37460,7 +34424,7 @@ forEach(
  * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
  *
  * @example
-   <example name="ng-keyup">
+   <example>
      <file name="index.html">
        <p>Typing in the input box below updates the key count</p>
        <input ng-keyup="count = count + 1" ng-init="count=0"> key up count: {{count}}
@@ -37487,7 +34451,7 @@ forEach(
  * and can be interrogated for keyCode, altKey, etc.)
  *
  * @example
-   <example name="ng-keypress">
+   <example>
      <file name="index.html">
       <input ng-keypress="count = count + 1" ng-init="count=0">
       key press count: {{count}}
@@ -37520,7 +34484,7 @@ forEach(
  * ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example module="submitExample" name="ng-submit">
+   <example module="submitExample">
      <file name="index.html">
       <script>
         angular.module('submitExample', [])
@@ -37616,7 +34580,7 @@ forEach(
  * copy. ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example name="ng-copy">
+   <example>
      <file name="index.html">
       <input ng-copy="copied=true" ng-init="copied=false; value='copy me'" ng-model="value">
       copied: {{copied}}
@@ -37637,7 +34601,7 @@ forEach(
  * cut. ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example name="ng-cut">
+   <example>
      <file name="index.html">
       <input ng-cut="cut=true" ng-init="cut=false; value='cut me'" ng-model="value">
       cut: {{cut}}
@@ -37658,7 +34622,7 @@ forEach(
  * paste. ({@link guide/expression#-event- Event object is available as `$event`})
  *
  * @example
-   <example name="ng-paste">
+   <example>
      <file name="index.html">
       <input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'>
       pasted: {{paste}}
@@ -37713,7 +34677,7 @@ forEach(
  *     element is added to the DOM tree.
  *
  * @example
-  <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-if">
+  <example module="ngAnimate" deps="angular-animate.js" animations="true">
     <file name="index.html">
       <label>Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /></label><br/>
       Show when checked:
@@ -37781,8 +34745,8 @@ var ngIfDirective = ['$animate', '$compile', function($animate, $compile) {
             }
             if (block) {
               previousElements = getBlockNodes(block.clone);
-              $animate.leave(previousElements).done(function(response) {
-                if (response !== false) previousElements = null;
+              $animate.leave(previousElements).then(function() {
+                previousElements = null;
               });
               block = null;
             }
@@ -37843,7 +34807,7 @@ var ngIfDirective = ['$animate', '$compile', function($animate, $compile) {
  *                  - Otherwise enable scrolling only if the expression evaluates to truthy value.
  *
  * @example
-  <example module="includeExample" deps="angular-animate.js" animations="true" name="ng-include">
+  <example module="includeExample" deps="angular-animate.js" animations="true">
     <file name="index.html">
      <div ng-controller="ExampleController">
        <select ng-model="template" ng-options="t.name for t in templates">
@@ -37860,8 +34824,8 @@ var ngIfDirective = ['$animate', '$compile', function($animate, $compile) {
       angular.module('includeExample', ['ngAnimate'])
         .controller('ExampleController', ['$scope', function($scope) {
           $scope.templates =
-            [{ name: 'template1.html', url: 'template1.html'},
-             { name: 'template2.html', url: 'template2.html'}];
+            [ { name: 'template1.html', url: 'template1.html'},
+              { name: 'template2.html', url: 'template2.html'} ];
           $scope.template = $scope.templates[0];
         }]);
      </file>
@@ -37919,7 +34883,7 @@ var ngIfDirective = ['$animate', '$compile', function($animate, $compile) {
       });
 
       it('should load template2.html', function() {
-        if (browser.params.browser === 'firefox') {
+        if (browser.params.browser == 'firefox') {
           // Firefox can't handle using selects
           // See https://github.com/angular/protractor/issues/480
           return;
@@ -37930,7 +34894,7 @@ var ngIfDirective = ['$animate', '$compile', function($animate, $compile) {
       });
 
       it('should change to blank', function() {
-        if (browser.params.browser === 'firefox') {
+        if (browser.params.browser == 'firefox') {
           // Firefox can't handle using selects
           return;
         }
@@ -38006,8 +34970,8 @@ var ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',
             currentScope = null;
           }
           if (currentElement) {
-            $animate.leave(currentElement).done(function(response) {
-              if (response !== false) previousElement = null;
+            $animate.leave(currentElement).then(function() {
+              previousElement = null;
             });
             previousElement = currentElement;
             currentElement = null;
@@ -38015,10 +34979,9 @@ var ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',
         };
 
         scope.$watch(srcExp, function ngIncludeWatchAction(src) {
-          var afterAnimation = function(response) {
-            if (response !== false && isDefined(autoScrollExp) &&
-              (!autoScrollExp || scope.$eval(autoScrollExp))) {
-                $anchorScroll();
+          var afterAnimation = function() {
+            if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
+              $anchorScroll();
             }
           };
           var thisChangeId = ++changeCounter;
@@ -38041,7 +35004,7 @@ var ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',
               // directives to non existing elements.
               var clone = $transclude(newScope, function(clone) {
                 cleanupLastIncludeContent();
-                $animate.enter(clone, null, $element).done(afterAnimation);
+                $animate.enter(clone, null, $element).then(afterAnimation);
               });
 
               currentScope = newScope;
@@ -38129,7 +35092,7 @@ var ngIncludeFillContentDirective = ['$compile',
  * @param {expression} ngInit {@link guide/expression Expression} to eval.
  *
  * @example
-   <example module="initExample" name="ng-init">
+   <example module="initExample">
      <file name="index.html">
    <script>
      angular.module('initExample', [])
@@ -38257,7 +35220,9 @@ var ngListDirective = function() {
     priority: 100,
     require: 'ngModel',
     link: function(scope, element, attr, ctrl) {
-      var ngList = attr.ngList || ', ';
+      // We want to control whitespace trimming so we use this convoluted approach
+      // to access the ngList attribute, which doesn't pre-trim the attribute
+      var ngList = element.attr(attr.$attr.ngList) || ', ';
       var trimValues = attr.ngTrim !== 'false';
       var separator = trimValues ? trim(ngList) : ngList;
 
@@ -38299,19 +35264,15 @@ var ngListDirective = function() {
   DIRTY_CLASS: true,
   UNTOUCHED_CLASS: true,
   TOUCHED_CLASS: true,
-  PENDING_CLASS: true,
-  addSetValidityMethod: true,
-  setupValidity: true,
-  defaultModelOptions: false
 */
 
-
 var VALID_CLASS = 'ng-valid',
     INVALID_CLASS = 'ng-invalid',
     PRISTINE_CLASS = 'ng-pristine',
     DIRTY_CLASS = 'ng-dirty',
     UNTOUCHED_CLASS = 'ng-untouched',
     TOUCHED_CLASS = 'ng-touched',
+    PENDING_CLASS = 'ng-pending',
     EMPTY_CLASS = 'ng-empty',
     NOT_EMPTY_CLASS = 'ng-not-empty';
 
@@ -38324,57 +35285,32 @@ var ngModelMinErr = minErr('ngModel');
  * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a
  * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue
  * is set.
- *
  * @property {*} $modelValue The value in the model that the control is bound to.
- *
  * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever
- *  the control updates the ngModelController with a new {@link ngModel.NgModelController#$viewValue
-    `$viewValue`} from the DOM, usually via user input.
-    See {@link ngModel.NgModelController#$setViewValue `$setViewValue()`} for a detailed lifecycle explanation.
-    Note that the `$parsers` are not called when the bound ngModel expression changes programmatically.
-
-  The functions are called in array order, each passing
-    its return value through to the next. The last return value is forwarded to the
-    {@link ngModel.NgModelController#$validators `$validators`} collection.
+       the control reads value from the DOM. The functions are called in array order, each passing
+       its return value through to the next. The last return value is forwarded to the
+       {@link ngModel.NgModelController#$validators `$validators`} collection.
 
-  Parsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue
-    `$viewValue`}.
+Parsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue
+`$viewValue`}.
 
-  Returning `undefined` from a parser means a parse error occurred. In that case,
-    no {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel`
-    will be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`}
-    is set to `true`. The parse error is stored in `ngModel.$error.parse`.
-
-  This simple example shows a parser that would convert text input value to lowercase:
- * ```js
- * function parse(value) {
- *   if (value) {
- *     return value.toLowerCase();
- *   }
- * }
- * ngModelController.$parsers.push(parse);
- * ```
+Returning `undefined` from a parser means a parse error occurred. In that case,
+no {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel`
+will be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`}
+is set to `true`. The parse error is stored in `ngModel.$error.parse`.
 
  *
  * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
-    the bound ngModel expression changes programmatically. The `$formatters` are not called when the
-    value of the control is changed by user interaction.
-
-  Formatters are used to format / convert the {@link ngModel.NgModelController#$modelValue
-    `$modelValue`} for display in the control.
-
-  The functions are called in reverse array order, each passing the value through to the
-    next. The last return value is used as the actual DOM value.
-
-  This simple example shows a formatter that would convert the model value to uppercase:
-
+       the model value changes. The functions are called in reverse array order, each passing the value through to the
+       next. The last return value is used as the actual DOM value.
+       Used to format / convert values for display in the control.
  * ```js
- * function format(value) {
+ * function formatter(value) {
  *   if (value) {
  *     return value.toUpperCase();
  *   }
  * }
- * ngModel.$formatters.push(format);
+ * ngModel.$formatters.push(formatter);
  * ```
  *
  * @property {Object.<string, function>} $validators A collection of validators that are applied
@@ -38500,7 +35436,7 @@ var ngModelMinErr = minErr('ngModel');
                 var html = element.html();
                 // When we clear the content editable the browser leaves a <br> behind
                 // If strip-br attribute is provided then we strip this out
-                if (attrs.stripBr && html === '<br>') {
+                if ( attrs.stripBr && html == '<br>' ) {
                   html = '';
                 }
                 ngModel.$setViewValue(html);
@@ -38522,7 +35458,7 @@ var ngModelMinErr = minErr('ngModel');
     </file>
     <file name="protractor.js" type="protractor">
     it('should data-bind and become invalid', function() {
-      if (browser.params.browser === 'safari' || browser.params.browser === 'firefox') {
+      if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {
         // SafariDriver can't handle contenteditable
         // and Firefox driver can't clear contenteditables very well
         return;
@@ -38542,8 +35478,8 @@ var ngModelMinErr = minErr('ngModel');
  *
  *
  */
-NgModelController.$inject = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$q', '$interpolate'];
-function NgModelController($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $q, $interpolate) {
+var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate',
+    function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) {
   this.$viewValue = Number.NaN;
   this.$modelValue = Number.NaN;
   this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.
@@ -38563,58 +35499,40 @@ function NgModelController($scope, $exceptionHandler, $attr, $element, $parse, $
   this.$pending = undefined; // keep pending keys here
   this.$name = $interpolate($attr.name || '', false)($scope);
   this.$$parentForm = nullFormCtrl;
-  this.$options = defaultModelOptions;
-
-  this.$$parsedNgModel = $parse($attr.ngModel);
-  this.$$parsedNgModelAssign = this.$$parsedNgModel.assign;
-  this.$$ngModelGet = this.$$parsedNgModel;
-  this.$$ngModelSet = this.$$parsedNgModelAssign;
-  this.$$pendingDebounce = null;
-  this.$$parserValid = undefined;
-
-  this.$$currentValidationRunId = 0;
-
-  // https://github.com/angular/angular.js/issues/15833
-  // Prevent `$$scope` from being iterated over by `copy` when NgModelController is deep watched
-  Object.defineProperty(this, '$$scope', {value: $scope});
-  this.$$attr = $attr;
-  this.$$element = $element;
-  this.$$animate = $animate;
-  this.$$timeout = $timeout;
-  this.$$parse = $parse;
-  this.$$q = $q;
-  this.$$exceptionHandler = $exceptionHandler;
-
-  setupValidity(this);
-  setupModelWatcher(this);
-}
-
-NgModelController.prototype = {
-  $$initGetterSetters: function() {
-    if (this.$options.getOption('getterSetter')) {
-      var invokeModelGetter = this.$$parse(this.$$attr.ngModel + '()'),
-          invokeModelSetter = this.$$parse(this.$$attr.ngModel + '($$$p)');
-
-      this.$$ngModelGet = function($scope) {
-        var modelValue = this.$$parsedNgModel($scope);
+
+  var parsedNgModel = $parse($attr.ngModel),
+      parsedNgModelAssign = parsedNgModel.assign,
+      ngModelGet = parsedNgModel,
+      ngModelSet = parsedNgModelAssign,
+      pendingDebounce = null,
+      parserValid,
+      ctrl = this;
+
+  this.$$setOptions = function(options) {
+    ctrl.$options = options;
+    if (options && options.getterSetter) {
+      var invokeModelGetter = $parse($attr.ngModel + '()'),
+          invokeModelSetter = $parse($attr.ngModel + '($$$p)');
+
+      ngModelGet = function($scope) {
+        var modelValue = parsedNgModel($scope);
         if (isFunction(modelValue)) {
           modelValue = invokeModelGetter($scope);
         }
         return modelValue;
       };
-      this.$$ngModelSet = function($scope, newValue) {
-        if (isFunction(this.$$parsedNgModel($scope))) {
+      ngModelSet = function($scope, newValue) {
+        if (isFunction(parsedNgModel($scope))) {
           invokeModelSetter($scope, {$$$p: newValue});
         } else {
-          this.$$parsedNgModelAssign($scope, newValue);
+          parsedNgModelAssign($scope, newValue);
         }
       };
-    } else if (!this.$$parsedNgModel.assign) {
-      throw ngModelMinErr('nonassign', 'Expression \'{0}\' is non-assignable. Element: {1}',
-          this.$$attr.ngModel, startingTag(this.$$element));
+    } else if (!parsedNgModel.assign) {
+      throw ngModelMinErr('nonassign', "Expression '{0}' is non-assignable. Element: {1}",
+          $attr.ngModel, startingTag($element));
     }
-  },
-
+  };
 
   /**
    * @ngdoc method
@@ -38636,7 +35554,7 @@ NgModelController.prototype = {
    * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be
    * invoked if you only change a property on the objects.
    */
-  $render: noop,
+  this.$render = noop;
 
   /**
    * @ngdoc method
@@ -38656,20 +35574,56 @@ NgModelController.prototype = {
    * @param {*} value The value of the input to check for emptiness.
    * @returns {boolean} True if `value` is "empty".
    */
-  $isEmpty: function(value) {
-    // eslint-disable-next-line no-self-compare
+  this.$isEmpty = function(value) {
     return isUndefined(value) || value === '' || value === null || value !== value;
-  },
+  };
 
-  $$updateEmptyClasses: function(value) {
-    if (this.$isEmpty(value)) {
-      this.$$animate.removeClass(this.$$element, NOT_EMPTY_CLASS);
-      this.$$animate.addClass(this.$$element, EMPTY_CLASS);
+  this.$$updateEmptyClasses = function(value) {
+    if (ctrl.$isEmpty(value)) {
+      $animate.removeClass($element, NOT_EMPTY_CLASS);
+      $animate.addClass($element, EMPTY_CLASS);
     } else {
-      this.$$animate.removeClass(this.$$element, EMPTY_CLASS);
-      this.$$animate.addClass(this.$$element, NOT_EMPTY_CLASS);
+      $animate.removeClass($element, EMPTY_CLASS);
+      $animate.addClass($element, NOT_EMPTY_CLASS);
     }
-  },
+  };
+
+
+  var currentValidationRunId = 0;
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$setValidity
+   *
+   * @description
+   * Change the validity state, and notify the form.
+   *
+   * This method can be called within $parsers/$formatters or a custom validation implementation.
+   * However, in most cases it should be sufficient to use the `ngModel.$validators` and
+   * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.
+   *
+   * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned
+   *        to either `$error[validationErrorKey]` or `$pending[validationErrorKey]`
+   *        (for unfulfilled `$asyncValidators`), so that it is available for data-binding.
+   *        The `validationErrorKey` should be in camelCase and will get converted into dash-case
+   *        for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`
+   *        class and can be bound to as  `{{someForm.someControl.$error.myError}}` .
+   * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined),
+   *                          or skipped (null). Pending is used for unfulfilled `$asyncValidators`.
+   *                          Skipped is used by Angular when validators do not run because of parse errors and
+   *                          when `$asyncValidators` do not run because any of the `$validators` failed.
+   */
+  addSetValidityMethod({
+    ctrl: this,
+    $element: $element,
+    set: function(object, property) {
+      object[property] = true;
+    },
+    unset: function(object, property) {
+      delete object[property];
+    },
+    $animate: $animate
+  });
 
   /**
    * @ngdoc method
@@ -38682,12 +35636,12 @@ NgModelController.prototype = {
    * state (`ng-pristine` class). A model is considered to be pristine when the control
    * has not been changed from when first compiled.
    */
-  $setPristine: function() {
-    this.$dirty = false;
-    this.$pristine = true;
-    this.$$animate.removeClass(this.$$element, DIRTY_CLASS);
-    this.$$animate.addClass(this.$$element, PRISTINE_CLASS);
-  },
+  this.$setPristine = function() {
+    ctrl.$dirty = false;
+    ctrl.$pristine = true;
+    $animate.removeClass($element, DIRTY_CLASS);
+    $animate.addClass($element, PRISTINE_CLASS);
+  };
 
   /**
    * @ngdoc method
@@ -38700,13 +35654,13 @@ NgModelController.prototype = {
    * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed
    * from when first compiled.
    */
-  $setDirty: function() {
-    this.$dirty = true;
-    this.$pristine = false;
-    this.$$animate.removeClass(this.$$element, PRISTINE_CLASS);
-    this.$$animate.addClass(this.$$element, DIRTY_CLASS);
-    this.$$parentForm.$setDirty();
-  },
+  this.$setDirty = function() {
+    ctrl.$dirty = true;
+    ctrl.$pristine = false;
+    $animate.removeClass($element, PRISTINE_CLASS);
+    $animate.addClass($element, DIRTY_CLASS);
+    ctrl.$$parentForm.$setDirty();
+  };
 
   /**
    * @ngdoc method
@@ -38720,11 +35674,11 @@ NgModelController.prototype = {
    * by default, however this function can be used to restore that state if the model has
    * already been touched by the user.
    */
-  $setUntouched: function() {
-    this.$touched = false;
-    this.$untouched = true;
-    this.$$animate.setClass(this.$$element, UNTOUCHED_CLASS, TOUCHED_CLASS);
-  },
+  this.$setUntouched = function() {
+    ctrl.$touched = false;
+    ctrl.$untouched = true;
+    $animate.setClass($element, UNTOUCHED_CLASS, TOUCHED_CLASS);
+  };
 
   /**
    * @ngdoc method
@@ -38737,11 +35691,11 @@ NgModelController.prototype = {
    * touched state (`ng-touched` class). A model is considered to be touched when the user has
    * first focused the control element and then shifted focus away from the control (blur event).
    */
-  $setTouched: function() {
-    this.$touched = true;
-    this.$untouched = false;
-    this.$$animate.setClass(this.$$element, TOUCHED_CLASS, UNTOUCHED_CLASS);
-  },
+  this.$setTouched = function() {
+    ctrl.$touched = true;
+    ctrl.$untouched = false;
+    $animate.setClass($element, TOUCHED_CLASS, UNTOUCHED_CLASS);
+  };
 
   /**
    * @ngdoc method
@@ -38749,12 +35703,12 @@ NgModelController.prototype = {
    *
    * @description
    * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,
-   * which may be caused by a pending debounced event or because the input is waiting for some
+   * which may be caused by a pending debounced event or because the input is waiting for a some
    * future event.
    *
    * If you have an input that uses `ng-model-options` to set up debounced updates or updates that
-   * depend on special events such as `blur`, there can be a period when the `$viewValue` is out of
-   * sync with the ngModel's `$modelValue`.
+   * depend on special events such as blur, you can have a situation where there is a period when
+   * the `$viewValue` is out of sync with the ngModel's `$modelValue`.
    *
    * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update
    * and reset the input to the last committed view value.
@@ -38772,10 +35726,10 @@ NgModelController.prototype = {
    *     angular.module('cancel-update-example', [])
    *
    *     .controller('CancelUpdateController', ['$scope', function($scope) {
-   *       $scope.model = {value1: '', value2: ''};
+   *       $scope.model = {};
    *
    *       $scope.setEmpty = function(e, value, rollback) {
-   *         if (e.keyCode === 27) {
+   *         if (e.keyCode == 27) {
    *           e.preventDefault();
    *           if (rollback) {
    *             $scope.myForm[value].$rollbackViewValue();
@@ -38787,8 +35741,8 @@ NgModelController.prototype = {
    *   </file>
    *   <file name="index.html">
    *     <div ng-controller="CancelUpdateController">
-   *       <p>Both of these inputs are only updated if they are blurred. Hitting escape should
-   *       empty them. Follow these steps and observe the difference:</p>
+   *        <p>Both of these inputs are only updated if they are blurred. Hitting escape should
+   *        empty them. Follow these steps and observe the difference:</p>
    *       <ol>
    *         <li>Type something in the input. You will see that the model is not yet updated</li>
    *         <li>Press the Escape key.
@@ -38805,17 +35759,17 @@ NgModelController.prototype = {
    *
    *       <form name="myForm" ng-model-options="{ updateOn: 'blur' }">
    *         <div>
-   *           <p id="inputDescription1">Without $rollbackViewValue():</p>
-   *           <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
-   *                  ng-keydown="setEmpty($event, 'value1')">
-   *           value1: "{{ model.value1 }}"
+   *        <p id="inputDescription1">Without $rollbackViewValue():</p>
+   *         <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
+   *                ng-keydown="setEmpty($event, 'value1')">
+   *         value1: "{{ model.value1 }}"
    *         </div>
    *
    *         <div>
-   *           <p id="inputDescription2">With $rollbackViewValue():</p>
-   *           <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
-   *                  ng-keydown="setEmpty($event, 'value2', true)">
-   *           value2: "{{ model.value2 }}"
+   *        <p id="inputDescription2">With $rollbackViewValue():</p>
+   *         <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
+   *                ng-keydown="setEmpty($event, 'value2', true)">
+   *         value2: "{{ model.value2 }}"
    *         </div>
    *       </form>
    *     </div>
@@ -38831,11 +35785,11 @@ NgModelController.prototype = {
         </file>
    * </example>
    */
-  $rollbackViewValue: function() {
-    this.$$timeout.cancel(this.$$pendingDebounce);
-    this.$viewValue = this.$$lastCommittedViewValue;
-    this.$render();
-  },
+  this.$rollbackViewValue = function() {
+    $timeout.cancel(pendingDebounce);
+    ctrl.$viewValue = ctrl.$$lastCommittedViewValue;
+    ctrl.$render();
+  };
 
   /**
    * @ngdoc method
@@ -38849,46 +35803,45 @@ NgModelController.prototype = {
    * If the validity changes to valid, it will set the model to the last available valid
    * `$modelValue`, i.e. either the last parsed value or the last value set from the scope.
    */
-  $validate: function() {
+  this.$validate = function() {
     // ignore $validate before model is initialized
-    if (isNumberNaN(this.$modelValue)) {
+    if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {
       return;
     }
 
-    var viewValue = this.$$lastCommittedViewValue;
+    var viewValue = ctrl.$$lastCommittedViewValue;
     // Note: we use the $$rawModelValue as $modelValue might have been
     // set to undefined during a view -> model update that found validation
     // errors. We can't parse the view here, since that could change
     // the model although neither viewValue nor the model on the scope changed
-    var modelValue = this.$$rawModelValue;
+    var modelValue = ctrl.$$rawModelValue;
 
-    var prevValid = this.$valid;
-    var prevModelValue = this.$modelValue;
+    var prevValid = ctrl.$valid;
+    var prevModelValue = ctrl.$modelValue;
 
-    var allowInvalid = this.$options.getOption('allowInvalid');
+    var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
 
-    var that = this;
-    this.$$runValidators(modelValue, viewValue, function(allValid) {
+    ctrl.$$runValidators(modelValue, viewValue, function(allValid) {
       // If there was no change in validity, don't update the model
       // This prevents changing an invalid modelValue to undefined
       if (!allowInvalid && prevValid !== allValid) {
-        // Note: Don't check this.$valid here, as we could have
+        // Note: Don't check ctrl.$valid here, as we could have
         // external validators (e.g. calculated on the server),
         // that just call $setValidity and need the model value
         // to calculate their validity.
-        that.$modelValue = allValid ? modelValue : undefined;
+        ctrl.$modelValue = allValid ? modelValue : undefined;
 
-        if (that.$modelValue !== prevModelValue) {
-          that.$$writeModelToScope();
+        if (ctrl.$modelValue !== prevModelValue) {
+          ctrl.$$writeModelToScope();
         }
       }
     });
-  },
 
-  $$runValidators: function(modelValue, viewValue, doneCallback) {
-    this.$$currentValidationRunId++;
-    var localValidationRunId = this.$$currentValidationRunId;
-    var that = this;
+  };
+
+  this.$$runValidators = function(modelValue, viewValue, doneCallback) {
+    currentValidationRunId++;
+    var localValidationRunId = currentValidationRunId;
 
     // check parser error
     if (!processParseErrors()) {
@@ -38902,34 +35855,34 @@ NgModelController.prototype = {
     processAsyncValidators();
 
     function processParseErrors() {
-      var errorKey = that.$$parserName || 'parse';
-      if (isUndefined(that.$$parserValid)) {
+      var errorKey = ctrl.$$parserName || 'parse';
+      if (isUndefined(parserValid)) {
         setValidity(errorKey, null);
       } else {
-        if (!that.$$parserValid) {
-          forEach(that.$validators, function(v, name) {
+        if (!parserValid) {
+          forEach(ctrl.$validators, function(v, name) {
             setValidity(name, null);
           });
-          forEach(that.$asyncValidators, function(v, name) {
+          forEach(ctrl.$asyncValidators, function(v, name) {
             setValidity(name, null);
           });
         }
         // Set the parse error last, to prevent unsetting it, should a $validators key == parserName
-        setValidity(errorKey, that.$$parserValid);
-        return that.$$parserValid;
+        setValidity(errorKey, parserValid);
+        return parserValid;
       }
       return true;
     }
 
     function processSyncValidators() {
       var syncValidatorsValid = true;
-      forEach(that.$validators, function(validator, name) {
-        var result = Boolean(validator(modelValue, viewValue));
+      forEach(ctrl.$validators, function(validator, name) {
+        var result = validator(modelValue, viewValue);
         syncValidatorsValid = syncValidatorsValid && result;
         setValidity(name, result);
       });
       if (!syncValidatorsValid) {
-        forEach(that.$asyncValidators, function(v, name) {
+        forEach(ctrl.$asyncValidators, function(v, name) {
           setValidity(name, null);
         });
         return false;
@@ -38940,11 +35893,11 @@ NgModelController.prototype = {
     function processAsyncValidators() {
       var validatorPromises = [];
       var allValid = true;
-      forEach(that.$asyncValidators, function(validator, name) {
+      forEach(ctrl.$asyncValidators, function(validator, name) {
         var promise = validator(modelValue, viewValue);
         if (!isPromiseLike(promise)) {
           throw ngModelMinErr('nopromise',
-            'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise);
+            "Expected asynchronous validator to return a promise but got '{0}' instead.", promise);
         }
         setValidity(name, undefined);
         validatorPromises.push(promise.then(function() {
@@ -38957,25 +35910,25 @@ NgModelController.prototype = {
       if (!validatorPromises.length) {
         validationDone(true);
       } else {
-        that.$$q.all(validatorPromises).then(function() {
+        $q.all(validatorPromises).then(function() {
           validationDone(allValid);
         }, noop);
       }
     }
 
     function setValidity(name, isValid) {
-      if (localValidationRunId === that.$$currentValidationRunId) {
-        that.$setValidity(name, isValid);
+      if (localValidationRunId === currentValidationRunId) {
+        ctrl.$setValidity(name, isValid);
       }
     }
 
     function validationDone(allValid) {
-      if (localValidationRunId === that.$$currentValidationRunId) {
+      if (localValidationRunId === currentValidationRunId) {
 
         doneCallback(allValid);
       }
     }
-  },
+  };
 
   /**
    * @ngdoc method
@@ -38988,87 +35941,84 @@ NgModelController.prototype = {
    * event defined in `ng-model-options`. this method is rarely needed as `NgModelController`
    * usually handles calling this in response to input events.
    */
-  $commitViewValue: function() {
-    var viewValue = this.$viewValue;
+  this.$commitViewValue = function() {
+    var viewValue = ctrl.$viewValue;
 
-    this.$$timeout.cancel(this.$$pendingDebounce);
+    $timeout.cancel(pendingDebounce);
 
     // If the view value has not changed then we should just exit, except in the case where there is
     // a native validator on the element. In this case the validation state may have changed even though
     // the viewValue has stayed empty.
-    if (this.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !this.$$hasNativeValidators)) {
+    if (ctrl.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !ctrl.$$hasNativeValidators)) {
       return;
     }
-    this.$$updateEmptyClasses(viewValue);
-    this.$$lastCommittedViewValue = viewValue;
+    ctrl.$$updateEmptyClasses(viewValue);
+    ctrl.$$lastCommittedViewValue = viewValue;
 
     // change to dirty
-    if (this.$pristine) {
+    if (ctrl.$pristine) {
       this.$setDirty();
     }
     this.$$parseAndValidate();
-  },
+  };
 
-  $$parseAndValidate: function() {
-    var viewValue = this.$$lastCommittedViewValue;
+  this.$$parseAndValidate = function() {
+    var viewValue = ctrl.$$lastCommittedViewValue;
     var modelValue = viewValue;
-    var that = this;
-
-    this.$$parserValid = isUndefined(modelValue) ? undefined : true;
+    parserValid = isUndefined(modelValue) ? undefined : true;
 
-    if (this.$$parserValid) {
-      for (var i = 0; i < this.$parsers.length; i++) {
-        modelValue = this.$parsers[i](modelValue);
+    if (parserValid) {
+      for (var i = 0; i < ctrl.$parsers.length; i++) {
+        modelValue = ctrl.$parsers[i](modelValue);
         if (isUndefined(modelValue)) {
-          this.$$parserValid = false;
+          parserValid = false;
           break;
         }
       }
     }
-    if (isNumberNaN(this.$modelValue)) {
-      // this.$modelValue has not been touched yet...
-      this.$modelValue = this.$$ngModelGet(this.$$scope);
+    if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {
+      // ctrl.$modelValue has not been touched yet...
+      ctrl.$modelValue = ngModelGet($scope);
     }
-    var prevModelValue = this.$modelValue;
-    var allowInvalid = this.$options.getOption('allowInvalid');
-    this.$$rawModelValue = modelValue;
+    var prevModelValue = ctrl.$modelValue;
+    var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
+    ctrl.$$rawModelValue = modelValue;
 
     if (allowInvalid) {
-      this.$modelValue = modelValue;
+      ctrl.$modelValue = modelValue;
       writeToModelIfNeeded();
     }
 
     // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date.
     // This can happen if e.g. $setViewValue is called from inside a parser
-    this.$$runValidators(modelValue, this.$$lastCommittedViewValue, function(allValid) {
+    ctrl.$$runValidators(modelValue, ctrl.$$lastCommittedViewValue, function(allValid) {
       if (!allowInvalid) {
-        // Note: Don't check this.$valid here, as we could have
+        // Note: Don't check ctrl.$valid here, as we could have
         // external validators (e.g. calculated on the server),
         // that just call $setValidity and need the model value
         // to calculate their validity.
-        that.$modelValue = allValid ? modelValue : undefined;
+        ctrl.$modelValue = allValid ? modelValue : undefined;
         writeToModelIfNeeded();
       }
     });
 
     function writeToModelIfNeeded() {
-      if (that.$modelValue !== prevModelValue) {
-        that.$$writeModelToScope();
+      if (ctrl.$modelValue !== prevModelValue) {
+        ctrl.$$writeModelToScope();
       }
     }
-  },
+  };
 
-  $$writeModelToScope: function() {
-    this.$$ngModelSet(this.$$scope, this.$modelValue);
-    forEach(this.$viewChangeListeners, function(listener) {
+  this.$$writeModelToScope = function() {
+    ngModelSet($scope, ctrl.$modelValue);
+    forEach(ctrl.$viewChangeListeners, function(listener) {
       try {
         listener();
       } catch (e) {
-        // eslint-disable-next-line no-invalid-this
-        this.$$exceptionHandler(e);
+        $exceptionHandler(e);
       }
-    }, this);
-  },
+    });
+  };
 
   /**
    * @ngdoc method
@@ -39084,10 +36034,9 @@ NgModelController.prototype = {
    *
    * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers`
    * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged
-   * value is sent directly for processing through the `$parsers` pipeline. After this, the `$validators` and
-   * `$asyncValidators` are called and the value is applied to `$modelValue`.
-   * Finally, the value is set to the **expression** specified in the `ng-model` attribute and
-   * all the registered change listeners, in the `$viewChangeListeners` list are called.
+   * value sent directly for processing, finally to be applied to `$modelValue` and then the
+   * **expression** specified in the `ng-model` attribute. Lastly, all the registered change listeners,
+   * in the `$viewChangeListeners` list, are called.
    *
    * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn`
    * and the `default` trigger is not listed, all those actions will remain pending until one of the
@@ -39121,62 +36070,43 @@ NgModelController.prototype = {
    * @param {*} value value from the view.
    * @param {string} trigger Event that triggered the update.
    */
-  $setViewValue: function(value, trigger) {
-    this.$viewValue = value;
-    if (this.$options.getOption('updateOnDefault')) {
-      this.$$debounceViewValueCommit(trigger);
+  this.$setViewValue = function(value, trigger) {
+    ctrl.$viewValue = value;
+    if (!ctrl.$options || ctrl.$options.updateOnDefault) {
+      ctrl.$$debounceViewValueCommit(trigger);
     }
-  },
+  };
 
-  $$debounceViewValueCommit: function(trigger) {
-    var debounceDelay = this.$options.getOption('debounce');
+  this.$$debounceViewValueCommit = function(trigger) {
+    var debounceDelay = 0,
+        options = ctrl.$options,
+        debounce;
 
-    if (isNumber(debounceDelay[trigger])) {
-      debounceDelay = debounceDelay[trigger];
-    } else if (isNumber(debounceDelay['default'])) {
-      debounceDelay = debounceDelay['default'];
+    if (options && isDefined(options.debounce)) {
+      debounce = options.debounce;
+      if (isNumber(debounce)) {
+        debounceDelay = debounce;
+      } else if (isNumber(debounce[trigger])) {
+        debounceDelay = debounce[trigger];
+      } else if (isNumber(debounce['default'])) {
+        debounceDelay = debounce['default'];
+      }
     }
 
-    this.$$timeout.cancel(this.$$pendingDebounce);
-    var that = this;
-    if (debounceDelay > 0) { // this fails if debounceDelay is an object
-      this.$$pendingDebounce = this.$$timeout(function() {
-        that.$commitViewValue();
+    $timeout.cancel(pendingDebounce);
+    if (debounceDelay) {
+      pendingDebounce = $timeout(function() {
+        ctrl.$commitViewValue();
       }, debounceDelay);
-    } else if (this.$$scope.$root.$$phase) {
-      this.$commitViewValue();
+    } else if ($rootScope.$$phase) {
+      ctrl.$commitViewValue();
     } else {
-      this.$$scope.$apply(function() {
-        that.$commitViewValue();
+      $scope.$apply(function() {
+        ctrl.$commitViewValue();
       });
     }
-  },
-
-  /**
-   * @ngdoc method
-   *
-   * @name ngModel.NgModelController#$overrideModelOptions
-   *
-   * @description
-   *
-   * Override the current model options settings programmatically.
-   *
-   * The previous `ModelOptions` value will not be modified. Instead, a
-   * new `ModelOptions` object will inherit from the previous one overriding
-   * or inheriting settings that are defined in the given parameter.
-   *
-   * See {@link ngModelOptions} for information about what options can be specified
-   * and how model option inheritance works.
-   *
-   * @param {Object} options a hash of settings to override the previous options
-   *
-   */
-  $overrideModelOptions: function(options) {
-    this.$options = this.$options.createChild(options);
-  }
-};
+  };
 
-function setupModelWatcher(ctrl) {
   // model -> value
   // Note: we cannot use a normal scope.$watch as we want to detect the following:
   // 1. scope value is 'a'
@@ -39185,18 +36115,17 @@ function setupModelWatcher(ctrl) {
   //    -> scope value did not change since the last digest as
   //       ng-change executes in apply phase
   // 4. view should be changed back to 'a'
-  ctrl.$$scope.$watch(function ngModelWatch(scope) {
-    var modelValue = ctrl.$$ngModelGet(scope);
+  $scope.$watch(function ngModelWatch() {
+    var modelValue = ngModelGet($scope);
 
     // if scope model value and ngModel value are out of sync
     // TODO(perf): why not move this to the action fn?
     if (modelValue !== ctrl.$modelValue &&
        // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator
-        // eslint-disable-next-line no-self-compare
        (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)
     ) {
       ctrl.$modelValue = ctrl.$$rawModelValue = modelValue;
-      ctrl.$$parserValid = undefined;
+      parserValid = undefined;
 
       var formatters = ctrl.$formatters,
           idx = formatters.length;
@@ -39210,46 +36139,13 @@ function setupModelWatcher(ctrl) {
         ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue;
         ctrl.$render();
 
-        // It is possible that model and view value have been updated during render
-        ctrl.$$runValidators(ctrl.$modelValue, ctrl.$viewValue, noop);
+        ctrl.$$runValidators(modelValue, viewValue, noop);
       }
     }
 
     return modelValue;
   });
-}
-
-/**
- * @ngdoc method
- * @name ngModel.NgModelController#$setValidity
- *
- * @description
- * Change the validity state, and notify the form.
- *
- * This method can be called within $parsers/$formatters or a custom validation implementation.
- * However, in most cases it should be sufficient to use the `ngModel.$validators` and
- * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.
- *
- * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned
- *        to either `$error[validationErrorKey]` or `$pending[validationErrorKey]`
- *        (for unfulfilled `$asyncValidators`), so that it is available for data-binding.
- *        The `validationErrorKey` should be in camelCase and will get converted into dash-case
- *        for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`
- *        class and can be bound to as  `{{someForm.someControl.$error.myError}}` .
- * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined),
- *                          or skipped (null). Pending is used for unfulfilled `$asyncValidators`.
- *                          Skipped is used by Angular when validators do not run because of parse errors and
- *                          when `$asyncValidators` do not run because any of the `$validators` failed.
- */
-addSetValidityMethod({
-  clazz: NgModelController,
-  set: function(object, property) {
-    object[property] = true;
-  },
-  unset: function(object, property) {
-    delete object[property];
-  }
-});
+}];
 
 
 /**
@@ -39359,7 +36255,7 @@ addSetValidityMethod({
  * </pre>
  *
  * @example
- * <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample" name="ng-model">
+ * <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample">
      <file name="index.html">
        <script>
         angular.module('inputExample', [])
@@ -39455,14 +36351,9 @@ var ngModelDirective = ['$rootScope', function($rootScope) {
       return {
         pre: function ngModelPreLink(scope, element, attr, ctrls) {
           var modelCtrl = ctrls[0],
-              formCtrl = ctrls[1] || modelCtrl.$$parentForm,
-              optionsCtrl = ctrls[2];
-
-          if (optionsCtrl) {
-            modelCtrl.$options = optionsCtrl.$options;
-          }
+              formCtrl = ctrls[1] || modelCtrl.$$parentForm;
 
-          modelCtrl.$$initGetterSetters();
+          modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options);
 
           // notify others, especially parent forms
           formCtrl.$addControl(modelCtrl);
@@ -39479,23 +36370,19 @@ var ngModelDirective = ['$rootScope', function($rootScope) {
         },
         post: function ngModelPostLink(scope, element, attr, ctrls) {
           var modelCtrl = ctrls[0];
-          if (modelCtrl.$options.getOption('updateOn')) {
-            element.on(modelCtrl.$options.getOption('updateOn'), function(ev) {
+          if (modelCtrl.$options && modelCtrl.$options.updateOn) {
+            element.on(modelCtrl.$options.updateOn, function(ev) {
               modelCtrl.$$debounceViewValueCommit(ev && ev.type);
             });
           }
 
-          function setTouched() {
-            modelCtrl.$setTouched();
-          }
-
           element.on('blur', function() {
             if (modelCtrl.$touched) return;
 
             if ($rootScope.$$phase) {
-              scope.$evalAsync(setTouched);
+              scope.$evalAsync(modelCtrl.$setTouched);
             } else {
-              scope.$apply(setTouched);
+              scope.$apply(modelCtrl.$setTouched);
             }
           });
         }
@@ -39504,173 +36391,23 @@ var ngModelDirective = ['$rootScope', function($rootScope) {
   };
 }];
 
-/* exported defaultModelOptions */
-var defaultModelOptions;
 var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
 
 /**
- * @ngdoc type
- * @name ModelOptions
- * @description
- * A container for the options set by the {@link ngModelOptions} directive
- */
-function ModelOptions(options) {
-  this.$$options = options;
-}
-
-ModelOptions.prototype = {
-
-  /**
-   * @ngdoc method
-   * @name ModelOptions#getOption
-   * @param {string} name the name of the option to retrieve
-   * @returns {*} the value of the option
-   * @description
-   * Returns the value of the given option
-   */
-  getOption: function(name) {
-    return this.$$options[name];
-  },
-
-  /**
-   * @ngdoc method
-   * @name ModelOptions#createChild
-   * @param {Object} options a hash of options for the new child that will override the parent's options
-   * @return {ModelOptions} a new `ModelOptions` object initialized with the given options.
-   */
-  createChild: function(options) {
-    var inheritAll = false;
-
-    // make a shallow copy
-    options = extend({}, options);
-
-    // Inherit options from the parent if specified by the value `"$inherit"`
-    forEach(options, /* @this */ function(option, key) {
-      if (option === '$inherit') {
-        if (key === '*') {
-          inheritAll = true;
-        } else {
-          options[key] = this.$$options[key];
-          // `updateOn` is special so we must also inherit the `updateOnDefault` option
-          if (key === 'updateOn') {
-            options.updateOnDefault = this.$$options.updateOnDefault;
-          }
-        }
-      } else {
-        if (key === 'updateOn') {
-          // If the `updateOn` property contains the `default` event then we have to remove
-          // it from the event list and set the `updateOnDefault` flag.
-          options.updateOnDefault = false;
-          options[key] = trim(option.replace(DEFAULT_REGEXP, function() {
-            options.updateOnDefault = true;
-            return ' ';
-          }));
-        }
-      }
-    }, this);
-
-    if (inheritAll) {
-      // We have a property of the form: `"*": "$inherit"`
-      delete options['*'];
-      defaults(options, this.$$options);
-    }
-
-    // Finally add in any missing defaults
-    defaults(options, defaultModelOptions.$$options);
-
-    return new ModelOptions(options);
-  }
-};
-
-
-defaultModelOptions = new ModelOptions({
-  updateOn: '',
-  updateOnDefault: true,
-  debounce: 0,
-  getterSetter: false,
-  allowInvalid: false,
-  timezone: null
-});
-
-
-/**
  * @ngdoc directive
  * @name ngModelOptions
  *
  * @description
- * This directive allows you to modify the behaviour of {@link ngModel} directives within your
- * application. You can specify an `ngModelOptions` directive on any element. All {@link ngModel}
- * directives will use the options of their nearest `ngModelOptions` ancestor.
- *
- * The `ngModelOptions` settings are found by evaluating the value of the attribute directive as
- * an Angular expression. This expression should evaluate to an object, whose properties contain
- * the settings. For example: `<div "ng-model-options"="{ debounce: 100 }"`.
- *
- * ## Inheriting Options
- *
- * You can specify that an `ngModelOptions` setting should be inherited from a parent `ngModelOptions`
- * directive by giving it the value of `"$inherit"`.
- * Then it will inherit that setting from the first `ngModelOptions` directive found by traversing up the
- * DOM tree. If there is no ancestor element containing an `ngModelOptions` directive then default settings
- * will be used.
- *
- * For example given the following fragment of HTML
- *
- *
- * ```html
- * <div ng-model-options="{ allowInvalid: true, debounce: 200 }">
- *   <form ng-model-options="{ updateOn: 'blur', allowInvalid: '$inherit' }">
- *     <input ng-model-options="{ updateOn: 'default', allowInvalid: '$inherit' }" />
- *   </form>
- * </div>
- * ```
- *
- * the `input` element will have the following settings
- *
- * ```js
- * { allowInvalid: true, updateOn: 'default', debounce: 0 }
- * ```
- *
- * Notice that the `debounce` setting was not inherited and used the default value instead.
- *
- * You can specify that all undefined settings are automatically inherited from an ancestor by
- * including a property with key of `"*"` and value of `"$inherit"`.
- *
- * For example given the following fragment of HTML
- *
- *
- * ```html
- * <div ng-model-options="{ allowInvalid: true, debounce: 200 }">
- *   <form ng-model-options="{ updateOn: 'blur', "*": '$inherit' }">
- *     <input ng-model-options="{ updateOn: 'default', "*": '$inherit' }" />
- *   </form>
- * </div>
- * ```
- *
- * the `input` element will have the following settings
- *
- * ```js
- * { allowInvalid: true, updateOn: 'default', debounce: 200 }
- * ```
- *
- * Notice that the `debounce` setting now inherits the value from the outer `<div>` element.
- *
- * If you are creating a reusable component then you should be careful when using `"*": "$inherit"`
- * since you may inadvertently inherit a setting in the future that changes the behavior of your component.
- *
- *
- * ## Triggering and debouncing model updates
- *
- * The `updateOn` and `debounce` properties allow you to specify a custom list of events that will
- * trigger a model update and/or a debouncing delay so that the actual update only takes place when
- * a timer expires; this timer will be reset after another change takes place.
+ * Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of
+ * events that will trigger a model update and/or a debouncing delay so that the actual update only
+ * takes place when a timer expires; this timer will be reset after another change takes place.
  *
  * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might
  * be different from the value in the actual model. This means that if you update the model you
- * should also invoke {@link ngModel.NgModelController#$rollbackViewValue} on the relevant input field in
+ * should also invoke {@link ngModel.NgModelController `$rollbackViewValue`} on the relevant input field in
  * order to make sure it is synchronized with the model and that any debounced action is canceled.
  *
- * The easiest way to reference the control's {@link ngModel.NgModelController#$rollbackViewValue}
+ * The easiest way to reference the control's {@link ngModel.NgModelController `$rollbackViewValue`}
  * method is by making sure the input is placed inside a form that has a `name` attribute. This is
  * important because `form` controllers are published to the related scope under the name in their
  * `name` attribute.
@@ -39679,194 +36416,271 @@ defaultModelOptions = new ModelOptions({
  * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
  * to have access to the updated model.
  *
- * The following example shows how to override immediate updates. Changes on the inputs within the
- * form will update the model only when the control loses focus (blur event). If `escape` key is
- * pressed while the input field is focused, the value is reset to the value in the current model.
- *
- * <example name="ngModelOptions-directive-blur" module="optionsExample">
- *   <file name="index.html">
- *     <div ng-controller="ExampleController">
- *       <form name="userForm">
- *         <label>
- *           Name:
- *           <input type="text" name="userName"
- *                  ng-model="user.name"
- *                  ng-model-options="{ updateOn: 'blur' }"
- *                  ng-keyup="cancel($event)" />
- *         </label><br />
- *         <label>
- *           Other data:
- *           <input type="text" ng-model="user.data" />
- *         </label><br />
- *       </form>
- *       <pre>user.name = <span ng-bind="user.name"></span></pre>
- *     </div>
- *   </file>
- *   <file name="app.js">
- *     angular.module('optionsExample', [])
- *       .controller('ExampleController', ['$scope', function($scope) {
- *         $scope.user = { name: 'say', data: '' };
- *
- *         $scope.cancel = function(e) {
- *           if (e.keyCode === 27) {
- *             $scope.userForm.userName.$rollbackViewValue();
- *           }
- *         };
- *       }]);
- *   </file>
- *   <file name="protractor.js" type="protractor">
- *     var model = element(by.binding('user.name'));
- *     var input = element(by.model('user.name'));
- *     var other = element(by.model('user.data'));
- *
- *     it('should allow custom events', function() {
- *       input.sendKeys(' hello');
- *       input.click();
- *       expect(model.getText()).toEqual('say');
- *       other.click();
- *       expect(model.getText()).toEqual('say hello');
- *     });
- *
- *     it('should $rollbackViewValue when model changes', function() {
- *       input.sendKeys(' hello');
- *       expect(input.getAttribute('value')).toEqual('say hello');
- *       input.sendKeys(protractor.Key.ESCAPE);
- *       expect(input.getAttribute('value')).toEqual('say');
- *       other.click();
- *       expect(model.getText()).toEqual('say');
- *     });
- *   </file>
- * </example>
- *
- * The next example shows how to debounce model changes. Model will be updated only 1 sec after last change.
- * If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.
- *
- * <example name="ngModelOptions-directive-debounce" module="optionsExample">
- *   <file name="index.html">
- *     <div ng-controller="ExampleController">
- *       <form name="userForm">
- *         Name:
- *         <input type="text" name="userName"
- *                ng-model="user.name"
- *                ng-model-options="{ debounce: 1000 }" />
- *         <button ng-click="userForm.userName.$rollbackViewValue(); user.name=''">Clear</button><br />
- *       </form>
- *       <pre>user.name = <span ng-bind="user.name"></span></pre>
- *     </div>
- *   </file>
- *   <file name="app.js">
- *     angular.module('optionsExample', [])
- *       .controller('ExampleController', ['$scope', function($scope) {
- *         $scope.user = { name: 'say' };
- *       }]);
- *   </file>
- * </example>
- *
- * ## Model updates and validation
- *
- * The default behaviour in `ngModel` is that the model value is set to `undefined` when the
- * validation determines that the value is invalid. By setting the `allowInvalid` property to true,
- * the model will still be updated even if the value is invalid.
- *
- *
- * ## Connecting to the scope
+ * `ngModelOptions` has an effect on the element it's declared on and its descendants.
  *
- * By setting the `getterSetter` property to true you are telling ngModel that the `ngModel` expression
- * on the scope refers to a "getter/setter" function rather than the value itself.
- *
- * The following example shows how to bind to getter/setters:
- *
- * <example name="ngModelOptions-directive-getter-setter" module="getterSetterExample">
- *   <file name="index.html">
- *     <div ng-controller="ExampleController">
- *       <form name="userForm">
- *         <label>
- *           Name:
- *           <input type="text" name="userName"
- *                  ng-model="user.name"
- *                  ng-model-options="{ getterSetter: true }" />
- *         </label>
- *       </form>
- *       <pre>user.name = <span ng-bind="user.name()"></span></pre>
- *     </div>
- *   </file>
- *   <file name="app.js">
- *     angular.module('getterSetterExample', [])
- *       .controller('ExampleController', ['$scope', function($scope) {
- *         var _name = 'Brian';
- *         $scope.user = {
- *           name: function(newName) {
- *             return angular.isDefined(newName) ? (_name = newName) : _name;
- *           }
- *         };
- *       }]);
- *   </file>
- * </example>
- *
- *
- * ## Specifying timezones
- *
- * You can specify the timezone that date/time input directives expect by providing its name in the
- * `timezone` property.
- *
- * @param {Object} ngModelOptions options to apply to {@link ngModel} directives on this element and
- *   and its descendents. Valid keys are:
+ * @param {Object} ngModelOptions options to apply to the current model. Valid keys are:
  *   - `updateOn`: string specifying which event should the input be bound to. You can set several
  *     events using an space delimited list. There is a special event called `default` that
- *     matches the default events belonging to the control.
+ *     matches the default events belonging of the control.
  *   - `debounce`: integer value which contains the debounce model update value in milliseconds. A
  *     value of 0 triggers an immediate update. If an object is supplied instead, you can specify a
  *     custom value for each event. For example:
- *     ```
- *     ng-model-options="{
- *       updateOn: 'default blur',
- *       debounce: { 'default': 500, 'blur': 0 }
- *     }"
- *     ```
+ *     `ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }"`
  *   - `allowInvalid`: boolean value which indicates that the model can be set with values that did
  *     not validate correctly instead of the default behavior of setting the model to undefined.
  *   - `getterSetter`: boolean value which determines whether or not to treat functions bound to
- *     `ngModel` as getters/setters.
+       `ngModel` as getters/setters.
  *   - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for
- *     `<input type="date" />`, `<input type="time" />`, ... . It understands UTC/GMT and the
+ *     `<input type="date">`, `<input type="time">`, ... . It understands UTC/GMT and the
  *     continental US time zone abbreviations, but for general use, use a time zone offset, for
  *     example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
  *     If not specified, the timezone of the browser will be used.
  *
- */
-var ngModelOptionsDirective = function() {
-  NgModelOptionsController.$inject = ['$attrs', '$scope'];
-  function NgModelOptionsController($attrs, $scope) {
-    this.$$attrs = $attrs;
-    this.$$scope = $scope;
-  }
-  NgModelOptionsController.prototype = {
-    $onInit: function() {
-      var parentOptions = this.parentCtrl ? this.parentCtrl.$options : defaultModelOptions;
-      var modelOptionsDefinition = this.$$scope.$eval(this.$$attrs.ngModelOptions);
+ * @example
 
-      this.$options = parentOptions.createChild(modelOptionsDefinition);
-    }
-  };
+  The following example shows how to override immediate updates. Changes on the inputs within the
+  form will update the model only when the control loses focus (blur event). If `escape` key is
+  pressed while the input field is focused, the value is reset to the value in the current model.
+
+  <example name="ngModelOptions-directive-blur" module="optionsExample">
+    <file name="index.html">
+      <div ng-controller="ExampleController">
+        <form name="userForm">
+          <label>Name:
+            <input type="text" name="userName"
+                   ng-model="user.name"
+                   ng-model-options="{ updateOn: 'blur' }"
+                   ng-keyup="cancel($event)" />
+          </label><br />
+          <label>Other data:
+            <input type="text" ng-model="user.data" />
+          </label><br />
+        </form>
+        <pre>user.name = <span ng-bind="user.name"></span></pre>
+        <pre>user.data = <span ng-bind="user.data"></span></pre>
+      </div>
+    </file>
+    <file name="app.js">
+      angular.module('optionsExample', [])
+        .controller('ExampleController', ['$scope', function($scope) {
+          $scope.user = { name: 'John', data: '' };
+
+          $scope.cancel = function(e) {
+            if (e.keyCode == 27) {
+              $scope.userForm.userName.$rollbackViewValue();
+            }
+          };
+        }]);
+    </file>
+    <file name="protractor.js" type="protractor">
+      var model = element(by.binding('user.name'));
+      var input = element(by.model('user.name'));
+      var other = element(by.model('user.data'));
+
+      it('should allow custom events', function() {
+        input.sendKeys(' Doe');
+        input.click();
+        expect(model.getText()).toEqual('John');
+        other.click();
+        expect(model.getText()).toEqual('John Doe');
+      });
 
+      it('should $rollbackViewValue when model changes', function() {
+        input.sendKeys(' Doe');
+        expect(input.getAttribute('value')).toEqual('John Doe');
+        input.sendKeys(protractor.Key.ESCAPE);
+        expect(input.getAttribute('value')).toEqual('John');
+        other.click();
+        expect(model.getText()).toEqual('John');
+      });
+    </file>
+  </example>
+
+  This one shows how to debounce model changes. Model will be updated only 1 sec after last change.
+  If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.
+
+  <example name="ngModelOptions-directive-debounce" module="optionsExample">
+    <file name="index.html">
+      <div ng-controller="ExampleController">
+        <form name="userForm">
+          <label>Name:
+            <input type="text" name="userName"
+                   ng-model="user.name"
+                   ng-model-options="{ debounce: 1000 }" />
+          </label>
+          <button ng-click="userForm.userName.$rollbackViewValue(); user.name=''">Clear</button>
+          <br />
+        </form>
+        <pre>user.name = <span ng-bind="user.name"></span></pre>
+      </div>
+    </file>
+    <file name="app.js">
+      angular.module('optionsExample', [])
+        .controller('ExampleController', ['$scope', function($scope) {
+          $scope.user = { name: 'Igor' };
+        }]);
+    </file>
+  </example>
+
+  This one shows how to bind to getter/setters:
+
+  <example name="ngModelOptions-directive-getter-setter" module="getterSetterExample">
+    <file name="index.html">
+      <div ng-controller="ExampleController">
+        <form name="userForm">
+          <label>Name:
+            <input type="text" name="userName"
+                   ng-model="user.name"
+                   ng-model-options="{ getterSetter: true }" />
+          </label>
+        </form>
+        <pre>user.name = <span ng-bind="user.name()"></span></pre>
+      </div>
+    </file>
+    <file name="app.js">
+      angular.module('getterSetterExample', [])
+        .controller('ExampleController', ['$scope', function($scope) {
+          var _name = 'Brian';
+          $scope.user = {
+            name: function(newName) {
+              // Note that newName can be undefined for two reasons:
+              // 1. Because it is called as a getter and thus called with no arguments
+              // 2. Because the property should actually be set to undefined. This happens e.g. if the
+              //    input is invalid
+              return arguments.length ? (_name = newName) : _name;
+            }
+          };
+        }]);
+    </file>
+  </example>
+ */
+var ngModelOptionsDirective = function() {
   return {
     restrict: 'A',
-    // ngModelOptions needs to run before ngModel and input directives
-    priority: 10,
-    require: {parentCtrl: '?^^ngModelOptions'},
-    bindToController: true,
-    controller: NgModelOptionsController
+    controller: ['$scope', '$attrs', function($scope, $attrs) {
+      var that = this;
+      this.$options = copy($scope.$eval($attrs.ngModelOptions));
+      // Allow adding/overriding bound events
+      if (isDefined(this.$options.updateOn)) {
+        this.$options.updateOnDefault = false;
+        // extract "default" pseudo-event from list of events that can trigger a model update
+        this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() {
+          that.$options.updateOnDefault = true;
+          return ' ';
+        }));
+      } else {
+        this.$options.updateOnDefault = true;
+      }
+    }]
   };
 };
 
 
-// shallow copy over values from `src` that are not already specified on `dst`
-function defaults(dst, src) {
-  forEach(src, function(value, key) {
-    if (!isDefined(dst[key])) {
-      dst[key] = value;
+
+// helper methods
+function addSetValidityMethod(context) {
+  var ctrl = context.ctrl,
+      $element = context.$element,
+      classCache = {},
+      set = context.set,
+      unset = context.unset,
+      $animate = context.$animate;
+
+  classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS));
+
+  ctrl.$setValidity = setValidity;
+
+  function setValidity(validationErrorKey, state, controller) {
+    if (isUndefined(state)) {
+      createAndSet('$pending', validationErrorKey, controller);
+    } else {
+      unsetAndCleanup('$pending', validationErrorKey, controller);
     }
-  });
+    if (!isBoolean(state)) {
+      unset(ctrl.$error, validationErrorKey, controller);
+      unset(ctrl.$$success, validationErrorKey, controller);
+    } else {
+      if (state) {
+        unset(ctrl.$error, validationErrorKey, controller);
+        set(ctrl.$$success, validationErrorKey, controller);
+      } else {
+        set(ctrl.$error, validationErrorKey, controller);
+        unset(ctrl.$$success, validationErrorKey, controller);
+      }
+    }
+    if (ctrl.$pending) {
+      cachedToggleClass(PENDING_CLASS, true);
+      ctrl.$valid = ctrl.$invalid = undefined;
+      toggleValidationCss('', null);
+    } else {
+      cachedToggleClass(PENDING_CLASS, false);
+      ctrl.$valid = isObjectEmpty(ctrl.$error);
+      ctrl.$invalid = !ctrl.$valid;
+      toggleValidationCss('', ctrl.$valid);
+    }
+
+    // re-read the state as the set/unset methods could have
+    // combined state in ctrl.$error[validationError] (used for forms),
+    // where setting/unsetting only increments/decrements the value,
+    // and does not replace it.
+    var combinedState;
+    if (ctrl.$pending && ctrl.$pending[validationErrorKey]) {
+      combinedState = undefined;
+    } else if (ctrl.$error[validationErrorKey]) {
+      combinedState = false;
+    } else if (ctrl.$$success[validationErrorKey]) {
+      combinedState = true;
+    } else {
+      combinedState = null;
+    }
+
+    toggleValidationCss(validationErrorKey, combinedState);
+    ctrl.$$parentForm.$setValidity(validationErrorKey, combinedState, ctrl);
+  }
+
+  function createAndSet(name, value, controller) {
+    if (!ctrl[name]) {
+      ctrl[name] = {};
+    }
+    set(ctrl[name], value, controller);
+  }
+
+  function unsetAndCleanup(name, value, controller) {
+    if (ctrl[name]) {
+      unset(ctrl[name], value, controller);
+    }
+    if (isObjectEmpty(ctrl[name])) {
+      ctrl[name] = undefined;
+    }
+  }
+
+  function cachedToggleClass(className, switchValue) {
+    if (switchValue && !classCache[className]) {
+      $animate.addClass($element, className);
+      classCache[className] = true;
+    } else if (!switchValue && classCache[className]) {
+      $animate.removeClass($element, className);
+      classCache[className] = false;
+    }
+  }
+
+  function toggleValidationCss(validationErrorKey, isValid) {
+    validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
+
+    cachedToggleClass(VALID_CLASS + validationErrorKey, isValid === true);
+    cachedToggleClass(INVALID_CLASS + validationErrorKey, isValid === false);
+  }
+}
+
+function isObjectEmpty(obj) {
+  if (obj) {
+    for (var prop in obj) {
+      if (obj.hasOwnProperty(prop)) {
+        return false;
+      }
+    }
+  }
+  return true;
 }
 
 /**
@@ -39888,7 +36702,7 @@ function defaults(dst, src) {
  * but the one wrapped in `ngNonBindable` is left alone.
  *
  * @example
-    <example name="ng-non-bindable">
+    <example>
       <file name="index.html">
         <div>Normal: {{1 + 2}}</div>
         <div ng-non-bindable>Ignored: {{1 + 2}}</div>
@@ -39903,8 +36717,6 @@ function defaults(dst, src) {
  */
 var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
 
-/* exported ngOptionsDirective */
-
 /* global jqLiteRemove */
 
 var ngOptionsMinErr = minErr('ngOptions');
@@ -39920,12 +36732,13 @@ var ngOptionsMinErr = minErr('ngOptions');
  * elements for the `<select>` element using the array or object obtained by evaluating the
  * `ngOptions` comprehension expression.
  *
- * In many cases, {@link ng.directive:ngRepeat ngRepeat} can be used on `<option>` elements instead of
- * `ngOptions` to achieve a similar result. However, `ngOptions` provides some benefits:
- * - more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
- * comprehension expression
- * - reduced memory consumption by not creating a new scope for each repeated instance
- * - increased render speed by creating the options in a documentFragment instead of individually
+ * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a
+ * similar result. However, `ngOptions` provides some benefits such as reducing memory and
+ * increasing speed by not creating a new scope for each repeated instance, as well as providing
+ * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
+ * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound
+ *  to a non-string value. This is because an option element can only be bound to string values at
+ * present.
  *
  * When an item in the `<select>` menu is selected, the array element or object property
  * represented by the selected option will be bound to the model identified by the `ngModel`
@@ -40014,8 +36827,13 @@ var ngOptionsMinErr = minErr('ngOptions');
  * is not matched against any `<option>` and the `<select>` appears as having no selected value.
  *
  *
- * @param {string} ngModel Assignable AngularJS expression to data-bind to.
- * @param {comprehension_expression} ngOptions in one of the following forms:
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required The control is considered valid only if value is entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ *    `required` when you want to data-bind to the `required` attribute.
+ * @param {comprehension_expression=} ngOptions in one of the following forms:
  *
  *   * for array data sources:
  *     * `label` **`for`** `value` **`in`** `array`
@@ -40054,16 +36872,9 @@ var ngOptionsMinErr = minErr('ngOptions');
  *      used to identify the objects in the array. The `trackexpr` will most likely refer to the
  *     `value` variable (e.g. `value.propertyName`). With this the selection is preserved
  *      even when the options are recreated (e.g. reloaded from the server).
- * @param {string=} name Property name of the form under which the control is published.
- * @param {string=} required The control is considered valid only if value is entered.
- * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
- *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
- *    `required` when you want to data-bind to the `required` attribute.
- * @param {string=} ngAttrSize sets the size of the select element dynamically. Uses the
- * {@link guide/interpolation#-ngattr-for-binding-to-arbitrary-attributes ngAttr} directive.
  *
  * @example
-    <example module="selectExample" name="select">
+    <example module="selectExample">
       <file name="index.html">
         <script>
         angular.module('selectExample', [])
@@ -40136,9 +36947,9 @@ var ngOptionsMinErr = minErr('ngOptions');
     </example>
  */
 
-/* eslint-disable max-len */
-//                     //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555000000000666666666666600000007777777777777000000000000000888888888800000000000000000009999999999
-var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([$\w][$\w]*)|(?:\(\s*([$\w][$\w]*)\s*,\s*([$\w][$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/;
+// jshint maxlen: false
+//                     //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555550000000006666666666666660000000777777777777777000000000000000888888888800000000000000000009999999999
+var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/;
                         // 1: value expression (valueFn)
                         // 2: label expression (displayFn)
                         // 3: group by expression (groupByFn)
@@ -40148,7 +36959,7 @@ var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s
                         // 7: object item value variable name
                         // 8: collection expression
                         // 9: track by expression
-/* eslint-enable */
+// jshint maxlen: 100
 
 
 var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile, $document, $parse) {
@@ -40158,9 +36969,9 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
     var match = optionsExp.match(NG_OPTIONS_REGEXP);
     if (!(match)) {
       throw ngOptionsMinErr('iexp',
-        'Expected expression in form of ' +
-        '\'_select_ (as _label_)? for (_key_,)?_value_ in _collection_\'' +
-        ' but got \'{0}\'. Element: {1}',
+        "Expected expression in form of " +
+        "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
+        " but got '{0}'. Element: {1}",
         optionsExp, startingTag(selectElement));
     }
 
@@ -40302,7 +37113,7 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
           getViewValueFromOption: function(option) {
             // If the viewValue could be an object that may be mutated by the application,
             // we need to make a copy and not return the reference to the value on the option.
-            return trackBy ? copy(option.viewValue) : option.viewValue;
+            return trackBy ? angular.copy(option.viewValue) : option.viewValue;
           }
         };
       }
@@ -40323,15 +37134,15 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
 
       // The emptyOption allows the application developer to provide their own custom "empty"
       // option when the viewValue does not match any of the option values.
+      var emptyOption;
       for (var i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) {
         if (children[i].value === '') {
-          selectCtrl.hasEmptyOption = true;
-          selectCtrl.emptyOption = children.eq(i);
+          emptyOption = children.eq(i);
           break;
         }
       }
 
-      var providedEmptyOption = !!selectCtrl.emptyOption;
+      var providedEmptyOption = !!emptyOption;
 
       var unknownOption = jqLite(optionTemplate.cloneNode(false));
       unknownOption.val('?');
@@ -40343,22 +37154,39 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
       // we only need to create it once.
       var listFragment = $document[0].createDocumentFragment();
 
-      // Overwrite the implementation. ngOptions doesn't use hashes
-      selectCtrl.generateUnknownOptionValue = function(val) {
-        return '?';
+      var renderEmptyOption = function() {
+        if (!providedEmptyOption) {
+          selectElement.prepend(emptyOption);
+        }
+        selectElement.val('');
+        emptyOption.prop('selected', true); // needed for IE
+        emptyOption.attr('selected', true);
+      };
+
+      var removeEmptyOption = function() {
+        if (!providedEmptyOption) {
+          emptyOption.remove();
+        }
+      };
+
+
+      var renderUnknownOption = function() {
+        selectElement.prepend(unknownOption);
+        selectElement.val('?');
+        unknownOption.prop('selected', true); // needed for IE
+        unknownOption.attr('selected', true);
+      };
+
+      var removeUnknownOption = function() {
+        unknownOption.remove();
       };
 
       // Update the controller methods for multiple selectable options
       if (!multiple) {
 
         selectCtrl.writeValue = function writeNgOptionsValue(value) {
-          var selectedOption = options.selectValueMap[selectElement.val()];
           var option = options.getOptionFromViewValue(value);
 
-          // Make sure to remove the selected attribute from the previously selected option
-          // Otherwise, screen readers might get confused
-          if (selectedOption) selectedOption.element.removeAttribute('selected');
-
           if (option) {
             // Don't update the option when it is already selected.
             // For example, the browser will select the first option by default. In that case,
@@ -40366,8 +37194,8 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
             // set always
 
             if (selectElement[0].value !== option.selectValue) {
-              selectCtrl.removeUnknownOption();
-              selectCtrl.unselectEmptyOption();
+              removeUnknownOption();
+              removeEmptyOption();
 
               selectElement[0].value = option.selectValue;
               option.element.selected = true;
@@ -40375,13 +37203,12 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
 
             option.element.setAttribute('selected', 'selected');
           } else {
-
-            if (providedEmptyOption) {
-              selectCtrl.selectEmptyOption();
-            } else if (selectCtrl.unknownOption.parent().length) {
-              selectCtrl.updateUnknownOption(value);
+            if (value === null || providedEmptyOption) {
+              removeUnknownOption();
+              renderEmptyOption();
             } else {
-              selectCtrl.renderUnknownOption(value);
+              removeEmptyOption();
+              renderUnknownOption();
             }
           }
         };
@@ -40391,8 +37218,8 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
           var selectedOption = options.selectValueMap[selectElement.val()];
 
           if (selectedOption && !selectedOption.disabled) {
-            selectCtrl.unselectEmptyOption();
-            selectCtrl.removeUnknownOption();
+            removeEmptyOption();
+            removeUnknownOption();
             return options.getViewValueFromOption(selectedOption);
           }
           return null;
@@ -40400,7 +37227,6 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
 
         // If we are using `track by` then we must watch the tracked value on the model
         // since ngModel only watches for object identity change
-        // FIXME: When a user selects an option, this watch will fire needlessly
         if (ngOptions.trackBy) {
           scope.$watch(
             function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },
@@ -40410,17 +37236,22 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
 
       } else {
 
-        selectCtrl.writeValue = function writeNgOptionsMultiple(values) {
-          // Only set `<option>.selected` if necessary, in order to prevent some browsers from
-          // scrolling to `<option>` elements that are outside the `<select>` element's viewport.
+        ngModelCtrl.$isEmpty = function(value) {
+          return !value || value.length === 0;
+        };
 
-          var selectedOptions = values && values.map(getAndUpdateSelectedOption) || [];
 
+        selectCtrl.writeValue = function writeNgOptionsMultiple(value) {
           options.items.forEach(function(option) {
-            if (option.element.selected && !includes(selectedOptions, option)) {
-              option.element.selected = false;
-            }
+            option.element.selected = false;
           });
+
+          if (value) {
+            value.forEach(function(item) {
+              var option = options.getOptionFromViewValue(item);
+              if (option) option.element.selected = true;
+            });
+          }
         };
 
 
@@ -40453,44 +37284,21 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
         }
       }
 
+
       if (providedEmptyOption) {
 
         // we need to remove it before calling selectElement.empty() because otherwise IE will
         // remove the label from the element. wtf?
-        selectCtrl.emptyOption.remove();
+        emptyOption.remove();
 
         // compile the element since there might be bindings in it
-        $compile(selectCtrl.emptyOption)(scope);
-
-        if (selectCtrl.emptyOption[0].nodeType === NODE_TYPE_COMMENT) {
-          // This means the empty option has currently no actual DOM node, probably because
-          // it has been modified by a transclusion directive.
-          selectCtrl.hasEmptyOption = false;
-
-          // Redefine the registerOption function, which will catch
-          // options that are added by ngIf etc. (rendering of the node is async because of
-          // lazy transclusion)
-          selectCtrl.registerOption = function(optionScope, optionEl) {
-            if (optionEl.val() === '') {
-              selectCtrl.hasEmptyOption = true;
-              selectCtrl.emptyOption = optionEl;
-              selectCtrl.emptyOption.removeClass('ng-scope');
-              // This ensures the new empty option is selected if previously no option was selected
-              ngModelCtrl.$render();
-
-              optionEl.on('$destroy', function() {
-                selectCtrl.hasEmptyOption = false;
-                selectCtrl.emptyOption = undefined;
-              });
-            }
-          };
-
-        } else {
-          // remove the class, which is added automatically because we recompile the element and it
-          // becomes the compilation root
-          selectCtrl.emptyOption.removeClass('ng-scope');
-        }
+        $compile(emptyOption)(scope);
 
+        // remove the class, which is added automatically because we recompile the element and it
+        // becomes the compilation root
+        emptyOption.removeClass('ng-scope');
+      } else {
+        emptyOption = jqLite(optionTemplate.cloneNode(false));
       }
 
       selectElement.empty();
@@ -40510,14 +37318,6 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
         updateOptionElement(option, optionElement);
       }
 
-      function getAndUpdateSelectedOption(viewValue) {
-        var option = options.getOptionFromViewValue(viewValue);
-        var element = option && option.element;
-
-        if (element && !element.selected) element.selected = true;
-
-        return option;
-      }
 
       function updateOptionElement(option, element) {
         option.element = element;
@@ -40531,7 +37331,7 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
           element.label = option.label;
           element.textContent = option.label;
         }
-        element.value = option.selectValue;
+        if (option.value !== element.value) element.value = option.selectValue;
       }
 
       function updateOptions() {
@@ -40546,7 +37346,7 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
 
           for (var i = options.items.length - 1; i >= 0; i--) {
             var option = options.items[i];
-            if (isDefined(option.group)) {
+            if (option.group) {
               jqLiteRemove(option.element.parentNode);
             } else {
               jqLiteRemove(option.element);
@@ -40560,7 +37360,7 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
 
         // Ensure that the empty option is always there if it was explicitly provided
         if (providedEmptyOption) {
-          selectElement.prepend(selectCtrl.emptyOption);
+          selectElement.prepend(emptyOption);
         }
 
         options.items.forEach(function addOption(option) {
@@ -40578,8 +37378,7 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
               listFragment.appendChild(groupElement);
 
               // Update the label on the group element
-              // "null" is special cased because of Safari
-              groupElement.label = option.group === null ? 'null' : option.group;
+              groupElement.label = option.group;
 
               // Store it for use later
               groupElementMap[option.group] = groupElement;
@@ -40719,7 +37518,7 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
  * @param {number=} offset Offset to deduct from the total number.
  *
  * @example
-    <example module="pluralizeExample" name="ng-pluralize">
+    <example module="pluralizeExample">
       <file name="index.html">
         <script>
           angular.module('pluralizeExample', [])
@@ -40833,7 +37632,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
 
       scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) {
         var count = parseFloat(newVal);
-        var countIsNaN = isNumberNaN(count);
+        var countIsNaN = isNaN(count);
 
         if (!countIsNaN && !(count in whens)) {
           // If an explicit number rule such as 1, 2, 3... is defined, just use it.
@@ -40843,12 +37642,12 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
 
         // If both `count` and `lastCount` are NaN, we don't need to re-register a watch.
         // In JS `NaN !== NaN`, so we have to explicitly check.
-        if ((count !== lastCount) && !(countIsNaN && isNumberNaN(lastCount))) {
+        if ((count !== lastCount) && !(countIsNaN && isNumber(lastCount) && isNaN(lastCount))) {
           watchRemover();
           var whenExpFn = whensExpFns[count];
           if (isUndefined(whenExpFn)) {
             if (newVal != null) {
-              $log.debug('ngPluralize: no rule defined for \'' + count + '\' in ' + whenExp);
+              $log.debug("ngPluralize: no rule defined for '" + count + "' in " + whenExp);
             }
             watchRemover = noop;
             updateElementText();
@@ -40866,13 +37665,10 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
   };
 }];
 
-/* exported ngRepeatDirective */
-
 /**
  * @ngdoc directive
  * @name ngRepeat
  * @multiElement
- * @restrict A
  *
  * @description
  * The `ngRepeat` directive instantiates a template once per item from a collection. Each template
@@ -40905,7 +37701,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
  * <div ng-repeat="(key, value) in myObj"> ... </div>
  * ```
  *
- * However, there are a few limitations compared to array iteration:
+ * However, there are a limitations compared to array iteration:
  *
  * - The JavaScript specification does not define the order of keys
  *   returned for an object, so Angular relies on the order returned by the browser
@@ -40918,7 +37714,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
  *   it's a prefix used by Angular for public (`$`) and private (`$$`) properties.
  *
  * - The built-in filters {@link ng.orderBy orderBy} and {@link ng.filter filter} do not work with
- *   objects, and will throw an error if used with one.
+ *   objects, and will throw if used with one.
  *
  * If you are hitting any of these limitations, the recommended workaround is to convert your object into an array
  * that is sorted into the order that you prefer before providing it to `ngRepeat`. You could
@@ -40929,7 +37725,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
  * # Tracking and Duplicates
  *
  * `ngRepeat` uses {@link $rootScope.Scope#$watchCollection $watchCollection} to detect changes in
- * the collection. When a change happens, `ngRepeat` then makes the corresponding changes to the DOM:
+ * the collection. When a change happens, ngRepeat then makes the corresponding changes to the DOM:
  *
  * * When an item is added, a new instance of the template is added to the DOM.
  * * When an item is removed, its template instance is removed from the DOM.
@@ -40937,7 +37733,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
  *
  * To minimize creation of DOM elements, `ngRepeat` uses a function
  * to "keep track" of all items in the collection and their corresponding DOM elements.
- * For example, if an item is added to the collection, `ngRepeat` will know that all other items
+ * For example, if an item is added to the collection, ngRepeat will know that all other items
  * already have DOM elements, and will not re-render them.
  *
  * The default tracking function (which tracks items by their identity) does not allow
@@ -40964,29 +37760,19 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
  * ```
  *
  * <div class="alert alert-success">
- * If you are working with objects that have a unique identifier property, you should track
- * by this identifier instead of the object instance. Should you reload your data later, `ngRepeat`
+ * If you are working with objects that have an identifier property, you should track
+ * by the identifier instead of the whole object. Should you reload your data later, `ngRepeat`
  * will not have to rebuild the DOM elements for items it has already rendered, even if the
  * JavaScript objects in the collection have been substituted for new ones. For large collections,
  * this significantly improves rendering performance. If you don't have a unique identifier,
  * `track by $index` can also provide a performance boost.
  * </div>
- *
  * ```html
  *    <div ng-repeat="model in collection track by model.id">
  *      {{model.name}}
  *    </div>
  * ```
  *
- * <br />
- * <div class="alert alert-warning">
- * Avoid using `track by $index` when the repeated template contains
- * {@link guide/expression#one-time-binding one-time bindings}. In such cases, the `nth` DOM
- * element will always be matched with the `nth` item of the array, so the bindings on that element
- * will not be updated even when the corresponding item changes, essentially causing the view to get
- * out-of-sync with the underlying data.
- * </div>
- *
  * When no `track by` expression is provided, it is equivalent to tracking by the built-in
  * `$id` function, which tracks items by their identity:
  * ```html
@@ -40995,17 +37781,15 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
  *    </div>
  * ```
  *
- * <br />
  * <div class="alert alert-warning">
  * **Note:** `track by` must always be the last expression:
  * </div>
  * ```
- *    <div ng-repeat="model in collection | orderBy: 'id' as filtered_result track by model.id">
- *      {{model.name}}
- *    </div>
+ * <div ng-repeat="model in collection | orderBy: 'id' as filtered_result track by model.id">
+ *     {{model.name}}
+ * </div>
  * ```
  *
- *
  * # Special repeat start and end points
  * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending
  * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.
@@ -41112,8 +37896,8 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
  *
  * @example
  * This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed
- * results by name or by age. New (entering) and removed (leaving) items are animated.
-  <example module="ngRepeat" name="ngRepeat" deps="angular-animate.js" animations="true" name="ng-repeat">
+ * results by name. New (entering) and removed (leaving) items are animated.
+  <example module="ngRepeat" name="ngRepeat" deps="angular-animate.js" animations="true">
     <file name="index.html">
       <div ng-controller="repeatController">
         I have {{friends.length}} friends. They are:
@@ -41122,7 +37906,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
           <li class="animate-repeat" ng-repeat="friend in friends | filter:q as results">
             [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
           </li>
-          <li class="animate-repeat" ng-if="results.length === 0">
+          <li class="animate-repeat" ng-if="results.length == 0">
             <strong>No results found...</strong>
           </li>
         </ul>
@@ -41215,8 +37999,9 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
     scope.$first = (index === 0);
     scope.$last = (index === (arrayLength - 1));
     scope.$middle = !(scope.$first || scope.$last);
-    // eslint-disable-next-line no-bitwise
-    scope.$odd = !(scope.$even = (index & 1) === 0);
+    // jshint bitwise: false
+    scope.$odd = !(scope.$even = (index&1) === 0);
+    // jshint bitwise: true
   };
 
   var getBlockStart = function(block) {
@@ -41242,7 +38027,7 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
       var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
 
       if (!match) {
-        throw ngRepeatMinErr('iexp', 'Expected expression in form of \'_item_ in _collection_[ track by _id_]\' but got \'{0}\'.',
+        throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
             expression);
       }
 
@@ -41251,10 +38036,10 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
       var aliasAs = match[3];
       var trackByExp = match[4];
 
-      match = lhs.match(/^(?:(\s*[$\w]+)|\(\s*([$\w]+)\s*,\s*([$\w]+)\s*\))$/);
+      match = lhs.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/);
 
       if (!match) {
-        throw ngRepeatMinErr('iidexp', '\'_item_\' in \'_item_ in _collection_\' should be an identifier or \'(_key_, _value_)\' expression, but got \'{0}\'.',
+        throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",
             lhs);
       }
       var valueIdentifier = match[3] || match[1];
@@ -41262,7 +38047,7 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
 
       if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||
           /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasAs))) {
-        throw ngRepeatMinErr('badident', 'alias \'{0}\' is invalid --- must be a valid JS identifier which is not a reserved name.',
+        throw ngRepeatMinErr('badident', "alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",
           aliasAs);
       }
 
@@ -41358,7 +38143,7 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
                 if (block && block.scope) lastBlockMap[block.id] = block;
               });
               throw ngRepeatMinErr('dupes',
-                  'Duplicates in a repeater are not allowed. Use \'track by\' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}',
+                  "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}",
                   expression, trackById, value);
             } else {
               // new never before seen block
@@ -41399,7 +38184,7 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
                 nextNode = nextNode.nextSibling;
               } while (nextNode && nextNode[NG_REMOVED]);
 
-              if (getBlockStart(block) !== nextNode) {
+              if (getBlockStart(block) != nextNode) {
                 // existing item which got moved
                 $animate.move(getBlockNodes(block.clone), null, previousNode);
               }
@@ -41439,13 +38224,11 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
  * @multiElement
  *
  * @description
- * The `ngShow` directive shows or hides the given HTML element based on the expression provided to
- * the `ngShow` attribute.
- *
- * The element is shown or hidden by removing or adding the `.ng-hide` CSS class onto the element.
- * The `.ng-hide` CSS class is predefined in AngularJS and sets the display style to none (using an
- * `!important` flag). For CSP mode please add `angular-csp.css` to your HTML file (see
- * {@link ng.directive:ngCsp ngCsp}).
+ * The `ngShow` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding
+ * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
  *
  * ```html
  * <!-- when $scope.myValue is truthy (element is visible) -->
@@ -41455,32 +38238,31 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
  * <div ng-show="myValue" class="ng-hide"></div>
  * ```
  *
- * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added
- * to the class attribute on the element causing it to become hidden. When truthy, the `.ng-hide`
- * CSS class is removed from the element causing the element not to appear hidden.
+ * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class
+ * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
  *
- * ## Why is `!important` used?
+ * ## Why is !important used?
  *
- * You may be wondering why `!important` is used for the `.ng-hide` CSS class. This is because the
- * `.ng-hide` selector can be easily overridden by heavier selectors. For example, something as
- * simple as changing the display style on a HTML list item would make hidden elements appear
- * visible. This also becomes a bigger issue when dealing with CSS frameworks.
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
  *
- * By using `!important`, the show and hide behavior will work as expected despite any clash between
- * CSS selector specificity (when `!important` isn't used with any conflicting styles). If a
- * developer chooses to override the styling to change how to hide an element then it is just a
- * matter of using `!important` in their own CSS code.
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
  *
  * ### Overriding `.ng-hide`
  *
- * By default, the `.ng-hide` class will style the element with `display: none !important`. If you
- * wish to change the hide behavior with `ngShow`/`ngHide`, you can simply overwrite the styles for
- * the `.ng-hide` CSS class. Note that the selector that needs to be used is actually
- * `.ng-hide:not(.ng-hide-animate)` to cope with extra animation classes that can be added.
+ * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope
+ * with extra animation classes that can be added.
  *
  * ```css
  * .ng-hide:not(.ng-hide-animate) {
- *   /&#42; These are just alternative ways of hiding an element &#42;/
+ *   /&#42; this is just another form of hiding an element &#42;/
  *   display: block!important;
  *   position: absolute;
  *   top: -9999px;
@@ -41488,20 +38270,29 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
  * }
  * ```
  *
- * By default you don't need to override anything in CSS and the animations will work around the
- * display style.
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
  *
  * ## A note about animations with `ngShow`
  *
- * Animations in `ngShow`/`ngHide` work with the show and hide events that are triggered when the
- * directive expression is true and false. This system works like the animation system present with
- * `ngClass` except that you must also include the `!important` flag to override the display
- * property so that the elements are not actually hidden during the animation.
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass except that
+ * you must also include the !important flag to override the display property
+ * so that you can perform an animation when the element is hidden during the time of the animation.
  *
  * ```css
- * /&#42; A working example can be found at the bottom of this page. &#42;/
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
  * .my-element.ng-hide-add, .my-element.ng-hide-remove {
- *   transition: all 0.5s linear;
+ *   /&#42; this is required as of 1.3x to properly
+ *      apply all styling in a show/hide animation &#42;/
+ *   transition: 0s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add-active,
+ * .my-element.ng-hide-remove-active {
+ *   /&#42; the transition is defined in the active class &#42;/
+ *   transition: 1s linear all;
  * }
  *
  * .my-element.ng-hide-add { ... }
@@ -41510,108 +38301,76 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
  * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
  * ```
  *
- * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display property
- * to block during animation states - ngAnimate will automatically handle the style toggling for you.
+ * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
  *
  * @animations
- * | Animation                                           | Occurs                                                                                                        |
- * |-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
- * | {@link $animate#addClass addClass} `.ng-hide`       | After the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden. |
- * | {@link $animate#removeClass removeClass} `.ng-hide` | After the `ngShow` expression evaluates to a truthy value and just before contents are set to visible.        |
+ * | Animation                        | Occurs                              |
+ * |----------------------------------|-------------------------------------|
+ * | {@link $animate#addClass addClass} `.ng-hide`  | after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden |
+ * | {@link $animate#removeClass removeClass}  `.ng-hide`  | after the `ngShow` expression evaluates to a truthy value and just before contents are set to visible |
  *
  * @element ANY
- * @param {expression} ngShow If the {@link guide/expression expression} is truthy/falsy then the
- *                            element is shown/hidden respectively.
+ * @param {expression} ngShow If the {@link guide/expression expression} is truthy
+ *     then the element is shown or hidden respectively.
  *
  * @example
- * A simple example, animating the element's opacity:
- *
-  <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-show-simple">
+  <example module="ngAnimate" deps="angular-animate.js" animations="true">
     <file name="index.html">
-      Show: <input type="checkbox" ng-model="checked" aria-label="Toggle ngShow"><br />
-      <div class="check-element animate-show-hide" ng-show="checked">
-        I show up when your checkbox is checked.
+      Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br/>
+      <div>
+        Show:
+        <div class="check-element animate-show" ng-show="checked">
+          <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+        </div>
+      </div>
+      <div>
+        Hide:
+        <div class="check-element animate-show" ng-hide="checked">
+          <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+        </div>
       </div>
     </file>
+    <file name="glyphicons.css">
+      @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
+    </file>
     <file name="animations.css">
-      .animate-show-hide.ng-hide {
-        opacity: 0;
-      }
-
-      .animate-show-hide.ng-hide-add,
-      .animate-show-hide.ng-hide-remove {
-        transition: all linear 0.5s;
-      }
-
-      .check-element {
-        border: 1px solid black;
+      .animate-show {
+        line-height: 20px;
         opacity: 1;
         padding: 10px;
-      }
-    </file>
-    <file name="protractor.js" type="protractor">
-      it('should check ngShow', function() {
-        var checkbox = element(by.model('checked'));
-        var checkElem = element(by.css('.check-element'));
-
-        expect(checkElem.isDisplayed()).toBe(false);
-        checkbox.click();
-        expect(checkElem.isDisplayed()).toBe(true);
-      });
-    </file>
-  </example>
- *
- * <hr />
- * @example
- * A more complex example, featuring different show/hide animations:
- *
-  <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-show-complex">
-    <file name="index.html">
-      Show: <input type="checkbox" ng-model="checked" aria-label="Toggle ngShow"><br />
-      <div class="check-element funky-show-hide" ng-show="checked">
-        I show up when your checkbox is checked.
-      </div>
-    </file>
-    <file name="animations.css">
-      body {
-        overflow: hidden;
-        perspective: 1000px;
-      }
-
-      .funky-show-hide.ng-hide-add {
-        transform: rotateZ(0);
-        transform-origin: right;
-        transition: all 0.5s ease-in-out;
-      }
-
-      .funky-show-hide.ng-hide-add.ng-hide-add-active {
-        transform: rotateZ(-135deg);
+        border: 1px solid black;
+        background: white;
       }
 
-      .funky-show-hide.ng-hide-remove {
-        transform: rotateY(90deg);
-        transform-origin: left;
-        transition: all 0.5s ease;
+      .animate-show.ng-hide-add, .animate-show.ng-hide-remove {
+        transition: all linear 0.5s;
       }
 
-      .funky-show-hide.ng-hide-remove.ng-hide-remove-active {
-        transform: rotateY(0);
+      .animate-show.ng-hide {
+        line-height: 0;
+        opacity: 0;
+        padding: 0 10px;
       }
 
       .check-element {
-        border: 1px solid black;
-        opacity: 1;
         padding: 10px;
+        border: 1px solid black;
+        background: white;
       }
     </file>
     <file name="protractor.js" type="protractor">
-      it('should check ngShow', function() {
-        var checkbox = element(by.model('checked'));
-        var checkElem = element(by.css('.check-element'));
+      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+      it('should check ng-show / ng-hide', function() {
+        expect(thumbsUp.isDisplayed()).toBeFalsy();
+        expect(thumbsDown.isDisplayed()).toBeTruthy();
 
-        expect(checkElem.isDisplayed()).toBe(false);
-        checkbox.click();
-        expect(checkElem.isDisplayed()).toBe(true);
+        element(by.model('checked')).click();
+
+        expect(thumbsUp.isDisplayed()).toBeTruthy();
+        expect(thumbsDown.isDisplayed()).toBeFalsy();
       });
     </file>
   </example>
@@ -41641,13 +38400,11 @@ var ngShowDirective = ['$animate', function($animate) {
  * @multiElement
  *
  * @description
- * The `ngHide` directive shows or hides the given HTML element based on the expression provided to
- * the `ngHide` attribute.
- *
- * The element is shown or hidden by removing or adding the `.ng-hide` CSS class onto the element.
- * The `.ng-hide` CSS class is predefined in AngularJS and sets the display style to none (using an
- * `!important` flag). For CSP mode please add `angular-csp.css` to your HTML file (see
- * {@link ng.directive:ngCsp ngCsp}).
+ * The `ngHide` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding
+ * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
  *
  * ```html
  * <!-- when $scope.myValue is truthy (element is hidden) -->
@@ -41657,32 +38414,30 @@ var ngShowDirective = ['$animate', function($animate) {
  * <div ng-hide="myValue"></div>
  * ```
  *
- * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added
- * to the class attribute on the element causing it to become hidden. When falsy, the `.ng-hide`
- * CSS class is removed from the element causing the element not to appear hidden.
+ * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class
+ * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
  *
- * ## Why is `!important` used?
+ * ## Why is !important used?
  *
- * You may be wondering why `!important` is used for the `.ng-hide` CSS class. This is because the
- * `.ng-hide` selector can be easily overridden by heavier selectors. For example, something as
- * simple as changing the display style on a HTML list item would make hidden elements appear
- * visible. This also becomes a bigger issue when dealing with CSS frameworks.
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
  *
- * By using `!important`, the show and hide behavior will work as expected despite any clash between
- * CSS selector specificity (when `!important` isn't used with any conflicting styles). If a
- * developer chooses to override the styling to change how to hide an element then it is just a
- * matter of using `!important` in their own CSS code.
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
  *
  * ### Overriding `.ng-hide`
  *
- * By default, the `.ng-hide` class will style the element with `display: none !important`. If you
- * wish to change the hide behavior with `ngShow`/`ngHide`, you can simply overwrite the styles for
- * the `.ng-hide` CSS class. Note that the selector that needs to be used is actually
- * `.ng-hide:not(.ng-hide-animate)` to cope with extra animation classes that can be added.
+ * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class in CSS:
  *
  * ```css
- * .ng-hide:not(.ng-hide-animate) {
- *   /&#42; These are just alternative ways of hiding an element &#42;/
+ * .ng-hide {
+ *   /&#42; this is just another form of hiding an element &#42;/
  *   display: block!important;
  *   position: absolute;
  *   top: -9999px;
@@ -41690,20 +38445,20 @@ var ngShowDirective = ['$animate', function($animate) {
  * }
  * ```
  *
- * By default you don't need to override in CSS anything and the animations will work around the
- * display style.
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
  *
  * ## A note about animations with `ngHide`
  *
- * Animations in `ngShow`/`ngHide` work with the show and hide events that are triggered when the
- * directive expression is true and false. This system works like the animation system present with
- * `ngClass` except that you must also include the `!important` flag to override the display
- * property so that the elements are not actually hidden during the animation.
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`
+ * CSS class is added and removed for you instead of your own CSS class.
  *
  * ```css
- * /&#42; A working example can be found at the bottom of this page. &#42;/
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
  * .my-element.ng-hide-add, .my-element.ng-hide-remove {
- *   transition: all 0.5s linear;
+ *   transition: 0.5s linear all;
  * }
  *
  * .my-element.ng-hide-add { ... }
@@ -41712,109 +38467,74 @@ var ngShowDirective = ['$animate', function($animate) {
  * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
  * ```
  *
- * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display property
- * to block during animation states - ngAnimate will automatically handle the style toggling for you.
+ * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
  *
  * @animations
- * | Animation                                           | Occurs                                                                                                     |
- * |-----------------------------------------------------|------------------------------------------------------------------------------------------------------------|
- * | {@link $animate#addClass addClass} `.ng-hide`       | After the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden.  |
- * | {@link $animate#removeClass removeClass} `.ng-hide` | After the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible. |
+ * | Animation                        | Occurs                              |
+ * |----------------------------------|-------------------------------------|
+ * | {@link $animate#addClass addClass} `.ng-hide`  | after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden |
+ * | {@link $animate#removeClass removeClass}  `.ng-hide`  | after the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible |
  *
  *
  * @element ANY
- * @param {expression} ngHide If the {@link guide/expression expression} is truthy/falsy then the
- *                            element is hidden/shown respectively.
+ * @param {expression} ngHide If the {@link guide/expression expression} is truthy then
+ *     the element is shown or hidden respectively.
  *
  * @example
- * A simple example, animating the element's opacity:
- *
-  <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-hide-simple">
+  <example module="ngAnimate" deps="angular-animate.js" animations="true">
     <file name="index.html">
-      Hide: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br />
-      <div class="check-element animate-show-hide" ng-hide="checked">
-        I hide when your checkbox is checked.
+      Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngShow"><br/>
+      <div>
+        Show:
+        <div class="check-element animate-hide" ng-show="checked">
+          <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+        </div>
       </div>
+      <div>
+        Hide:
+        <div class="check-element animate-hide" ng-hide="checked">
+          <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+        </div>
+      </div>
+    </file>
+    <file name="glyphicons.css">
+      @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
     </file>
     <file name="animations.css">
-      .animate-show-hide.ng-hide {
-        opacity: 0;
-      }
-
-      .animate-show-hide.ng-hide-add,
-      .animate-show-hide.ng-hide-remove {
+      .animate-hide {
         transition: all linear 0.5s;
-      }
-
-      .check-element {
-        border: 1px solid black;
+        line-height: 20px;
         opacity: 1;
         padding: 10px;
-      }
-    </file>
-    <file name="protractor.js" type="protractor">
-      it('should check ngHide', function() {
-        var checkbox = element(by.model('checked'));
-        var checkElem = element(by.css('.check-element'));
-
-        expect(checkElem.isDisplayed()).toBe(true);
-        checkbox.click();
-        expect(checkElem.isDisplayed()).toBe(false);
-      });
-    </file>
-  </example>
- *
- * <hr />
- * @example
- * A more complex example, featuring different show/hide animations:
- *
-  <example module="ngAnimate" deps="angular-animate.js" animations="true" name="ng-hide-complex">
-    <file name="index.html">
-      Hide: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br />
-      <div class="check-element funky-show-hide" ng-hide="checked">
-        I hide when your checkbox is checked.
-      </div>
-    </file>
-    <file name="animations.css">
-      body {
-        overflow: hidden;
-        perspective: 1000px;
-      }
-
-      .funky-show-hide.ng-hide-add {
-        transform: rotateZ(0);
-        transform-origin: right;
-        transition: all 0.5s ease-in-out;
-      }
-
-      .funky-show-hide.ng-hide-add.ng-hide-add-active {
-        transform: rotateZ(-135deg);
-      }
-
-      .funky-show-hide.ng-hide-remove {
-        transform: rotateY(90deg);
-        transform-origin: left;
-        transition: all 0.5s ease;
+        border: 1px solid black;
+        background: white;
       }
 
-      .funky-show-hide.ng-hide-remove.ng-hide-remove-active {
-        transform: rotateY(0);
+      .animate-hide.ng-hide {
+        line-height: 0;
+        opacity: 0;
+        padding: 0 10px;
       }
 
       .check-element {
-        border: 1px solid black;
-        opacity: 1;
         padding: 10px;
+        border: 1px solid black;
+        background: white;
       }
     </file>
     <file name="protractor.js" type="protractor">
-      it('should check ngHide', function() {
-        var checkbox = element(by.model('checked'));
-        var checkElem = element(by.css('.check-element'));
+      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+      it('should check ng-show / ng-hide', function() {
+        expect(thumbsUp.isDisplayed()).toBeFalsy();
+        expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+        element(by.model('checked')).click();
 
-        expect(checkElem.isDisplayed()).toBe(true);
-        checkbox.click();
-        expect(checkElem.isDisplayed()).toBe(false);
+        expect(thumbsUp.isDisplayed()).toBeTruthy();
+        expect(thumbsDown.isDisplayed()).toBeFalsy();
       });
     </file>
   </example>
@@ -41843,11 +38563,6 @@ var ngHideDirective = ['$animate', function($animate) {
  * @description
  * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
  *
- * @knownIssue
- * You should not use {@link guide/interpolation interpolation} in the value of the `style`
- * attribute, when using the `ngStyle` directive on the same element.
- * See {@link guide/interpolation#known-issues here} for more info.
- *
  * @element ANY
  * @param {expression} ngStyle
  *
@@ -41859,7 +38574,7 @@ var ngHideDirective = ['$animate', function($animate) {
  * See the 'background-color' style in the example below.
  *
  * @example
-   <example name="ng-style">
+   <example>
      <file name="index.html">
         <input type="button" value="set color" ng-click="myStyle={color:'red'}">
         <input type="button" value="set background" ng-click="myStyle={'background-color':'blue'}">
@@ -41945,18 +38660,14 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
  *
  * * `ngSwitchWhen`: the case statement to match against. If match then this
  *   case will be displayed. If the same match appears multiple times, all the
- *   elements will be displayed. It is possible to associate multiple values to
- *   the same `ngSwitchWhen` by defining the optional attribute
- *   `ngSwitchWhenSeparator`. The separator will be used to split the value of
- *   the `ngSwitchWhen` attribute into multiple tokens, and the element will show
- *   if any of the `ngSwitch` evaluates to any of these tokens.
+ *   elements will be displayed.
  * * `ngSwitchDefault`: the default case when no other case match. If there
  *   are multiple default cases, all of them will be displayed when no other
  *   case match.
  *
  *
  * @example
-  <example module="switchExample" deps="angular-animate.js" animations="true" name="ng-switch">
+  <example module="switchExample" deps="angular-animate.js" animations="true">
     <file name="index.html">
       <div ng-controller="ExampleController">
         <select ng-model="selection" ng-options="item for item in items">
@@ -41965,7 +38676,7 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
         <hr/>
         <div class="animate-switch-container"
           ng-switch on="selection">
-            <div class="animate-switch" ng-switch-when="settings|options" ng-switch-when-separator="|">Settings Div</div>
+            <div class="animate-switch" ng-switch-when="settings">Settings Div</div>
             <div class="animate-switch" ng-switch-when="home">Home Span</div>
             <div class="animate-switch" ng-switch-default>default</div>
         </div>
@@ -41974,7 +38685,7 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
     <file name="script.js">
       angular.module('switchExample', ['ngAnimate'])
         .controller('ExampleController', ['$scope', function($scope) {
-          $scope.items = ['settings', 'home', 'options', 'other'];
+          $scope.items = ['settings', 'home', 'other'];
           $scope.selection = $scope.items[0];
         }]);
     </file>
@@ -42021,12 +38732,8 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
         select.all(by.css('option')).get(1).click();
         expect(switchElem.getText()).toMatch(/Home Span/);
       });
-      it('should change to settings via "options"', function() {
-        select.all(by.css('option')).get(2).click();
-        expect(switchElem.getText()).toMatch(/Settings Div/);
-      });
       it('should select default', function() {
-        select.all(by.css('option')).get(3).click();
+        select.all(by.css('option')).get(2).click();
         expect(switchElem.getText()).toMatch(/default/);
       });
     </file>
@@ -42037,7 +38744,7 @@ var ngSwitchDirective = ['$animate', '$compile', function($animate, $compile) {
     require: 'ngSwitch',
 
     // asks for $scope to fool the BC controller module
-    controller: ['$scope', function NgSwitchController() {
+    controller: ['$scope', function ngSwitchController() {
      this.cases = {};
     }],
     link: function(scope, element, attr, ngSwitchController) {
@@ -42048,24 +38755,21 @@ var ngSwitchDirective = ['$animate', '$compile', function($animate, $compile) {
           selectedScopes = [];
 
       var spliceFactory = function(array, index) {
-          return function(response) {
-            if (response !== false) array.splice(index, 1);
-          };
+          return function() { array.splice(index, 1); };
       };
 
       scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
         var i, ii;
-
-        // Start with the last, in case the array is modified during the loop
-        while (previousLeaveAnimations.length) {
-          $animate.cancel(previousLeaveAnimations.pop());
+        for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) {
+          $animate.cancel(previousLeaveAnimations[i]);
         }
+        previousLeaveAnimations.length = 0;
 
         for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
           var selected = getBlockNodes(selectedElements[i].clone);
           selectedScopes[i].$destroy();
-          var runner = previousLeaveAnimations[i] = $animate.leave(selected);
-          runner.done(spliceFactory(previousLeaveAnimations, i));
+          var promise = previousLeaveAnimations[i] = $animate.leave(selected);
+          promise.then(spliceFactory(previousLeaveAnimations, i));
         }
 
         selectedElements.length = 0;
@@ -42095,16 +38799,8 @@ var ngSwitchWhenDirective = ngDirective({
   require: '^ngSwitch',
   multiElement: true,
   link: function(scope, element, attrs, ctrl, $transclude) {
-
-    var cases = attrs.ngSwitchWhen.split(attrs.ngSwitchWhenSeparator).sort().filter(
-      // Filter duplicate cases
-      function(element, index, array) { return array[index - 1] !== element; }
-    );
-
-    forEach(cases, function(whenCase) {
-      ctrl.cases['!' + whenCase] = (ctrl.cases['!' + whenCase] || []);
-      ctrl.cases['!' + whenCase].push({ transclude: $transclude, element: element });
-    });
+    ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);
+    ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });
   }
 });
 
@@ -42132,8 +38828,8 @@ var ngSwitchDefaultDirective = ngDirective({
  *
  * If the transcluded content is not empty (i.e. contains one or more DOM nodes, including whitespace text nodes), any existing
  * content of this element will be removed before the transcluded content is inserted.
- * If the transcluded content is empty (or only whitespace), the existing content is left intact. This lets you provide fallback
- * content in the case that no transcluded content is provided.
+ * If the transcluded content is empty, the existing content is left intact. This lets you provide fallback content in the case
+ * that no transcluded content is provided.
  *
  * @element ANY
  *
@@ -42166,7 +38862,7 @@ var ngSwitchDefaultDirective = ngDirective({
  *     <div ng-controller="ExampleController">
  *       <input ng-model="title" aria-label="title"> <br/>
  *       <textarea ng-model="text" aria-label="text"></textarea> <br/>
- *       <pane title="{{title}}"><span>{{text}}</span></pane>
+ *       <pane title="{{title}}">{{text}}</pane>
  *     </div>
  *   </file>
  *   <file name="protractor.js" type="protractor">
@@ -42188,7 +38884,7 @@ var ngSwitchDefaultDirective = ngDirective({
  * This example shows how to use `NgTransclude` with fallback content, that
  * is displayed if no transcluded content is provided.
  *
- * <example module="transcludeFallbackContentExample" name="ng-transclude">
+ * <example module="transcludeFallbackContentExample">
  * <file name="index.html">
  * <script>
  * angular.module('transcludeFallbackContentExample', [])
@@ -42241,7 +38937,7 @@ var ngSwitchDefaultDirective = ngDirective({
  *   </file>
  *   <file name="app.js">
  *    angular.module('multiSlotTranscludeExample', [])
- *     .directive('pane', function() {
+ *     .directive('pane', function(){
  *        return {
  *          restrict: 'E',
  *          transclude: {
@@ -42258,7 +38954,7 @@ var ngSwitchDefaultDirective = ngDirective({
  *    })
  *    .controller('ExampleController', ['$scope', function($scope) {
  *      $scope.title = 'Lorem Ipsum';
- *      $scope.link = 'https://google.com';
+ *      $scope.link = "https://google.com";
  *      $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
  *    }]);
  *   </file>
@@ -42278,72 +38974,37 @@ var ngSwitchDefaultDirective = ngDirective({
  * </example>
  */
 var ngTranscludeMinErr = minErr('ngTransclude');
-var ngTranscludeDirective = ['$compile', function($compile) {
-  return {
-    restrict: 'EAC',
-    terminal: true,
-    compile: function ngTranscludeCompile(tElement) {
-
-      // Remove and cache any original content to act as a fallback
-      var fallbackLinkFn = $compile(tElement.contents());
-      tElement.empty();
-
-      return function ngTranscludePostLink($scope, $element, $attrs, controller, $transclude) {
-
-        if (!$transclude) {
-          throw ngTranscludeMinErr('orphan',
-          'Illegal use of ngTransclude directive in the template! ' +
-          'No parent directive that requires a transclusion found. ' +
-          'Element: {0}',
-          startingTag($element));
-        }
-
-
-        // If the attribute is of the form: `ng-transclude="ng-transclude"` then treat it like the default
-        if ($attrs.ngTransclude === $attrs.$attr.ngTransclude) {
-          $attrs.ngTransclude = '';
-        }
-        var slotName = $attrs.ngTransclude || $attrs.ngTranscludeSlot;
-
-        // If the slot is required and no transclusion content is provided then this call will throw an error
-        $transclude(ngTranscludeCloneAttachFn, null, slotName);
+var ngTranscludeDirective = ngDirective({
+  restrict: 'EAC',
+  link: function($scope, $element, $attrs, controller, $transclude) {
 
-        // If the slot is optional and no transclusion content is provided then use the fallback content
-        if (slotName && !$transclude.isSlotFilled(slotName)) {
-          useFallbackContent();
-        }
-
-        function ngTranscludeCloneAttachFn(clone, transcludedScope) {
-          if (clone.length && notWhitespace(clone)) {
-            $element.append(clone);
-          } else {
-            useFallbackContent();
-            // There is nothing linked against the transcluded scope since no content was available,
-            // so it should be safe to clean up the generated scope.
-            transcludedScope.$destroy();
-          }
-        }
+    if ($attrs.ngTransclude === $attrs.$attr.ngTransclude) {
+      // If the attribute is of the form: `ng-transclude="ng-transclude"`
+      // then treat it like the default
+      $attrs.ngTransclude = '';
+    }
 
-        function useFallbackContent() {
-          // Since this is the fallback content rather than the transcluded content,
-          // we link against the scope of this directive rather than the transcluded scope
-          fallbackLinkFn($scope, function(clone) {
-            $element.append(clone);
-          });
-        }
+    function ngTranscludeCloneAttachFn(clone) {
+      if (clone.length) {
+        $element.empty();
+        $element.append(clone);
+      }
+    }
 
-        function notWhitespace(nodes) {
-          for (var i = 0, ii = nodes.length; i < ii; i++) {
-            var node = nodes[i];
-            if (node.nodeType !== NODE_TYPE_TEXT || node.nodeValue.trim()) {
-              return true;
-            }
-          }
-        }
-      };
+    if (!$transclude) {
+      throw ngTranscludeMinErr('orphan',
+       'Illegal use of ngTransclude directive in the template! ' +
+       'No parent directive that requires a transclusion found. ' +
+       'Element: {0}',
+       startingTag($element));
     }
-  };
-}];
+
+    // If there is no slot name defined or the slot name is not optional
+    // then transclude the slot
+    var slotName = $attrs.ngTransclude || $attrs.ngTranscludeSlot;
+    $transclude(ngTranscludeCloneAttachFn, null, slotName);
+  }
+});
 
 /**
  * @ngdoc directive
@@ -42361,7 +39022,7 @@ var ngTranscludeDirective = ['$compile', function($compile) {
  * @param {string} id Cache name of the template.
  *
  * @example
-  <example  name="script-tag">
+  <example>
     <file name="index.html">
       <script type="text/ng-template" id="/tpl.html">
         Content of the template.
@@ -42383,7 +39044,7 @@ var scriptDirective = ['$templateCache', function($templateCache) {
     restrict: 'E',
     terminal: true,
     compile: function(element, attr) {
-      if (attr.type === 'text/ng-template') {
+      if (attr.type == 'text/ng-template') {
         var templateUrl = attr.id,
             text = element[0].text;
 
@@ -42393,20 +39054,15 @@ var scriptDirective = ['$templateCache', function($templateCache) {
   };
 }];
 
-/* exported selectDirective, optionDirective */
-
 var noopNgModelController = { $setViewValue: noop, $render: noop };
 
-function setOptionSelectedStatus(optionEl, value) {
-  optionEl.prop('selected', value); // needed for IE
-  /**
-   * When unselecting an option, setting the property to null / false should be enough
-   * However, screenreaders might react to the selected attribute instead, see
-   * https://github.com/angular/angular.js/issues/14419
-   * Note: "selected" is a boolean attr and will be removed when the "value" arg in attr() is false
-   * or null
-   */
-  optionEl.attr('selected', value);
+function chromeHack(optionElement) {
+  // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459
+  // Adding an <option selected="selected"> element to a <select required="required"> should
+  // automatically select the new element
+  if (optionElement[0].hasAttribute('selected')) {
+    optionElement[0].selected = true;
+  }
 }
 
 /**
@@ -42418,16 +39074,13 @@ function setOptionSelectedStatus(optionEl, value) {
  * added `<option>` elements, perhaps by an `ngRepeat` directive.
  */
 var SelectController =
-        ['$element', '$scope', /** @this */ function($element, $scope) {
+        ['$element', '$scope', function($element, $scope) {
 
   var self = this,
-      optionsMap = new NgMap();
-
-  self.selectValueMap = {}; // Keys are the hashed values, values the original values
+      optionsMap = new HashMap();
 
   // If the ngModel doesn't get provided then provide a dummy noop version to prevent errors
   self.ngModelCtrl = noopNgModelController;
-  self.multiple = false;
 
   // The "unknown" option is one that is prepended to the list if the viewValue
   // does not match any of the options. When it is rendered the value of the unknown
@@ -42436,94 +39089,42 @@ var SelectController =
   // We can't just jqLite('<option>') since jqLite is not smart enough
   // to create it in <select> and IE barfs otherwise.
   self.unknownOption = jqLite(window.document.createElement('option'));
-
-  // The empty option is an option with the value '' that te application developer can
-  // provide inside the select. When the model changes to a value that doesn't match an option,
-  // it is selected - so if an empty option is provided, no unknown option is generated.
-  // However, the empty option is not removed when the model matches an option. It is always selectable
-  // and indicates that a "null" selection has been made.
-  self.hasEmptyOption = false;
-  self.emptyOption = undefined;
-
   self.renderUnknownOption = function(val) {
-    var unknownVal = self.generateUnknownOptionValue(val);
+    var unknownVal = '? ' + hashKey(val) + ' ?';
     self.unknownOption.val(unknownVal);
     $element.prepend(self.unknownOption);
-    setOptionSelectedStatus(self.unknownOption, true);
-    $element.val(unknownVal);
-  };
-
-  self.updateUnknownOption = function(val) {
-    var unknownVal = self.generateUnknownOptionValue(val);
-    self.unknownOption.val(unknownVal);
-    setOptionSelectedStatus(self.unknownOption, true);
     $element.val(unknownVal);
   };
 
-  self.generateUnknownOptionValue = function(val) {
-    return '? ' + hashKey(val) + ' ?';
-  };
+  $scope.$on('$destroy', function() {
+    // disable unknown option so that we don't do work when the whole select is being destroyed
+    self.renderUnknownOption = noop;
+  });
 
   self.removeUnknownOption = function() {
     if (self.unknownOption.parent()) self.unknownOption.remove();
   };
 
-  self.selectEmptyOption = function() {
-    if (self.emptyOption) {
-      $element.val('');
-      setOptionSelectedStatus(self.emptyOption, true);
-    }
-  };
-
-  self.unselectEmptyOption = function() {
-    if (self.hasEmptyOption) {
-      self.emptyOption.removeAttr('selected');
-    }
-  };
-
-  $scope.$on('$destroy', function() {
-    // disable unknown option so that we don't do work when the whole select is being destroyed
-    self.renderUnknownOption = noop;
-  });
 
   // Read the value of the select control, the implementation of this changes depending
   // upon whether the select can have multiple values and whether ngOptions is at work.
   self.readValue = function readSingleValue() {
-    var val = $element.val();
-    // ngValue added option values are stored in the selectValueMap, normal interpolations are not
-    var realVal = val in self.selectValueMap ? self.selectValueMap[val] : val;
-
-    if (self.hasOption(realVal)) {
-      return realVal;
-    }
-
-    return null;
+    self.removeUnknownOption();
+    return $element.val();
   };
 
 
   // Write the value to the select control, the implementation of this changes depending
   // upon whether the select can have multiple values and whether ngOptions is at work.
   self.writeValue = function writeSingleValue(value) {
-    // Make sure to remove the selected attribute from the previously selected option
-    // Otherwise, screen readers might get confused
-    var currentlySelectedOption = $element[0].options[$element[0].selectedIndex];
-    if (currentlySelectedOption) setOptionSelectedStatus(jqLite(currentlySelectedOption), false);
-
     if (self.hasOption(value)) {
       self.removeUnknownOption();
-
-      var hashedVal = hashKey(value);
-      $element.val(hashedVal in self.selectValueMap ? hashedVal : value);
-
-      // Set selected attribute and property on selected option for screen readers
-      var selectedOption = $element[0].options[$element[0].selectedIndex];
-      setOptionSelectedStatus(jqLite(selectedOption), true);
+      $element.val(value);
+      if (value === '') self.emptyOption.prop('selected', true); // to make IE9 happy
     } else {
       if (value == null && self.emptyOption) {
         self.removeUnknownOption();
-        self.selectEmptyOption();
-      } else if (self.unknownOption.parent().length) {
-        self.updateUnknownOption(value);
+        $element.val('');
       } else {
         self.renderUnknownOption(value);
       }
@@ -42538,14 +39139,12 @@ var SelectController =
 
     assertNotHasOwnProperty(value, '"option value"');
     if (value === '') {
-      self.hasEmptyOption = true;
       self.emptyOption = element;
     }
     var count = optionsMap.get(value) || 0;
-    optionsMap.set(value, count + 1);
-    // Only render at the end of a digest. This improves render performance when many options
-    // are added during a digest and ensures all relevant options are correctly marked as selected
-    scheduleRender();
+    optionsMap.put(value, count + 1);
+    self.ngModelCtrl.$render();
+    chromeHack(element);
   };
 
   // Tell the select control that an option, with the given value, has been removed
@@ -42553,13 +39152,12 @@ var SelectController =
     var count = optionsMap.get(value);
     if (count) {
       if (count === 1) {
-        optionsMap.delete(value);
+        optionsMap.remove(value);
         if (value === '') {
-          self.hasEmptyOption = false;
           self.emptyOption = undefined;
         }
       } else {
-        optionsMap.set(value, count - 1);
+        optionsMap.put(value, count - 1);
       }
     }
   };
@@ -42570,131 +39168,35 @@ var SelectController =
   };
 
 
-  var renderScheduled = false;
-  function scheduleRender() {
-    if (renderScheduled) return;
-    renderScheduled = true;
-    $scope.$$postDigest(function() {
-      renderScheduled = false;
-      self.ngModelCtrl.$render();
-    });
-  }
-
-  var updateScheduled = false;
-  function scheduleViewValueUpdate(renderAfter) {
-    if (updateScheduled) return;
-
-    updateScheduled = true;
-
-    $scope.$$postDigest(function() {
-      if ($scope.$$destroyed) return;
-
-      updateScheduled = false;
-      self.ngModelCtrl.$setViewValue(self.readValue());
-      if (renderAfter) self.ngModelCtrl.$render();
-    });
-  }
-
-
   self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {
 
-    if (optionAttrs.$attr.ngValue) {
-      // The value attribute is set by ngValue
-      var oldVal, hashedVal = NaN;
-      optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {
-
-        var removal;
-        var previouslySelected = optionElement.prop('selected');
-
-        if (isDefined(hashedVal)) {
-          self.removeOption(oldVal);
-          delete self.selectValueMap[hashedVal];
-          removal = true;
-        }
-
-        hashedVal = hashKey(newVal);
-        oldVal = newVal;
-        self.selectValueMap[hashedVal] = newVal;
-        self.addOption(newVal, optionElement);
-        // Set the attribute directly instead of using optionAttrs.$set - this stops the observer
-        // from firing a second time. Other $observers on value will also get the result of the
-        // ngValue expression, not the hashed value
-        optionElement.attr('value', hashedVal);
-
-        if (removal && previouslySelected) {
-          scheduleViewValueUpdate();
-        }
-
-      });
-    } else if (interpolateValueFn) {
+    if (interpolateValueFn) {
       // The value attribute is interpolated
+      var oldVal;
       optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {
-        // This method is overwritten in ngOptions and has side-effects!
-        self.readValue();
-
-        var removal;
-        var previouslySelected = optionElement.prop('selected');
-
         if (isDefined(oldVal)) {
           self.removeOption(oldVal);
-          removal = true;
         }
         oldVal = newVal;
         self.addOption(newVal, optionElement);
-
-        if (removal && previouslySelected) {
-          scheduleViewValueUpdate();
-        }
       });
     } else if (interpolateTextFn) {
       // The text content is interpolated
       optionScope.$watch(interpolateTextFn, function interpolateWatchAction(newVal, oldVal) {
         optionAttrs.$set('value', newVal);
-        var previouslySelected = optionElement.prop('selected');
         if (oldVal !== newVal) {
           self.removeOption(oldVal);
         }
         self.addOption(newVal, optionElement);
-
-        if (oldVal && previouslySelected) {
-          scheduleViewValueUpdate();
-        }
       });
     } else {
       // The value attribute is static
       self.addOption(optionAttrs.value, optionElement);
     }
 
-
-    optionAttrs.$observe('disabled', function(newVal) {
-
-      // Since model updates will also select disabled options (like ngOptions),
-      // we only have to handle options becoming disabled, not enabled
-
-      if (newVal === 'true' || newVal && optionElement.prop('selected')) {
-        if (self.multiple) {
-          scheduleViewValueUpdate(true);
-        } else {
-          self.ngModelCtrl.$setViewValue(null);
-          self.ngModelCtrl.$render();
-        }
-      }
-    });
-
     optionElement.on('$destroy', function() {
-      var currentValue = self.readValue();
-      var removeValue = optionAttrs.value;
-
-      self.removeOption(removeValue);
-      scheduleRender();
-
-      if (self.multiple && currentValue && currentValue.indexOf(removeValue) !== -1 ||
-          currentValue === removeValue
-      ) {
-        // When multiple (selected) options are destroyed at the same time, we don't want
-        // to run a model update for each of them. Instead, run a single update in the $$postDigest
-        scheduleViewValueUpdate(true);
-      }
+      self.removeOption(optionAttrs.value);
+      self.ngModelCtrl.$render();
     });
   };
 }];
@@ -42705,7 +39207,7 @@ var SelectController =
  * @restrict E
  *
  * @description
- * HTML `select` element with angular data-binding.
+ * HTML `SELECT` element with angular data-binding.
  *
  * The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding
  * between the scope and the `<select>` control (including setting default values).
@@ -42715,24 +39217,14 @@ var SelectController =
  * When an item in the `<select>` menu is selected, the value of the selected option will be bound
  * to the model identified by the `ngModel` directive. With static or repeated options, this is
  * the content of the `value` attribute or the textContent of the `<option>`, if the value attribute is missing.
- * Value and textContent can be interpolated.
- *
- * ## Matching model and option values
- *
- * In general, the match between the model and an option is evaluated by strictly comparing the model
- * value against the value of the available options.
+ * If you want dynamic value attributes, you can use interpolation inside the value attribute.
  *
- * If you are setting the option value with the option's `value` attribute, or textContent, the
- * value will always be a `string` which means that the model value must also be a string.
- * Otherwise the `select` directive cannot match them correctly.
- *
- * To bind the model to a non-string value, you can use one of the following strategies:
- * - the {@link ng.ngOptions `ngOptions`} directive
- *   ({@link ng.select#using-select-with-ngoptions-and-setting-a-default-value})
- * - the {@link ng.ngValue `ngValue`} directive, which allows arbitrary expressions to be
- *   option values ({@link ng.select#using-ngvalue-to-bind-the-model-to-an-array-of-objects Example})
- * - model $parsers / $formatters to convert the string value
- *   ({@link ng.select#binding-select-to-a-non-string-value-via-ngmodel-parsing-formatting Example})
+ * <div class="alert alert-warning">
+ * Note that the value of a `select` directive used without `ngOptions` is always a string.
+ * When the model needs to be bound to a non-string value, you must either explicitly convert it
+ * using a directive (see example below) or use `ngOptions` to specify the set of options.
+ * This is because an option element can only be bound to string values at present.
+ * </div>
  *
  * If the viewValue of `ngModel` does not match any of the options, then the control
  * will automatically add an "unknown" option, which it then removes when the mismatch is resolved.
@@ -42741,17 +39233,13 @@ var SelectController =
  * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
  * option. See example below for demonstration.
  *
- * ## Choosing between `ngRepeat` and `ngOptions`
- *
+ * <div class="alert alert-info">
  * In many cases, `ngRepeat` can be used on `<option>` elements instead of {@link ng.directive:ngOptions
- * ngOptions} to achieve a similar result. However, `ngOptions` provides some benefits:
- * - more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
- * comprehension expression
- * - reduced memory consumption by not creating a new scope for each repeated instance
- * - increased render speed by creating the options in a documentFragment instead of individually
- *
- * Specifically, select with repeated options slows down significantly starting at 2000 options in
- * Chrome and Internet Explorer / Edge.
+ * ngOptions} to achieve a similar result. However, `ngOptions` provides some benefits, such as
+ * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
+ * comprehension expression, and additionally in reducing memory and increasing speed by not creating
+ * a new scope for each repeated instance.
+ * </div>
  *
  *
  * @param {string} ngModel Assignable angular expression to data-bind to.
@@ -42766,8 +39254,6 @@ var SelectController =
  *    interaction with the select element.
  * @param {string=} ngOptions sets the options that the select is populated with and defines what is
  * set on the model on selection. See {@link ngOptions `ngOptions`}.
- * @param {string=} ngAttrSize sets the size of the select element dynamically. Uses the
- * {@link guide/interpolation#-ngattr-for-binding-to-arbitrary-attributes ngAttr} directive.
  *
  * @example
  * ### Simple `select` elements with static options
@@ -42808,7 +39294,7 @@ var SelectController =
  *      $scope.data = {
  *       singleSelect: null,
  *       multipleSelect: [],
- *       option1: 'option-1'
+ *       option1: 'option-1',
  *      };
  *
  *      $scope.forceUnknownOption = function() {
@@ -42819,65 +39305,34 @@ var SelectController =
  *</example>
  *
  * ### Using `ngRepeat` to generate `select` options
- * <example name="select-ngrepeat" module="ngrepeatSelect">
+ * <example name="ngrepeat-select" module="ngrepeatSelect">
  * <file name="index.html">
  * <div ng-controller="ExampleController">
  *   <form name="myForm">
  *     <label for="repeatSelect"> Repeat select: </label>
- *     <select name="repeatSelect" id="repeatSelect" ng-model="data.model">
+ *     <select name="repeatSelect" id="repeatSelect" ng-model="data.repeatSelect">
  *       <option ng-repeat="option in data.availableOptions" value="{{option.id}}">{{option.name}}</option>
  *     </select>
  *   </form>
  *   <hr>
- *   <tt>model = {{data.model}}</tt><br/>
+ *   <tt>repeatSelect = {{data.repeatSelect}}</tt><br/>
  * </div>
  * </file>
  * <file name="app.js">
  *  angular.module('ngrepeatSelect', [])
  *    .controller('ExampleController', ['$scope', function($scope) {
  *      $scope.data = {
- *       model: null,
+ *       repeatSelect: null,
  *       availableOptions: [
  *         {id: '1', name: 'Option A'},
  *         {id: '2', name: 'Option B'},
  *         {id: '3', name: 'Option C'}
- *       ]
+ *       ],
  *      };
  *   }]);
  * </file>
  *</example>
  *
- * ### Using `ngValue` to bind the model to an array of objects
- * <example name="select-ngvalue" module="ngvalueSelect">
- * <file name="index.html">
- * <div ng-controller="ExampleController">
- *   <form name="myForm">
- *     <label for="ngvalueselect"> ngvalue select: </label>
- *     <select size="6" name="ngvalueselect" ng-model="data.model" multiple>
- *       <option ng-repeat="option in data.availableOptions" ng-value="option.value">{{option.name}}</option>
- *     </select>
- *   </form>
- *   <hr>
- *   <pre>model = {{data.model | json}}</pre><br/>
- * </div>
- * </file>
- * <file name="app.js">
- *  angular.module('ngvalueSelect', [])
- *    .controller('ExampleController', ['$scope', function($scope) {
- *      $scope.data = {
- *       model: null,
- *       availableOptions: [
-           {value: 'myString', name: 'string'},
-           {value: 1, name: 'integer'},
-           {value: true, name: 'boolean'},
-           {value: null, name: 'null'},
-           {value: {prop: 'value'}, name: 'object'},
-           {value: ['a'], name: 'array'}
- *       ]
- *      };
- *   }]);
- * </file>
- *</example>
  *
  * ### Using `select` with `ngOptions` and setting a default value
  * See the {@link ngOptions ngOptions documentation} for more `ngOptions` usage examples.
@@ -42943,6 +39398,7 @@ var SelectController =
  *   </file>
  *   <file name="protractor.js" type="protractor">
  *     it('should initialize to model', function() {
+ *       var select = element(by.css('select'));
  *       expect(element(by.model('model.id')).$('option:checked').getText()).toEqual('Two');
  *     });
  *   </file>
@@ -42964,16 +39420,11 @@ var selectDirective = function() {
 
   function selectPreLink(scope, element, attr, ctrls) {
 
-      var selectCtrl = ctrls[0];
+      // if ngModel is not defined, we don't need to do anything
       var ngModelCtrl = ctrls[1];
+      if (!ngModelCtrl) return;
 
-      // if ngModel is not defined, we don't need to do anything but set the registerOption
-      // function to noop, so options don't get added internally
-      if (!ngModelCtrl) {
-        selectCtrl.registerOption = noop;
-        return;
-      }
-
+      var selectCtrl = ctrls[0];
 
       selectCtrl.ngModelCtrl = ngModelCtrl;
 
@@ -42981,7 +39432,6 @@ var selectDirective = function() {
       // to the `readValue` method, which can be changed if the select can have multiple
       // selected values or if the options are being generated by `ngOptions`
       element.on('change', function() {
-        selectCtrl.removeUnknownOption();
         scope.$apply(function() {
           ngModelCtrl.$setViewValue(selectCtrl.readValue());
         });
@@ -42992,15 +39442,13 @@ var selectDirective = function() {
       // we have to add an extra watch since ngModel doesn't work well with arrays - it
       // doesn't trigger rendering if only an item in the array changes.
       if (attr.multiple) {
-        selectCtrl.multiple = true;
 
         // Read value now needs to check each option to see if it is selected
         selectCtrl.readValue = function readMultipleValue() {
           var array = [];
           forEach(element.find('option'), function(option) {
-            if (option.selected && !option.disabled) {
-              var val = option.value;
-              array.push(val in selectCtrl.selectValueMap ? selectCtrl.selectValueMap[val] : val);
+            if (option.selected) {
+              array.push(option.value);
             }
           });
           return array;
@@ -43008,21 +39456,9 @@ var selectDirective = function() {
 
         // Write value now needs to set the selected property of each matching option
         selectCtrl.writeValue = function writeMultipleValue(value) {
+          var items = new HashMap(value);
           forEach(element.find('option'), function(option) {
-            var shouldBeSelected = !!value && (includes(value, option.value) ||
-                                               includes(value, selectCtrl.selectValueMap[option.value]));
-            var currentlySelected = option.selected;
-
-            // IE and Edge, adding options to the selection via shift+click/UP/DOWN,
-            // will de-select already selected options if "selected" on those options was set
-            // more than once (i.e. when the options were already selected)
-            // So we only modify the selected property if neccessary.
-            // Note: this behavior cannot be replicated via unit tests because it only shows in the
-            // actual user interface.
-            if (shouldBeSelected !== currentlySelected) {
-              setOptionSelectedStatus(jqLite(option), shouldBeSelected);
-            }
-
+            option.selected = isDefined(items.get(option.value));
           });
         };
 
@@ -43073,17 +39509,13 @@ var optionDirective = ['$interpolate', function($interpolate) {
     restrict: 'E',
     priority: 100,
     compile: function(element, attr) {
-      var interpolateValueFn, interpolateTextFn;
-
-      if (isDefined(attr.ngValue)) {
-        // Will be handled by registerOption
-      } else if (isDefined(attr.value)) {
+      if (isDefined(attr.value)) {
         // If the value attribute is defined, check if it contains an interpolation
-        interpolateValueFn = $interpolate(attr.value, true);
+        var interpolateValueFn = $interpolate(attr.value, true);
       } else {
         // If the value attribute is not defined then we fall back to the
         // text content of the option element, which may be interpolated
-        interpolateTextFn = $interpolate(element.text(), true);
+        var interpolateTextFn = $interpolate(element.text(), true);
         if (!interpolateTextFn) {
           attr.$set('value', element.text());
         }
@@ -43105,10 +39537,14 @@ var optionDirective = ['$interpolate', function($interpolate) {
   };
 }];
 
+var styleDirective = valueFn({
+  restrict: 'E',
+  terminal: false
+});
+
 /**
  * @ngdoc directive
  * @name ngRequired
- * @restrict A
  *
  * @description
  *
@@ -43365,7 +39801,7 @@ var maxlengthDirective = function() {
       var maxlength = -1;
       attr.$observe('maxlength', function(value) {
         var intVal = toInt(value);
-        maxlength = isNumberNaN(intVal) ? -1 : intVal;
+        maxlength = isNaN(intVal) ? -1 : intVal;
         ctrl.$validate();
       });
       ctrl.$validators.maxlength = function(modelValue, viewValue) {
@@ -43459,15 +39895,15 @@ var minlengthDirective = function() {
 };
 
 if (window.angular.bootstrap) {
-  // AngularJS is already loaded, so we can return here...
+  //AngularJS is already loaded, so we can return here...
   if (window.console) {
     console.log('WARNING: Tried to load angular more than once.');
   }
   return;
 }
 
-// try to bind to jquery now so that one can write jqLite(fn)
-// but we will rebind on bootstrap again.
+//try to bind to jquery now so that one can write jqLite(document).ready()
+//but we will rebind on bootstrap again.
 bindJQuery();
 
 publishExternalAPI(angular);
@@ -43653,8 +40089,7 @@ angular.scenario.output = angular.scenario.output || function(name, fn) {
  */
 angular.scenario.dsl = angular.scenario.dsl || function(name, fn) {
   angular.scenario.dsl[name] = function() {
-    // The dsl binds `this` for us when calling chained functions
-    /** @this */
+    /* jshint -W040 *//* The dsl binds `this` for us when calling chained functions */
     function executeStatement(statement, args) {
       var result = statement.apply(this, args);
       if (angular.isFunction(result) || result instanceof angular.scenario.Future) {
@@ -43674,7 +40109,7 @@ angular.scenario.dsl = angular.scenario.dsl || function(name, fn) {
       return chain;
     }
     var statement = fn.apply(this, arguments);
-    return /** @this */ function() {
+    return function() {
       return executeStatement.call(this, statement, arguments);
     };
   };
@@ -43728,7 +40163,7 @@ angular.scenario.setUpAndRun = function(config) {
   }
 
   angular.forEach(angular.scenario.output, function(fn, name) {
-    if (!output.length || output.indexOf(name) !== -1) {
+    if (!output.length || output.indexOf(name) != -1) {
       var context = body.append('<div></div>').find('div:last');
       context.attr('id', name);
       fn.call({}, context, $runner, objModel);
@@ -43757,7 +40192,6 @@ angular.scenario.setUpAndRun = function(config) {
       console.log(formatException(error));
     } else {
       // Do something for IE
-      // eslint-disable-next-line no-alert
       alert(error);
     }
   });
@@ -43888,9 +40322,9 @@ _jQuery.fn.bindings = function(windowJquery, bindExp) {
     match = function(actualExp) {
       if (actualExp) {
         actualExp = actualExp.replace(/\s/g, '');
-        if (actualExp === bindExp) return true;
+        if (actualExp == bindExp) return true;
         if (actualExp.indexOf(bindExp) === 0) {
-          return actualExp.charAt(bindExp.length) === '|';
+          return actualExp.charAt(bindExp.length) == '|';
         }
       }
     };
@@ -43917,11 +40351,11 @@ _jQuery.fn.bindings = function(windowJquery, bindExp) {
     result.push('' + value);
   }
 
-  selection.each(/* @this Node */ function() {
+  selection.each(function() {
     var element = windowJquery(this),
         bindings;
-    if ((bindings = element.data('$binding'))) {
-      for (var expressions = [], binding, j = 0, jj = bindings.length; j < jj; j++) {
+    if (bindings = element.data('$binding')) {
+      for (var expressions = [], binding, j=0, jj=bindings.length; j < jj; j++) {
         binding = bindings[j];
 
         if (binding.expressions) {
@@ -43942,6 +40376,154 @@ _jQuery.fn.bindings = function(windowJquery, bindExp) {
   return result;
 };
 
+(function() {
+  /**
+   * Triggers a browser event. Attempts to choose the right event if one is
+   * not specified.
+   *
+   * @param {Object} element Either a wrapped jQuery/jqLite node or a DOMElement
+   * @param {string} eventType Optional event type
+   * @param {Object=} eventData An optional object which contains additional event data (such as x,y
+   * coordinates, keys, etc...) that are passed into the event when triggered
+   */
+  window.browserTrigger = function browserTrigger(element, eventType, eventData) {
+    if (element && !element.nodeName) element = element[0];
+    if (!element) return;
+
+    eventData = eventData || {};
+    var relatedTarget = eventData.relatedTarget || element;
+    var keys = eventData.keys;
+    var x = eventData.x;
+    var y = eventData.y;
+
+    var inputType = (element.type) ? element.type.toLowerCase() : null,
+        nodeName = element.nodeName.toLowerCase();
+    if (!eventType) {
+      eventType = {
+        'text':            'change',
+        'textarea':        'change',
+        'hidden':          'change',
+        'password':        'change',
+        'button':          'click',
+        'submit':          'click',
+        'reset':           'click',
+        'image':           'click',
+        'checkbox':        'click',
+        'radio':           'click',
+        'select-one':      'change',
+        'select-multiple': 'change',
+        '_default_':       'click'
+      }[inputType || '_default_'];
+    }
+
+    if (nodeName == 'option') {
+      element.parentNode.value = element.value;
+      element = element.parentNode;
+      eventType = 'change';
+    }
+
+    keys = keys || [];
+    function pressed(key) {
+      return keys.indexOf(key) !== -1;
+    }
+
+    var evnt;
+    if (/transitionend/.test(eventType)) {
+      if (window.WebKitTransitionEvent) {
+        evnt = new WebKitTransitionEvent(eventType, eventData);
+        evnt.initEvent(eventType, false, true);
+      } else {
+        try {
+          evnt = new TransitionEvent(eventType, eventData);
+        }
+        catch (e) {
+          evnt = window.document.createEvent('TransitionEvent');
+          evnt.initTransitionEvent(eventType, null, null, null, eventData.elapsedTime || 0);
+        }
+      }
+    } else if (/animationend/.test(eventType)) {
+      if (window.WebKitAnimationEvent) {
+        evnt = new WebKitAnimationEvent(eventType, eventData);
+        evnt.initEvent(eventType, false, true);
+      } else {
+        try {
+          evnt = new AnimationEvent(eventType, eventData);
+        }
+        catch (e) {
+          evnt = window.document.createEvent('AnimationEvent');
+          evnt.initAnimationEvent(eventType, null, null, null, eventData.elapsedTime || 0);
+        }
+      }
+    } else if (/touch/.test(eventType) && supportsTouchEvents()) {
+      evnt = createTouchEvent(element, eventType, x, y);
+    } else {
+      evnt = window.document.createEvent('MouseEvents');
+      x = x || 0;
+      y = y || 0;
+      evnt.initMouseEvent(eventType, true, true, window, 0, x, y, x, y, pressed('ctrl'),
+          pressed('alt'), pressed('shift'), pressed('meta'), 0, relatedTarget);
+    }
+
+    /* we're unable to change the timeStamp value directly so this
+     * is only here to allow for testing where the timeStamp value is
+     * read */
+    evnt.$manualTimeStamp = eventData.timeStamp;
+
+    if (!evnt) return;
+
+    var originalPreventDefault = evnt.preventDefault,
+        appWindow = element.ownerDocument.defaultView,
+        fakeProcessDefault = true,
+        finalProcessDefault,
+        angular = appWindow.angular || {};
+
+    // igor: temporary fix for https://bugzilla.mozilla.org/show_bug.cgi?id=684208
+    angular['ff-684208-preventDefault'] = false;
+    evnt.preventDefault = function() {
+      fakeProcessDefault = false;
+      return originalPreventDefault.apply(evnt, arguments);
+    };
+
+    element.dispatchEvent(evnt);
+    finalProcessDefault = !(angular['ff-684208-preventDefault'] || !fakeProcessDefault);
+
+    delete angular['ff-684208-preventDefault'];
+
+    return finalProcessDefault;
+  };
+
+  function supportsTouchEvents() {
+    if ('_cached' in supportsTouchEvents) {
+      return supportsTouchEvents._cached;
+    }
+    if (!window.document.createTouch || !window.document.createTouchList) {
+      supportsTouchEvents._cached = false;
+      return false;
+    }
+    try {
+      window.document.createEvent('TouchEvent');
+    } catch (e) {
+      supportsTouchEvents._cached = false;
+      return false;
+    }
+    supportsTouchEvents._cached = true;
+    return true;
+  }
+
+  function createTouchEvent(element, eventType, x, y) {
+    var evnt = new window.Event(eventType);
+    x = x || 0;
+    y = y || 0;
+
+    var touch = window.document.createTouch(window, element, Date.now(), x, y, x, y);
+    var touches = window.document.createTouchList(touch);
+
+    evnt.touches = touches;
+
+    return evnt;
+  }
+}());
+
 /**
  * Represents the application currently being tested and abstracts usage
  * of iframes or separate windows.
@@ -43977,7 +40559,7 @@ angular.scenario.Application.prototype.getFrame_ = function() {
 angular.scenario.Application.prototype.getWindow_ = function() {
   var contentWindow = this.getFrame_().prop('contentWindow');
   if (!contentWindow) {
-    throw new Error('Frame window is not accessible.');
+    throw 'Frame window is not accessible.';
   }
   return contentWindow;
 };
@@ -44039,7 +40621,7 @@ angular.scenario.Application.prototype.navigateTo = function(url, loadFn, errorF
     }).attr('src', url);
 
     // for IE compatibility set the name *after* setting the frame url
-    frame[0].contentWindow.name = 'NG_DEFER_BOOTSTRAP!';
+    frame[0].contentWindow.name = "NG_DEFER_BOOTSTRAP!";
   }
   self.context.find('> h2 a').attr('href', url).text(url);
 };
@@ -44055,13 +40637,13 @@ angular.scenario.Application.prototype.executeAction = function(action) {
   var self = this;
   var $window = this.getWindow_();
   if (!$window.document) {
-    throw new Error('Sandbox Error: Application document not accessible.');
+    throw 'Sandbox Error: Application document not accessible.';
   }
   if (!$window.angular) {
     return action.call(this, $window, _jQuery($window.document));
   }
 
-  if (this.rootElement) {
+  if (!!this.rootElement) {
     executeWithElement(this.rootElement);
   } else {
     angularInit($window.document, angular.bind(this, executeWithElement));
@@ -44106,7 +40688,7 @@ angular.scenario.Describe = function(descName, parent) {
   var beforeEachFns = this.beforeEachFns;
   this.setupBefore = function() {
     if (parent) parent.setupBefore.call(this);
-    angular.forEach(beforeEachFns, /** @this */ function(fn) { fn.call(this); }, this);
+    angular.forEach(beforeEachFns, function(fn) { fn.call(this); }, this);
   };
 
   /**
@@ -44114,7 +40696,7 @@ angular.scenario.Describe = function(descName, parent) {
    */
   var afterEachFns = this.afterEachFns;
   this.setupAfter  = function() {
-    angular.forEach(afterEachFns, /** @this */ function(fn) { fn.call(this); }, this);
+    angular.forEach(afterEachFns, function(fn) { fn.call(this); }, this);
     if (parent) parent.setupAfter.call(this);
   };
 };
@@ -44377,7 +40959,7 @@ angular.scenario.ObjectModel = function(runner) {
     var it = self.getSpec(spec.id);
     var step = it.getLastStep();
     if (step.name !== step.name) {
-      throw new Error('Events fired in the wrong order. Step names don\'t match.');
+      throw 'Events fired in the wrong order. Step names don\'t match.';
     }
     complete(step);
 
@@ -44521,7 +41103,7 @@ angular.scenario.ObjectModel.Spec.prototype.getLastStep = function() {
  * @param {angular.scenario.ObjectModel.Step} step
  */
 angular.scenario.ObjectModel.Spec.prototype.setStatusFromStep = function(step) {
-  if (!this.status || step.status === 'error') {
+  if (!this.status || step.status == 'error') {
     this.status = step.status;
     this.error = step.error;
     this.line = step.line;
@@ -44572,7 +41154,7 @@ angular.scenario.Runner = function($window) {
     beforeEach: this.beforeEach,
     afterEach: this.afterEach
   };
-  angular.forEach(this.api, angular.bind(this, /** @this */ function(fn, key) {
+  angular.forEach(this.api, angular.bind(this, function(fn, key) {
     this.$window[key] = angular.bind(this, fn);
   }));
 };
@@ -44617,7 +41199,7 @@ angular.scenario.Runner.prototype.on = function(eventName, listener) {
  */
 angular.scenario.Runner.prototype.describe = function(name, body) {
   var self = this;
-  this.currentDescribe.describe(name, /** @this */ function() {
+  this.currentDescribe.describe(name, function() {
     var parentDescribe = self.currentDescribe;
     self.currentDescribe = this;
     try {
@@ -44638,7 +41220,7 @@ angular.scenario.Runner.prototype.describe = function(name, body) {
  */
 angular.scenario.Runner.prototype.ddescribe = function(name, body) {
   var self = this;
-  this.currentDescribe.ddescribe(name, /** @this */ function() {
+  this.currentDescribe.ddescribe(name, function() {
     var parentDescribe = self.currentDescribe;
     self.currentDescribe = this;
     try {
@@ -44766,7 +41348,7 @@ angular.scenario.Runner.prototype.run = function(application) {
         return scope.dsl[key].apply(scope, arguments);
       };
     });
-    runner.run(spec, /** @this */ function() {
+    runner.run(spec, function() {
       runner.$destroy();
       specDone.apply(this, arguments);
     });
@@ -44885,8 +41467,8 @@ angular.scenario.SpecRunner.prototype.addFuture = function(name, behavior, line)
  */
 angular.scenario.SpecRunner.prototype.addFutureAction = function(name, behavior, line) {
   var self = this;
-  var NG = /\[ng\\:/;
-  return this.addFuture(name, /** @this */ function(done) {
+  var NG = /\[ng\\\:/;
+  return this.addFuture(name, function(done) {
     this.application.executeAction(function($window, $document) {
 
       //TODO(esprehn): Refactor this so it doesn't need to be in here.
@@ -44904,7 +41486,6 @@ angular.scenario.SpecRunner.prototype.addFutureAction = function(name, behavior,
           });
         }
         if (!result.length) {
-          // eslint-disable-next-line no-throw-literal
           throw {
             type: 'selector',
             message: 'Selector ' + selector + ' did not match any elements.'
@@ -44927,8 +41508,6 @@ angular.scenario.SpecRunner.prototype.addFutureAction = function(name, behavior,
   }, line);
 };
 
-/* eslint-disable no-invalid-this */
-
 /**
  * Shared DSL statements that are useful to all scenarios.
  */
@@ -44977,7 +41556,7 @@ angular.scenario.dsl('browser', function() {
 
   chain.navigateTo = function(url, delegate) {
     var application = this.application;
-    return this.addFuture('browser navigate to \'' + url + '\'', function(done) {
+    return this.addFuture("browser navigate to '" + url + "'", function(done) {
       if (delegate) {
         url = delegate.call(this, url);
       }
@@ -45108,11 +41687,11 @@ angular.scenario.dsl('using', function() {
  */
 angular.scenario.dsl('binding', function() {
   return function(name) {
-    return this.addFutureAction('select binding \'' + name + '\'',
+    return this.addFutureAction("select binding '" + name + "'",
       function($window, $document, done) {
         var values = $document.elements().bindings($window.angular.element, name);
         if (!values.length) {
-          return done('Binding selector \'' + name + '\' did not match.');
+          return done("Binding selector '" + name + "' did not match.");
         }
         done(null, values[0]);
     });
@@ -45128,17 +41707,10 @@ angular.scenario.dsl('binding', function() {
  */
 angular.scenario.dsl('input', function() {
   var chain = {};
-
-  // Support: IE 9-11 only
-  // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
-  // it. In particular the event is not fired when backspace or delete key are pressed or
-  // when cut operation is performed.
-  // IE10+ implements 'input' event but it erroneously fires under various situations,
-  // e.g. when placeholder changes, or a form is focused.
   var supportInputEvent = 'oninput' in window.document.createElement('div') && !msie;
 
   chain.enter = function(value, event) {
-    return this.addFutureAction('input \'' + this.name + '\' enter \'' + value + '\'',
+    return this.addFutureAction("input '" + this.name + "' enter '" + value + "'",
       function($window, $document, done) {
         var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input');
         input.val(value);
@@ -45148,7 +41720,7 @@ angular.scenario.dsl('input', function() {
   };
 
   chain.check = function() {
-    return this.addFutureAction('checkbox \'' + this.name + '\' toggle',
+    return this.addFutureAction("checkbox '" + this.name + "' toggle",
       function($window, $document, done) {
         var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':checkbox');
         input.trigger('click');
@@ -45157,7 +41729,7 @@ angular.scenario.dsl('input', function() {
   };
 
   chain.select = function(value) {
-    return this.addFutureAction('radio button \'' + this.name + '\' toggle \'' + value + '\'',
+    return this.addFutureAction("radio button '" + this.name + "' toggle '" + value + "'",
       function($window, $document, done) {
         var input = $document.
           elements('[ng\\:model="$1"][value="$2"]', this.name, value).filter(':radio');
@@ -45167,7 +41739,7 @@ angular.scenario.dsl('input', function() {
   };
 
   chain.val = function() {
-    return this.addFutureAction('return input val', function($window, $document, done) {
+    return this.addFutureAction("return input val", function($window, $document, done) {
       var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input');
       done(null,input.val());
     });
@@ -45191,7 +41763,7 @@ angular.scenario.dsl('repeater', function() {
   var chain = {};
 
   chain.count = function() {
-    return this.addFutureAction('repeater \'' + this.label + '\' count',
+    return this.addFutureAction("repeater '" + this.label + "' count",
       function($window, $document, done) {
         try {
           done(null, $document.elements().length);
@@ -45202,14 +41774,14 @@ angular.scenario.dsl('repeater', function() {
   };
 
   chain.column = function(binding) {
-    return this.addFutureAction('repeater \'' + this.label + '\' column \'' + binding + '\'',
+    return this.addFutureAction("repeater '" + this.label + "' column '" + binding + "'",
       function($window, $document, done) {
         done(null, $document.elements().bindings($window.angular.element, binding));
     });
   };
 
   chain.row = function(index) {
-    return this.addFutureAction('repeater \'' + this.label + '\' row \'' + index + '\'',
+    return this.addFutureAction("repeater '" + this.label + "' row '" + index + "'",
       function($window, $document, done) {
         var matches = $document.elements().slice(index, index + 1);
         if (!matches.length) {
@@ -45234,7 +41806,7 @@ angular.scenario.dsl('select', function() {
   var chain = {};
 
   chain.option = function(value) {
-    return this.addFutureAction('select \'' + this.name + '\' option \'' + value + '\'',
+    return this.addFutureAction("select '" + this.name + "' option '" + value + "'",
       function($window, $document, done) {
         var select = $document.elements('select[ng\\:model="$1"]', this.name);
         var option = select.find('option[value="' + value + '"]');
@@ -45250,7 +41822,7 @@ angular.scenario.dsl('select', function() {
           if (option.length) {
             select.val(option.val());
           } else {
-              return done('option \'' + value + '\' not found');
+              return done("option '" + value + "' not found");
           }
         }
         select.trigger('change');
@@ -45260,7 +41832,7 @@ angular.scenario.dsl('select', function() {
 
   chain.options = function() {
     var values = arguments;
-    return this.addFutureAction('select \'' + this.name + '\' options \'' + values + '\'',
+    return this.addFutureAction("select '" + this.name + "' options '" + values + "'",
       function($window, $document, done) {
         var select = $document.elements('select[multiple][ng\\:model="$1"]', this.name);
         select.val(values);
@@ -45297,7 +41869,7 @@ angular.scenario.dsl('element', function() {
   var chain = {};
 
   chain.count = function() {
-    return this.addFutureAction('element \'' + this.label + '\' count',
+    return this.addFutureAction("element '" + this.label + "' count",
       function($window, $document, done) {
         try {
           done(null, $document.elements().length);
@@ -45308,7 +41880,7 @@ angular.scenario.dsl('element', function() {
   };
 
   chain.click = function() {
-    return this.addFutureAction('element \'' + this.label + '\' click',
+    return this.addFutureAction("element '" + this.label + "' click",
       function($window, $document, done) {
         var elements = $document.elements();
         var href = elements.attr('href');
@@ -45325,7 +41897,7 @@ angular.scenario.dsl('element', function() {
   };
 
   chain.dblclick = function() {
-    return this.addFutureAction('element \'' + this.label + '\' dblclick',
+    return this.addFutureAction("element '" + this.label + "' dblclick",
       function($window, $document, done) {
         var elements = $document.elements();
         var href = elements.attr('href');
@@ -45342,7 +41914,7 @@ angular.scenario.dsl('element', function() {
   };
 
   chain.mouseover = function() {
-    return this.addFutureAction('element \'' + this.label + '\' mouseover',
+    return this.addFutureAction("element '" + this.label + "' mouseover",
       function($window, $document, done) {
         var elements = $document.elements();
         elements.trigger('mouseover');
@@ -45351,7 +41923,7 @@ angular.scenario.dsl('element', function() {
   };
 
   chain.mousedown = function() {
-      return this.addFutureAction('element \'' + this.label + '\' mousedown',
+      return this.addFutureAction("element '" + this.label + "' mousedown",
         function($window, $document, done) {
           var elements = $document.elements();
           elements.trigger('mousedown');
@@ -45360,7 +41932,7 @@ angular.scenario.dsl('element', function() {
     };
 
   chain.mouseup = function() {
-      return this.addFutureAction('element \'' + this.label + '\' mouseup',
+      return this.addFutureAction("element '" + this.label + "' mouseup",
         function($window, $document, done) {
           var elements = $document.elements();
           elements.trigger('mouseup');
@@ -45378,10 +41950,10 @@ angular.scenario.dsl('element', function() {
   angular.forEach(KEY_VALUE_METHODS, function(methodName) {
     chain[methodName] = function(name, value) {
       var args = arguments,
-          futureName = (args.length === 1)
-              ? 'element \'' + this.label + '\' get ' + methodName + ' \'' + name + '\''
-              : 'element \'' + this.label + '\' set ' + methodName + ' \'' + name + '\' to \'' +
-                value + '\'';
+          futureName = (args.length == 1)
+              ? "element '" + this.label + "' get " + methodName + " '" + name + "'"
+              : "element '" + this.label + "' set " + methodName + " '" + name + "' to " + "'" +
+                value + "'";
 
       return this.addFutureAction(futureName, function($window, $document, done) {
         var element = $document.elements();
@@ -45394,8 +41966,8 @@ angular.scenario.dsl('element', function() {
     chain[methodName] = function(value) {
       var args = arguments,
           futureName = (args.length === 0)
-              ? 'element \'' + this.label + '\' ' + methodName
-              : 'element \'' + this.label + '\' set ' + methodName + ' to \'' + value + '\'';
+              ? "element '" + this.label + "' " + methodName
+              : "element '" + this.label + "' set " + methodName + " to '" + value + "'";
 
       return this.addFutureAction(futureName, function($window, $document, done) {
         var element = $document.elements();
@@ -45414,43 +41986,43 @@ angular.scenario.dsl('element', function() {
  * Matchers for implementing specs. Follows the Jasmine spec conventions.
  */
 
-angular.scenario.matcher('toEqual', /** @this */ function(expected) {
+angular.scenario.matcher('toEqual', function(expected) {
   return angular.equals(this.actual, expected);
 });
 
-angular.scenario.matcher('toBe', /** @this */ function(expected) {
+angular.scenario.matcher('toBe', function(expected) {
   return this.actual === expected;
 });
 
-angular.scenario.matcher('toBeDefined', /** @this */ function() {
+angular.scenario.matcher('toBeDefined', function() {
   return angular.isDefined(this.actual);
 });
 
-angular.scenario.matcher('toBeTruthy', /** @this */ function() {
+angular.scenario.matcher('toBeTruthy', function() {
   return this.actual;
 });
 
-angular.scenario.matcher('toBeFalsy', /** @this */ function() {
+angular.scenario.matcher('toBeFalsy', function() {
   return !this.actual;
 });
 
-angular.scenario.matcher('toMatch', /** @this */ function(expected) {
+angular.scenario.matcher('toMatch', function(expected) {
   return new RegExp(expected).test(this.actual);
 });
 
-angular.scenario.matcher('toBeNull', /** @this */ function() {
+angular.scenario.matcher('toBeNull', function() {
   return this.actual === null;
 });
 
-angular.scenario.matcher('toContain', /** @this */ function(expected) {
+angular.scenario.matcher('toContain', function(expected) {
   return includes(this.actual, expected);
 });
 
-angular.scenario.matcher('toBeLessThan', /** @this */ function(expected) {
+angular.scenario.matcher('toBeLessThan', function(expected) {
   return this.actual < expected;
 });
 
-angular.scenario.matcher('toBeGreaterThan', /** @this */ function(expected) {
+angular.scenario.matcher('toBeGreaterThan', function(expected) {
   return this.actual > expected;
 });
 
@@ -45530,7 +42102,7 @@ angular.scenario.output('html', function(context, runner, model) {
     spec = model.getSpec(spec.id);
     ui.removeClass('status-pending');
     ui.addClass('status-' + spec.status);
-    ui.find('> .test-info .timer-result').text(spec.duration + 'ms');
+    ui.find("> .test-info .timer-result").text(spec.duration + "ms");
     if (spec.status === 'success') {
       ui.find('> .test-info .test-name').addClass('closed');
       ui.find('> .scrollpane .test-actions').hide();
@@ -45637,10 +42209,7 @@ angular.scenario.output('json', function(context, runner, model) {
  * Generates XML output into a context.
  */
 angular.scenario.output('xml', function(context, runner, model) {
-  var $ = function(args) {
-    // eslint-disable-next-line new-cap
-    return new context.init(args);
-  };
+  var $ = function(args) {return new context.init(args);};
   model.on('RunnerEnd', function() {
     var scenario = $('<scenario></scenario>');
     context.append(scenario);
@@ -45709,7 +42278,7 @@ angular.forEach(script.attributes, function(attr) {
 });
 
 if (config.autotest) {
-  JQLite(function() {
+  JQLite(window.document).ready(function() {
     angular.scenario.setUpAndRun(config);
   });
 }