Opera SVG Support
After hearing about the Opera 9 release, I decided it was time I revisited the SVG content on this site to make sure it’s working with the latest browser-based SVG implementations. I started this round of updates with Opera as my target UA and I have been pleasantly surprised. Many of the samples worked and most of the ones that didn’t only needed a bit of tweaking.
Many of the problems were old remnants from the ASV 2.0 days that somehow survived all my past updates: using getFirstChild() instead of firstChild, setting the MIME type to image/xml-svg, etc. However, the biggest blocks of trouble were with my use of parseXML, printNode and getURL. Special thanks to Doug Schepers for sharing a snippet of code to bring parseXML and printNode to Opera and Firefox; that saved me a fair bit of rewriting. I replace getURL with much more in vogue XMLHttpRequest. Special thanks to Jim Ley for his page dicussing various uses of that object.
Not everything is working in Opera and I even managed to crash the browser in one case. Some samples like the games and textbox require keyboard input. Key events are not yet in a W3C specification, so I’m not sure how those samples can be updated. In other cases, I used ASV’s sound extensions so I’ll have to see if there are any good replacements there. However, all in all, Opera is looking very promising. Next week, I’ll take a look at Firefox.
July 31st, 2006 at 11:31 am
[…] Kevin Lindsey gives an overall thumbs-up for Opera 9 support of SVG, updating his site’s experiments so that they work in Opera 9. […]
August 15th, 2006 at 3:36 am
Opera does not seem to support changing the “xlink:href” attribute of elements dynamically via ECMAScript. Well, it ‘works’, but the SVG image is not updated. This works in Firefox and ASV.
August 25th, 2006 at 3:14 pm
Nicklas: what version+buildnumber of Opera are you using? Please provide a testcase/bugreport at http://bugs.opera.com/wizard.
August 28th, 2006 at 10:10 pm
Seems I was mistaken regarding Opera. It just requires you to
use setAttributeNS(’http://www.w3.org/1999/xlink’, ‘href’, str)
instead of setAttribute(”xlink:href”, str).
September 5th, 2006 at 9:13 am
Hi Niklas,
Oh yes. Code snippets help a lot. Even though it is a bit more verbose, I decided years ago to always use all the *NS methods in place of the non-namespace equivalents. It’s a bit more verbose, but it is definitely safer, imho.
November 2nd, 2006 at 1:36 am
Could you share the parseXML for firefox? I met the problem of transplant SVG code from ASV to FIREFOX, and I did not found the code in SVG Whiz.
Thank you.
November 2nd, 2006 at 3:20 pm
You can download my snippet here: http://www.kevlindev.com/common/PrintAndParse.js
November 2nd, 2006 at 8:11 pm
Thanks a lot.