Hi CPK, I would love to get this code as a test case for the SVG Web
project to test real world usage. Can I grab it from you? I would have
to adapt it a bit for the SVG Web toolkit versus the Adobe Viewer.
On Thu, Jul 2, 2009 at 3:07 PM, CPK Smithies<c.1@...> wrote:
>
>
> Greetings, Francis. This is the sort of thing that I'd be using, e.g.
> for a button icon:
>
> <object type="image/svg+xml" width="20" height="20"
> data="res/images/foo.svg">
> <img alt="Foo" src="res/images/foo.png" width="20" height="20"/>
> </object>
>
> Now this would give an image on a white background, a bit like webkit
> for MacOS/Linux, so to correct this for IE I'd include the following
> script to convert the objects to embeds:
>
> ((begin javascript))
>
> // IE-specific script to improve IE's SVG handling
> if (window.attachEvent) window.attachEvent('onload', function() {
> var obs = document.getElementsByTagName('object');
> for (var i = 0; i < obs.length; ) {
> var ob = obs[i];
> if (ob.getAttribute('type') != 'image/svg+xml') {
> ++i;
> continue;
> }
> var em = document.createElement('embed');
> var copyatt = [
> 'id', 'width', 'height', 'marginLeft', 'marginRight', 'marginTop',
> 'marginBottom', 'float', 'clear'
> ];
> em.setAttribute('src', ob.getAttribute('data'));
> em.setAttribute('wmode', 'transparent'); // important for IE
> em.setAttribute('type', 'image/svg+xml');
> var j;
> for (j = 0; j < copyatt.length; ++j) {
> var att;
> if (typeof ob.attributes[att = copyatt[j]] != 'undefined' &&
> ob.getAttribu
> em.setAttribute(att, ob.getAttribute(att));
> else if (ob.style[att] != "")
> em.style[att] = ob.style[att];
> }
> while (j = ob.firstChild) em.appendChild(ob.removeChild(j));
> ob.parentNode.replaceChild(em, ob);
> }
> });
>
> ((end javascript))
>
> This would be in a page conforming to XHTML 1.1.
>
> As I say, the problem would typically manifest itself by some of the SVG
> images simply not loading (even if the self-same image were already
> displayed elsewhere on the page). Typically the code to generate the
> HTML would be generated by the exact same script in every case, so no
> individual variations. And the loading/non-loading would be random -
> sometimes all there, sometimes two or three missing, hardly ever the
> same twice. And this with exactly the same being served to the client.
>
> The SVGs would be small and basic, none including raster components,
> just a few paths, but some containing script.
>
> Kindest regards,
>
> Christopher Smithies
>
> -----Original Message-----
> From: svg-developers@yahoogroups.com
> [mailto:svg-developers@yahoogroups.com]On Behalf Of Francis Hemsher
> Sent: 02 July 2009 20:00
> To: svg-developers@yahoogroups.com
> Subject: [svg-developers] Re: Inline SVG and CSS in IE
>
> --- In svg-developers@yahoogroups.com, "CPK Smithies" <c.1@...> wrote:
>>
>> I have not attempted inline SVG with IE. However, I wanted to raise a
>> related issue about multiple SVG objects in IE.
>>
>> My experience of including multiple SVG objects in an HTML page under
>> IE7 is that the browser goes unstable if there are more than, say, 10
>> such objects in the page...
>>
>
> Hi Christopher,
> I haven't had this problem. I haven't forced a test yet. but I've had
> 20-30 svg embeds in the past. Could you post a typical html segment that
> represents each call. I'm guessing you have a call to a raster file
> somewhere in it. Anyway, let's take a further look at it.
>
> Francis
>
>