Raphael JS - paper.remove
刚刚开始接触拉斐尔。
现在我发现 paper.remove()
正在生成脚本错误:
"SCRIPT5009: 'removed' is undefined
这是脚本错误吗?
我的变量 paper
被初始化为:
var paper = new Raphael(document.getElementById('canvas_container'), 500, 500);
我的 HTML 正文有:
<div id="canvas_container"></div>
这是更多信息 -- 我正在使用刚刚再次下载的 Raphael 2.0。运行IE9。以下是突出显示为问题的 Raphael JS 函数:
R.prototype.remove = function () {
eve("remove", this);
this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
for (var i in this) {
this[i] = removed(i);
}
};
行 ...removed(i) 突出显示 --> SCRIPT5009:“已删除”未定义
顺便说一句,我是这个论坛的新手。除了“回答您的问题”之外,还有其他方法可以回复帖子吗?
Just getting started with Raphael.
Now I'm finding that paper.remove()
is generating a script error:
"SCRIPT5009: 'removed' is undefined
Is this a script bug?
My variable paper
is initialized thus:
var paper = new Raphael(document.getElementById('canvas_container'), 500, 500);
My HTML body has:
<div id="canvas_container"></div>
This is more info --
I am using Raphael 2.0 which I just downloaded again. Running IE9. Following is the Raphael JS function that is highlighted as the problem:
R.prototype.remove = function () {
eve("remove", this);
this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
for (var i in this) {
this[i] = removed(i);
}
};
the line ... removed(i) is highlighted --> SCRIPT5009: 'removed' is undefined
BTW I am new to this forum. Is there a way to respond to a thread other than "Answer Your Question"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经遇到过几次这个问题了。 sudoko-san 建议的第 4443 行方法确实可以在浏览器中工作,但不能向后兼容 IE-7 和 IE-7。 8(使用拉斐尔的全部意义)。
另一种解决方法是在您的 javascript 中实现以下代码:
就是这样!
I've run across this a couple of times. The line 4443 method as suggested by sudoko-san does work in browsers but not backwards compatible with IE-7 & 8 (the whole point of using raphael).
Another work around is to implement the following code in your javascript:
That's it!
我不知道您是否提供了足够的信息来回答这个问题。
如果您所做的只是删除纸张,请参阅下面的小提琴。
JSFiddle
它似乎对我来说对 Raphael 1.5.2 工作得很好
希望有帮助(即使是轻微的)。
I don't know if you've supplied enough information to answer this question.
If all you're doing is deleting the paper, see the fiddle below.
JSFiddle
It seems to work fine for me with Raphael 1.5.2
Hope that helps (even slightly).