(exp, text, errors)
| 15377 | |
| 15378 | //检查事件,去除掉模板字符串,匹配是否含有delete (任何字符) 或 typeof (任何字符) 或 void (任何字符) 关键词,检查字符串开头是否含有$ |
| 15379 | function checkEvent(exp, text, errors) { |
| 15380 | var stipped = exp.replace(stripStringRE, ''); //去除掉模板字符串 |
| 15381 | var keywordMatch = stipped.match(unaryOperatorsRE); //匹配是否含有delete (任何字符) 或 typeof (任何字符) 或 void (任何字符) 关键词 |
| 15382 | //判断匹配到的 字符串 开头是否是$ 开头的 |
| 15383 | if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') { |
| 15384 | errors.push( |
| 15385 | "avoid using JavaScript unary operator as property name: " + |
| 15386 | "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()) |
| 15387 | ); |
| 15388 | } |
| 15389 | //字符串转成真正js的时候是否会报错 可以替代eval() |
| 15390 | checkExpression(exp, text, errors); |
| 15391 | } |
| 15392 | |
| 15393 | //检查 for |
| 15394 | function checkFor(node, //节点 |
no test coverage detected