Slight bug with SVG XML getting added whitespace

View: New views
2 Messages — Rating Filter:   Alert me  

Slight bug with SVG XML getting added whitespace

by brettz9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

In doing some testing for JavaScript SAX2 parser
(http://code.google.com/p/jssaxparser/ ), I discovered that in one of
our tests (which checked for identity among attributes within the
built-in parser and our own which started from
document.implementation.createDocument), when using SVG, certain
attributes were altered by Firefox. While FF 3.5 avoids the issue of
"scale(4)" turning into "scale(4, 4)", the built-in DOMParser() still
auto-changes the whitespace.

// No space
var text = '<svg xmlns="http://www.w3.org/2000/svg">'+
                '<g transform="translate(20,20) scale(4)"></g></svg>';

// The attribute value now has an extra space within the translate()
function
var t = new DOMParser().parseFromString(text,"text/xml");
alert(t.getElementById('a').getAttribute('transform'));

// Here it is again showing the whole document
alert(new XMLSerializer().serializeToString(new
DOMParser().parseFromString(text,"text/xml"))); <svg
xmlns="http://www.w3.org/2000/svg"><g transform="translate(20, 20)
scale(4)"/></svg>

If you change the SVG namespace (to make this some other XML), the
attribute no longer adds a space.

So, while this issue doesn't apparently affect functionality, it still
causes problems for those which reflect on XML...

File a bug?

Brett
_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml

Re: Slight bug with SVG XML getting added whitespace

by Boris Zbarsky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Brett Zamir wrote:
> when using SVG, certain
> attributes were altered by Firefox.

I believe SVG allows normalizing attribute values, yes...

-Boris
_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml