Uncaught SyntaxError: Unexpected token ILLEGAL

When you're making an SVG embedded in an XHTML document, don't forget the namespaces!

<rect id="case_lower_bg" x="240" y="418" width="65" height="28" ...


<svg:rect id="case_lower_bg" x="240" y="418" width="65" height="28" ...

Ah ha!

I appreciate that Chrome choked on the lack of namespacing, and it was indubitably my own fault. I was trying to insert an SVG I had created a long time ago into an XHTML document, and it just slipped my mind to add the tag prefixes. But an unexpected token known as ILLEGAL? I'm used to these error messages being, of necessity, vague; the browser is, after all, not a mind-reader. But this one was downright cryptic.

Thing is, I defined the document as XHTML with SVG in the doctype declaration. So what I'd like is for Chrome to look at the tags and say "hey, this is an <svg> tag, I guess I'd better tell the developer that it needs namespacing!" Surely it can't be that hard to add this feature. So if you guys could get to work on that right away, I'd really appreciate it. Don't worry, no one will mind if you delay the next ICS release to focus all your engineering might on this one problem. Go for it.

No comments:

Post a Comment