admin管理员组文章数量:1432006
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"?
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"?
Share Improve this question edited May 14, 2014 at 12:31 Margo 6824 gold badges13 silver badges30 bronze badges asked Oct 10, 2011 at 1:33 sudoku-sansudoku-san 411 silver badge4 bronze badges 1- Apart from answering a question, you can only enter-in ments. – Prisoner ZERO Commented Jun 15, 2012 at 16:40
2 Answers
Reset to default 4I've run across this a couple of times. The line 4443 method as suggested by sudoko-san does work in browsers but not backwards patible with IE-7 & 8 (the whole point of using raphael).
Another work around is to implement the following code in your javascript:
try{
paper.remove();
}
catch (error) {
// this catches the error and allows you to proceed along nicely
}
That's it!
I don't know if you've supplied enough information to answer this question.
- What version of Raphael are you using?
- On what browser?
- Is it being loaded up correctly - can you create any Raphael objects?
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).
本文标签: javascriptRaphael JSpaperremoveStack Overflow
版权声明:本文标题:javascript - Raphael JS - paper.remove - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745580608a2664599.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论