4 <svg id=
"svg" width=
"200" height=
"200" xmlns=
"http://www.w3.org/2000/svg" xmlns:
xlink=
"http://www.w3.org/1999/xlink">
5 <rect width=
"100" height=
"100" fill=
"red"/>
9 var img
= document
.createElementNS('http://www.w3.org/2000/svg', 'image');
10 img
.setAttribute('width', '100');
11 img
.setAttribute('height', '100');
12 img
.setAttributeNS('http://www.w3.org/1999/xlink', 'href', 'data:image/svg+xml,' +
13 '<svg xmlns="http://www.w3.org/2000/svg">' +
14 ' <rect width="100" height="100" fill="green"/>' +
17 var inactive_doc
= document
.implementation
.createDocument ('http://www.w3.org/1999/xhtml', 'html', null);
18 // First, insert into an inactive doc.
19 inactive_doc
.documentElement
.appendChild(img
);
20 // Then re-insert into the current doc.
21 document
.getElementById('svg').appendChild(img
);