From: Samuel Rigaud <46346622+s-rigaud@users.noreply.github.com> Date: Mon, 14 Nov 2022 06:50:35 +0000 (+0100) Subject: fix(compiler-core): typeof should be allowed in browser expression validation (#7037) X-Git-Tag: v3.2.46~71 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=378386694be6dd43da71f1fa08ee9c5705c13f86;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-core): typeof should be allowed in browser expression validation (#7037) --- diff --git a/packages/compiler-core/src/validateExpression.ts b/packages/compiler-core/src/validateExpression.ts index dc6ecef034..83998eee2c 100644 --- a/packages/compiler-core/src/validateExpression.ts +++ b/packages/compiler-core/src/validateExpression.ts @@ -1,16 +1,15 @@ -// these keywords should not appear inside expressions, but operators like - import { SimpleExpressionNode } from './ast' import { TransformContext } from './transform' import { createCompilerError, ErrorCodes } from './errors' -// typeof, instanceof and in are allowed +// these keywords should not appear inside expressions, but operators like +// 'typeof', 'instanceof', and 'in' are allowed const prohibitedKeywordRE = new RegExp( '\\b' + ( - 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' + - 'super,throw,while,yield,delete,export,import,return,switch,default,' + - 'extends,finally,continue,debugger,function,arguments,typeof,void' + 'arguments,await,break,case,catch,class,const,continue,debugger,default,' + + 'delete,do,else,export,extends,finally,for,function,if,import,let,new,' + + 'return,super,switch,throw,try,var,void,while,with,yield' ) .split(',') .join('\\b|\\b') +