XML data islands in IE (and others) for SVG??
- A recent discussion in the HTML WG about how to make SVG and MathML
and other XML languages coexist with where the WHATWG/HTMLWG would
like HTML5 to go, got me wondering:
there is that goofy <xml> tag in IE (so far as I know it is only in
IE) that allows "data islands" in which XML can be incorporated into
HTML. I wondered a) whether anybody has experimented with those as an
alternative way of getting SVG into HTML in IE, since it would allow,
in theory, a type of inline content?
b) whether this might provide a broader solution to some of the
gnarly cross browser issues involved in getting html with ist lax
grammar to allow SVG snippets (with their tighter grammar) to work
and play nicely together. (Apparently this is difficult for browser
makers to figure out.)
So I tried the following little experiment (conclusions and questions
<title>Including SVG data in an HTML document</title>
//the above works fine
//the below doesn't
alert(RC.nodeName) //this identifies the nodeName of the
clone as being <text>
DE.appendChild(RC) //this fails
<body><input type=button onclick="display()" value="display">
<rect width="100%" height="100%" fill="#888"/>
<text x="100" y="30" font-size="35px" font-family="Impact" fill="#706">
Hello from SVG data island</text>
<embed id="E" width="400" height="400" src="../svg/empty.svg" />
1. The data island is indeed retrievable and the above succeeds in
scribbling content from it back into the embedded SVG document.
2. Trying to clone the textnode from the data island and insert it
into the SVGdocument directly, just didn't work. Any reasons you can
think of? Any workarounds?
3. This doesn't work if the document empty.svg does not in fact
exist. Does anyone know a way in IE to make an HTML document contain
an SVGDocument that is entirely built from scratch -- namely without
starting with a real second file -- without resorting to the arcania
that is inline SVG in IE?
4. Is there anyway to replace the entire DOM tree of the SVG document
by the DOM tree discovered in the data island?
5. If there were ways to do this, would wrapping inline SVG inside an
<xml> for IE and then stripping the <xml> for the other browsers
provide any sort of solution to the inlining problem?
- Hi, Sujana,
have you seen this post:
Looks to me like Bruce Rindahl already has a solution for what you
--- In email@example.com,
"sujana_jyothi" <sujana_jyothi@...> wrote:
> Hi Helder Magalhães,
> Thanks for your code snippet. I still havent tried out if it
> or not. I will try it and will get back to you. And apologies if my
> previous message was abrupt. I thought, I did speak in a requesting
> way and I did say "please suggest me".......
> Anyways, Thanks once again....