我正在尝试在节点的属性之一中使用带引号的文本:
var network_json = {
dataSchema: {
nodes: [ { name: "label", type: "string" },
{ name: "foo", type: "string" }
]
},
data: {
nodes: [ { id: "1", label: "1", foo: "Text without quotes" },
{ id: "2", label: "2", foo: "Some \"quoted\" text" }
]
}
};
vis.draw({network: network_json});
然后为每个节点制作监听器:
vis.addListener("click", "nodes", function(event) {
alert(event.target);
})
但是在单击带有引用文本的节点时出现“意外令牌非法”错误。我应该如何筛选那里的报价?