From 5cca077e4a40a26cc2deee2a86a215f575f25b22 Mon Sep 17 00:00:00 2001 From: Andy Hitchman Date: Tue, 6 Aug 2013 11:25:44 +1000 Subject: fix(angular.copy): change angular.copy to correcly clone RegExp angular.copy previously copied RegExp as an empty object. Change detects RegExp instance and clones into new RegExp. This change is based on a previous fix to allow Date to be copied. Closes #3473 Closes #3474 --- src/Angular.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Angular.js') diff --git a/src/Angular.js b/src/Angular.js index 0a38b230..8fd77096 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -587,6 +587,8 @@ function copy(source, destination){ destination = copy(source, []); } else if (isDate(source)) { destination = new Date(source.getTime()); + } else if (isRegExp(source)) { + destination = new RegExp(source.source); } else if (isObject(source)) { destination = copy(source, {}); } -- cgit v1.2.3