mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-19 16:10:22 +00:00
fixed special keywords in chrome such as x.throw must be x["throw"].
This commit is contained in:
parent
fdc0bb232a
commit
105e9443c4
2 changed files with 3 additions and 2 deletions
|
|
@ -8,7 +8,7 @@
|
|||
PerfCntl.prototype = {
|
||||
createItems: function(){
|
||||
var items = [];
|
||||
for ( var i = 0; i < 1000; i++) {
|
||||
for ( var i = 0; i < 100; i++) {
|
||||
var item = {
|
||||
name: "" + Math.random(),
|
||||
parts: [Math.random(), Math.random()]
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ function setter(instance, path, value){
|
|||
///////////////////////////////////
|
||||
|
||||
var getterFnCache = {};
|
||||
var JS_KEYWORDS = ["this", "throw", "for", "foreach", "var", "const"];
|
||||
function getterFn(path){
|
||||
var fn = getterFnCache[path];
|
||||
if (fn) return fn;
|
||||
|
|
@ -53,7 +54,7 @@ function getterFn(path){
|
|||
var code = 'function (self){\n';
|
||||
code += ' var last, fn, type;\n';
|
||||
foreach(path.split('.'), function(key) {
|
||||
key = (key == 'this') ? '["this"]' : '.' + key;
|
||||
key = (includes(JS_KEYWORDS, key)) ? '["' + key + '"]' : '.' + key;
|
||||
code += ' if(!self) return self;\n';
|
||||
code += ' last = self;\n';
|
||||
code += ' self = self' + key + ';\n';
|
||||
|
|
|
|||
Loading…
Reference in a new issue