@@ -403,6 +403,18 @@ function isArray(value) {
403403function isFunction ( value ) { return typeof value == 'function' ; }
404404
405405
406+ /**
407+ * Determines if a value is a regular expression object.
408+ *
409+ * @private
410+ * @param {* } value Reference to check.
411+ * @returns {boolean } True if `value` is a `RegExp`.
412+ */
413+ function isRegExp ( value ) {
414+ return toString . apply ( value ) == '[object RegExp]' ;
415+ }
416+
417+
406418/**
407419 * Checks if `obj` is a window object.
408420 *
@@ -622,14 +634,17 @@ function shallowCopy(src, dst) {
622634 * @function
623635 *
624636 * @description
625- * Determines if two objects or two values are equivalent. Supports value types, arrays and
637+ * Determines if two objects or two values are equivalent. Supports value types, regular expressions, arrays and
626638 * objects.
627639 *
628640 * Two objects or values are considered equivalent if at least one of the following is true:
629641 *
630642 * * Both objects or values pass `===` comparison.
631643 * * Both objects or values are of the same type and all of their properties pass `===` comparison.
632644 * * Both values are NaN. (In JavasScript, NaN == NaN => false. But we consider two NaN as equal)
645+ * * Both values represent the same regular expression (In JavasScript,
646+ * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual
647+ * representation matches).
633648 *
634649 * During a property comparision, properties of `function` type and properties with names
635650 * that begin with `$` are ignored.
@@ -656,6 +671,8 @@ function equals(o1, o2) {
656671 }
657672 } else if ( isDate ( o1 ) ) {
658673 return isDate ( o2 ) && o1 . getTime ( ) == o2 . getTime ( ) ;
674+ } else if ( isRegExp ( o1 ) && isRegExp ( o2 ) ) {
675+ return o1 . toString ( ) == o2 . toString ( ) ;
659676 } else {
660677 if ( isScope ( o1 ) || isScope ( o2 ) || isWindow ( o1 ) || isWindow ( o2 ) ) return false ;
661678 keySet = { } ;
@@ -912,9 +929,9 @@ function encodeUriQuery(val, pctEncodeSpaces) {
912929 * one ngApp directive can be used per HTML document. The directive
913930 * designates the root of the application and is typically placed
914931 * at the root of the page.
915- *
916- * The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in an
917- * HTML document you must manually bootstrap them using {@link angular.bootstrap}.
932+ *
933+ * The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in an
934+ * HTML document you must manually bootstrap them using {@link angular.bootstrap}.
918935 * Applications cannot be nested.
919936 *
920937 * In the example below if the `ngApp` directive would not be placed
0 commit comments