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.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- Keeping track of variable instances
I think I have it figured out. Step 1 is importing the vml namespace though javascript.
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.
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.