mirror of https://github.com/vuejs/vue.git
				
				
				
			allow use of global Date & new keyword inside expressions (fix #784)
This commit is contained in:
		
							parent
							
								
									85799dfd35
								
							
						
					
					
						commit
						1a36e39b62
					
				|  | @ -4,7 +4,7 @@ var Cache = require('../cache') | |||
| var expressionCache = new Cache(1000) | ||||
| 
 | ||||
| var keywords = | ||||
|   'Math,break,case,catch,continue,debugger,default,' + | ||||
|   'Math,Date,break,case,catch,continue,debugger,default,' + | ||||
|   'delete,do,else,false,finally,for,function,if,in,' + | ||||
|   'instanceof,new,null,return,switch,this,throw,true,try,' + | ||||
|   'typeof,var,void,while,with,undefined,abstract,boolean,' + | ||||
|  | @ -16,7 +16,7 @@ var keywords = | |||
| 
 | ||||
| var wsRE = /\s/g | ||||
| var newlineRE = /\n/g | ||||
| var saveRE = /[\{,]\s*[\w\$_]+\s*:|('[^']*'|"[^"]*")/g | ||||
| var saveRE = /[\{,]\s*[\w\$_]+\s*:|('[^']*'|"[^"]*")|new /g | ||||
| var restoreRE = /"(\d+)"/g | ||||
| var pathTestRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\])*$/ | ||||
| var pathReplaceRE = /[^\w$\.]([A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\])*)/g | ||||
|  |  | |||
|  | @ -197,6 +197,13 @@ var testCases = [ | |||
|     }, | ||||
|     expected: true, | ||||
|     paths: [] | ||||
|   }, | ||||
|   { | ||||
|     // Date global
 | ||||
|     exp: 'Date.now() > new Date("2000-01-01")', | ||||
|     scope: {}, | ||||
|     expected: true, | ||||
|     paths: [] | ||||
|   } | ||||
| ] | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue