admin管理员组文章数量:1410737
I would like to be able to use vml objects on a page rendering in standards mode rather than quirks mode. I've found fragments of answers scattered around but can't figure it out. Raphael pulls it off somehow but I can't reverse it to figure out what's happening. Any basic working example would be great.
I would like to be able to use vml objects on a page rendering in standards mode rather than quirks mode. I've found fragments of answers scattered around but can't figure it out. Raphael pulls it off somehow but I can't reverse it to figure out what's happening. Any basic working example would be great.
Share asked Oct 7, 2010 at 19:53 lincolnklincolnk 11.2k4 gold badges42 silver badges63 bronze badges2 Answers
Reset to default 7I think I have it figured out. Step 1 is importing the vml namespace though javascript.
document.namespaces.add('v', 'urn:schemas-microsoft-:vml', "#default#VML");
This got some random vml samples to work in quirks mode but not standards. They key is that elements require a unit for measurements where quirks mode will assume px if a unit is not provided. Also shapes have to be styled with position:absolute;
although lines apparently do not need this part.
Here's a sample with 2 ovals. Both ovals will render in quirks mode but the blue oval will not show in standards mode.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3/1999/xhtml">
<head></head>
<body>
<script>
document.namespaces.add('v', 'urn:schemas-microsoft-:vml', "#default#VML");
</script>
<v:oval style="width: 100; height: 50" fillcolor="blue"></v:oval>
<v:oval style="position: absolute; width: 100px; height: 50px" fillcolor="green"></v:oval>
</body>
</html>
Why don't you simply use Raphael itself instead of using raw VML? The Raphael guys have done a great job producing a standard library which works almost everywhere - make use of their hard work.
本文标签: javascriptHow do I get VML working in standards modeStack Overflow
版权声明:本文标题:javascript - How do I get VML working in standards mode? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745013651a2637703.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论