语法错误:意外的标记(即使行为空
SyntaxError: Unexpected token ( even when line is empty
我有这个 HTML:
<template is="auto-binding" id="container-binding-template">
<core-scaffold id="scaffold" onscroll={{containerScrolled}}>
<div id="container">
自动绑定模板和<core-scaffold>
是聚合物的一部分。
这是JavaScript:
var template = document.querySelector('#container-binding-template');
template.containerScrolled = function() {
// regardless of the code here, the error will occur (event if it's empty)
};
当我运行此代码时,出现以下错误(在Chrome DevTools中):
未捕获的语法错误:意外令牌 ( VMxxxx:2
当我打开 VMxxxx 文件(例如 VM1362)时,我看到以下代码:
(function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {function () {
// This line contains the same code as in containerScrolled(). This is where the error is pointing to.
}
};}}}})
导致此错误的原因是什么?我该如何解决它?任何帮助将不胜感激。
更新#1:JSFiddle
事件属性应on-scroll
。您拥有的是本机内联事件处理程序,它们期望输入是函数的主体。
相关文章:
- 铬:“;未捕获的语法错误:意外的标记:"
- Javascript未捕获语法错误意外的标识符错误
- 未捕获的语法错误:意外的标记{
- "未捕获的语法错误:意外的标记}"
- eslint:“;分析错误:意外的“”标记;
- 未捕获的语法错误:意外的令牌,
- "未捕获的语法错误:意外的标记"角度JS
- "未捕获的语法错误:意外的标记<"当尝试使用谷歌'核心报告API
- NodeJS用Multer上传图片;错误:意外字段“”;
- 在一个函数中,我有一个未捕获的语法错误:意外的标记else
- data.php:1未捕获的语法错误:意外的令牌:
- 未捕获的语法错误:意外的令牌非法?看起来不错
- 未捕获的语法错误:意外的标记<在yii
- AngularJS $http GET 请求到本地 JSON 文件返回语法错误:意外令牌]
- 未捕获的语法错误:意外的令牌 = (Chrome)
- Sencha 2.0 和 Codeigniter RESTful API 生成未捕获的语法错误:意外令牌:
- “语法错误:意外的令牌)”在 javascript 调用中,当 eval(value) 为空时
- HTML 无法识别我要求它运行的 javascript 文件,语法错误:意外的令牌“<”(匿名函数)script.js:
- 未捕获的语法错误:意外的令牌 if
- 使用 JSON.parse 将字符串(变量)转换为对象,错误意外标记