Closed Bug 320095 Opened 19 years ago Closed 19 years ago

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

Categories

(Core :: DOM: Core & HTML, defect)

1.8 Branch
x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: the1geek, Unassigned)

Details

(Whiteboard: INVALID?)

Attachments

(7 files)

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
Load html file in Firefox 1.5 and click "this" link.
Same xhtml+svg content in .htm file extension loaded in Firefox 1.5 renders xhtml but not svg.
Same xhtml+svg content in .xml file extension loaded in Firefox 1.5 renders both xhtml and svg.
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.

Same xhtml+svg content in .xhtml file extension loaded in Firefox 1.5 renders
both xhtml and svg.
content-type set to application/xhtml+xml
content-type set to application/xhtml+xml
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.
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
Closed: 19 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: