Parsing of SVG files : elements not separated by \n are not shown

RESOLVED INVALID

Status

()

Core
SVG
RESOLVED INVALID
5 years ago
5 years ago

People

(Reporter: Pierre-Etienne Meunier, Unassigned)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2

Steps to reproduce:

I wrote two pages :

<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 162 100">
<text>
<tspan x="0" y="10" font-size="10px">Blabla</tspan>
</text><path fill="none" stroke="#000000" stroke-width="0.100000" d="M19.2508 48.0609L17.7994 48.0609 " />
</svg>

and then

<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 162 100">
<text>
<tspan x="0" y="10" font-size="10px">Blabla</tspan>
</text>
<path fill="none" stroke="#000000" stroke-width="0.100000" d="M19.2508 48.0609L17.7994 48.0609 " />
</svg>



Actual results:

The first page forgot my <path ...>, while the second one had it


Expected results:

The two should give the same result

Updated

5 years ago
Component: Untriaged → SVG
Product: Firefox → Core

Comment 1

5 years ago
Created attachment 667449 [details]
First example: same line

Comment 2

5 years ago
Created attachment 667450 [details]
Second example: separate line
They look the same to me. What version of Firefox are you using?
(Reporter)

Comment 4

5 years ago
Ok, sorry for the imprecise bug report. The problem comes when I load the svg with a javascript from an html page, then I include the elements in an already present svg. I join the complete test case.
(Reporter)

Comment 5

5 years ago
Created attachment 667451 [details]
Javascript loading of the svg files
Attachment #667451 - Attachment mime type: text/plain → text/html
I think you'll either have to create a testcase without XMLHttpRequest by putting the contents of test0.svg directly into parseFromString or host it somewhere else.
g.appendChild removes the node from the newSvg array so 

step 1

newSvg node 1 = text
newSvg node 2 = path
i=0

then call appendChild and loop and you get

newSvg node1 = path
i=1

Try Firebug it will help debugging this kind of thing.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → INVALID
(Reporter)

Comment 8

5 years ago
I'm sorry ! I was actually using firebug, but in what kind of documentation was I expected to find this information ?
Here perhaps https://developer.mozilla.org/en-US/docs/DOM/Node.appendChild

If the node already exists it is removed from current parent node, then added to new parent node.
You need to log in before you can comment on or make changes to this bug.