My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 312: For Shelley Powers: Odd error when using within XHTML document: works with Firefox, does not work with any other browser
  Back to list
Status:  Fixed
Owner:  bradneuberg
Closed:  Sep 19
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by shelley.just, Sep 18, 2009
I converted one of my web sites, which used SVG for the background, into using svgweb. It's at 
http://frugalalgorithm.burningbird.net.

I followed the instructions in the documentation, included my SVG within a CDATA section. 

The graphic works fine in Firefox, in Mac and Windows. However, the same error is generated 
with IE, Safari, and Opera (error from Opera shown):

Error:
name: Error
message: There is a bug in your SVG: <parsererror 
xmlns="http://www.mozilla.org/newlayout/xml/parsererror.xml">Error<sourcetext>Unknown 
source</sourcetext></parsererror>



Comment 1 by shelley.just, Sep 18, 2009
When debugging using the uncompressed js library, I noticed that Firefox stripped the
CDATA out of the XML before parsing, while Opera did not. 
Comment 2 by grick23, Sep 18, 2009
I am not sure why Brad suggested that syntax in the UserManual:

<script type="image/svg+xml"><![CDATA[
  <svg width="466" height="265" id="svg11242"></svg>
]]></script>

If I remove the CDATA wrapper it works for me. Assigning to Brad since I do not
understand the purpose of the CDATA recommendation.
Status: Accepted
Owner: bradneuberg
Comment 3 by bradneuberg, Sep 18, 2009
Shelley, what happens if you don't nested the SVG inside of a CDATA section in the
SCRIPT block?
Comment 4 by shelley.just, Sep 18, 2009
The SVG does work when you remove the CDATA. Unfortunately, though, the SVG within the scripting block will 
generate a whole lot of validation errors when you validate as XHTML. 

My page isn't valid anyway, because I use the RDFa doctype, but others using the script without CDATA that did 
validate will get validation errors. No biggie, really, but people should be forewarned.


Comment 5 by shelley.just, Sep 18, 2009
I spoke too soon. Now, the error is happening with Firefox, but no one else. 

So, it seems to only work in Safari, Chrome, IE, and Opera without the CDATA, but only work with the CDATA in 
Firefox, when the page is served as XHTML
Comment 6 by bradneuberg, Sep 18, 2009
Would it be correct to change the title of this bug to:

"SVG Web does not correctly handle CDATA SCRIPT blocks when served as XHTML"

Does that correctly describe the situation.
Comment 7 by bradneuberg, Sep 19, 2009
This was related to three issues:

* When you embed SVG Web into an XHTML page, you _must_ surround your SVG SCRIPT
blocks with CDATA sections as the User Manual indicates:

<script type="image/svg+xml"><![CDATA[
  <svg width="466" height="265" id="svg11242"></svg>
]]></script>

Shelley's markup on this bug doesn't.

* Inside svg.js, we were using innerHTML to insert the Flash into the page, which
doesn not work under XHTML Strict. Modified the FlashInserter to create an EMBED
object in this case and insert it into the page rather than innerHTML (strangely,
EMBED is not XHTML compliant but works, while OBJECT is but does not so we have to
insert an EMBED into the page after load).

* For IE, the CDATA block stays inside the SCRIPT when we process it. Added regular
expressions to strip it out.

Fixed locally on my disk.

Comment 8 by bradneuberg, Sep 19, 2009
(No comment was entered for this change.)
Summary: For Shelley Powers: Odd error when using within XHTML document: works with Firefox, does not work with any other browser
Comment 9 by bradneuberg, Sep 19, 2009
This issue was closed by revision r888.
Status: Fixed
Comment 10 by bradneuberg, Sep 19, 2009
One last thing: On IE the fixed position SVG displays incorrectly on top of
everything. To fix this you have to change the z-index from 0 to -1:

<svg id="svg2607" style="bottom: 0pt; height: 24%; width: 98%; z-index: -1; position:
fixed; left: 1%;" preserveAspectRatio="none" viewBox="0 0 774.013 109.047"
xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">

Notice the z-index -1 (it used to be 0).

I have this running up on my web server.

XHTML version (for non-IE browsers):

http://codinginparadise.org/temp/The%20Frugal%20Algorithm.xhtml

HTML version (for IE -- I don't have fancy server-side user-agent detection for XHTML
on my web server):

http://codinginparadise.org/temp/The%20Frugal%20Algorithm.html

I've put up a ZIP file with this patch (plus  Issue 307  and  Issue 308  which were
already in the head of Subversion) for Shelley here:

http://codinginparadise.org/temp/for-shelley-powers-09-19-2009.zip

Comment 11 by shelley.just, Sep 19, 2009
Works great now! I've tested now with HTML and XHTML, and on Mac and Windows, and SVGWeb handles 
backgrounds beautifully. Good job!
Sign in to add a comment

Hosted by Google Code