开发者

raphael text() not working in ie9

开发者 https://www.devze.com 2023-03-09 02:06 出处:网络
Why is the following example not work开发者_StackOverflow中文版ing in ie9? http://jsfiddle.net/dzyyd/2/

Why is the following example not work开发者_StackOverflow中文版ing in ie9?

http://jsfiddle.net/dzyyd/2/

It spits out a console error:

"Unexpected call to method or property access."


I found it pretty quickly. You created the element, but did not put it anywhere. Once it is added to the document body, everything seems to be fine.

this._width=300;
this._height=300;
this._bgSvgContainer = document.createElement("div");
//NOTE: add the created div to the body of the document so that it is displayed
document.body.appendChild(this._bgSvgContainer);
var bgCanvas = Raphael(this._bgSvgContainer, this._width, this._height);
this._bgCanvas = bgCanvas;
var num = this._bgCanvas.text(this._width-10,this._height-10,"1");


It's really hard to tell with such a tiny code-fragment (doesn't run on any browser for me), but it's probably a scope issue this in IE during events is completely different to this using the W3C event model. See: quirksmode-Event order-Problems of the Microsoft model

0

精彩评论

暂无评论...
验证码 换一张
取 消