Inlined SVG not rendered when document.write() to a window frame

RESOLVED INVALID

Status

()

RESOLVED INVALID
13 years ago
13 years ago

People

(Reporter: the1geek, Unassigned)

Tracking

1.8 Branch
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: INVALID?)

Attachments

(7 attachments)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

document.open();
document.write(HTML_with_inlined_SVG);
document.close();

HTML is rendered but not inlined SVG in the target window when document.write is used.

Both HTML/SVG rendered when loaded by url location and by open file.

Reproducible: Always

Steps to Reproduce:
1. Load a simple HTML+SVG file by url location and by open file.
2. Confirm that SVG is rendered.
3. Convert the same file into string.
4. Pass the string in document.write
   document.open();
   document.write(HTML_with_inlined_SVG);
   document.close();

Actual Results:  
Only HTML is rendered, but not SVG.

Expected Results:  
Both HTML/SVG should be rendered.
document.write doesn't work in XML, and SVG only works in XML, right?
Assignee: nobody → general
Component: General → DOM
Product: Firefox → Core
QA Contact: general → ian
Whiteboard: INVALID?
Version: unspecified → 1.8 Branch
(Reporter)

Comment 3

13 years ago
Created attachment 206063 [details]
html to test document.write xhtml+svg content

Load html file in Firefox 1.5 and click "this" link.
(Reporter)

Comment 4

13 years ago
Created attachment 206064 [details]
Same xhtml+svg content in .htm file extension

Same xhtml+svg content in .htm file extension loaded in Firefox 1.5 renders xhtml but not svg.
(Reporter)

Comment 5

13 years ago
Created attachment 206065 [details]
Same xhtml+svg content with .xml file extension

Same xhtml+svg content in .xml file extension loaded in Firefox 1.5 renders both xhtml and svg.
(Reporter)

Comment 6

13 years ago
Only xhtml+svg content with .xml file extension loaded in Firefox 1.5 renders both xhtml and svg.

Why not render both xhtml and svg in .htm file extension. Any xhtml content with .xml extension is displayed as transformed xml tree in IE. Hence to have my xhtml content rendered in all browsers i have to use the .htm extension.

Its an easy "feature" to fix for retro-compatibility. There still are old browsers out there that do not understand .xml extension.

(Reporter)

Comment 7

13 years ago
Created attachment 206233 [details]
Same xhtml+svg content in .xhtml file extension

Same xhtml+svg content in .xhtml file extension loaded in Firefox 1.5 renders
both xhtml and svg.
(Reporter)

Comment 8

13 years ago
Created attachment 206234 [details]
Same xhtml+svg content in .htm file extension
(Reporter)

Comment 9

13 years ago
Created attachment 206236 [details]
html to test document.write xhtml+svg content

content-type set to application/xhtml+xml
(Reporter)

Comment 10

13 years ago
Created attachment 206238 [details]
html to test document.write xhtml+svg content with xhtml namespace

content-type set to application/xhtml+xml
(Reporter)

Comment 11

13 years ago
I uploaded files of identical xhtml+svg content in various filename extension using different content-types.

As expected files with text/xml or application/xhtml+xml content-type have both html and svg rendered regardless of filename extension. Only html is rendered for text/html.

In the case of the html page that contains the document.write, only html is rendered when the same xhtml+svg content is written to the page.

The same file when set to application/xhtml+xml has a very interesting outcome. The title and javascript code is displayed and surprisingly the quoted xhtml+svg content has both html and svg rendered.

I added the xhtml namespace declaration to the html tag of the same file and set the content-type to application/xhtml+xml. The html link appeared normal but the page hang when i click to document.write the content.

It's a very interesting experiment.

So what is the proper alternative to document.write to render both html & svg in Firefox 1.5? I use nav control frame to document.write dynamic contents to another frame. I dont have this problem using html+vml in IE.

Comment 12

13 years ago
You can use document.createElementNS() also in HTML.
Use that to create SVG elements.
See the example http://annevankesteren.nl/test/cdf/cdi/007.html

.innerHTML should work in XHTML and it can handle namespaces then, but I guess
you really want to use SVG in HTML, not in XHTML. Then use DOM Core APIs,
like the .createElementNS()
http://www.w3.org/TR/DOM-Level-2-Core/core.html
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.