mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-17 22:34:43 +08:00
fix(angular.copy): clone regexp flags correctly
Closes #5781 Closes #8337
This commit is contained in:
committed by
Peter Bacon Darwin
parent
c03b9e5ec4
commit
86340a59bf
@@ -775,7 +775,8 @@ function copy(source, destination, stackSource, stackDest) {
|
||||
} else if (isDate(source)) {
|
||||
destination = new Date(source.getTime());
|
||||
} else if (isRegExp(source)) {
|
||||
destination = new RegExp(source.source);
|
||||
destination = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
|
||||
destination.lastIndex = source.lastIndex;
|
||||
} else if (isObject(source)) {
|
||||
var emptyObject = Object.create(Object.getPrototypeOf(source));
|
||||
destination = copy(source, emptyObject, stackSource, stackDest);
|
||||
|
||||
Reference in New Issue
Block a user