From f80730f497cb1ecb78a814f01df79b69223ad633 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 0252a720..1a90f8bc 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -611,6 +611,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