This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix($compile): get $$observe listeners array as own property
Prevent accidentally treating a builtin function from Object.prototype as the binding object, and thus preventing the compiler from throwing when using attribute binding names which match a property of the Object prototype. Closes #9343 Closes #9345
- Loading branch information
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -929,7 +929,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { | |
*/ | ||
$observe: function(key, fn) { | ||
var attrs = this, | ||
$$observers = (attrs.$$observers || (attrs.$$observers = {})), | ||
$$observers = (attrs.$$observers || (attrs.$$observers = Object.create(null))), | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
caitp
Author
Contributor
|
||
listeners = ($$observers[key] || ($$observers[key] = [])); | ||
|
||
listeners.push(fn); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
we have createMap() shortcut for this