开发者

jQuery under SVG

Is there any way I can run jQuery under SVG instead of HTML?

I know about jQuery svg plugin but this is not what I want.

As for now the jQuery engine contains some statements like this:

div = document.creat开发者_运维技巧eElement("div");
div.style.display = "none"; 

It fails with exception during jQuery initialization under SVG because SVG document is unable to create div element. And there are some other HTML-specific places in jQuery which fail in unpredictable places under SVG.

Is there any way to resolve this problem?


I hacked an old version of jquery around a bit, and it is possible to run it in svg-only mode with some modifications. Feel free to take the changes and do whatever you want with them. Here's a demo and here's the modified jquery sourcecode.

It's incomplete and probably has some issues if you want to use it in both HTML and SVG, but it's a start, and works to some extent at least.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜