我突然在javascript文件中突然出现语法错误 Eclipse Mars IDE 错误: 令牌上的语法错误" in",标识符预期
代码:
function getData (node) {
var attrs = node.attributes || []
, data = {};
if (!attrs.length) return data;
$.each(attrs, function (i, attr) {
if (/^data-in-*/.test(attr.nodeName)) {
data.in = data.in || {};
data.in[attr.nodeName.replace(/data-in-/, '')] = attr.nodeValue;
} else if (/^data-out-*/.test(attr.nodeName)) {
data.out = data.out || {};
data.out[attr.nodeName.replace(/data-out-/, '')] = attr.nodeValue;
} else if (/^data-*/.test(attr.nodeName)) {
data[attr.nodeName] = attr.nodeValue;
}
})
return data;
}
答案 0 :(得分:0)