W3C home > Mailing lists > Public > public-html@w3.org > March 2009

Re: Script in SVG vs. HTML

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 10 Mar 2009 13:18:48 -0400
Message-ID: <49B6A0F8.3020101@mit.edu>
To: "Dailey, David P." <david.dailey@sru.edu>
CC: public-html@w3.org, www-svg <www-svg@w3.org>
Dailey, David P. wrote:
> (1) In HTML (most browsers, at least) one can say
> var O=document.getElementsByTagName(sometag)
> var q=O[i]
> whereas in SVG you have to do
> var O=document.getElementsByTagName(sometag)
> var q=O.items(i)

Really?  I don't see SVG defining a getElementsByTagName function 
anywhere, so that's the DOM Core function you're using, and the DOM Core 
ECMAScript bindings require the [i] syntax to do the same thing as 
.item(i) (not .items(i)).  Am I missing something?  Was this just a 
matter of a buggy DOM implementation in some UA?

> (2) In SVG you can rely on function Q(evt) receiving the event and knowing what evt.target is. In HTML (as deployed in current browsers), you can't. SVG is nicer in that way.

That's not an HTML issue.  It's a pure DOM implementation issue, and all 
browsers implementing DOM2 Events (everyone but MSIE) has this right. 
Again, what am I mising?

> (3)There used to be difference between browsers and between HTML and SVG in terms of when onload happens:
> <svg xmlns=http://www.w3.org/2000/svg
> xmlns:xlink=http://www.w3.org/1999/xlink
> onload="alert('message')">

This is the load event for the <svg> element, right?  It's not to be 
confused with load event for the window, which is what the onload 
attribute of <body> sets in HTML documents.

> IE/ASV fires the ellipse before the ellipse is drawn.

Before it's drawn, or before it's parsed?  The former is allowed by the 
spec.  The latter is just buggy.  Again, it seems like your issue is a 
buggy implementation, not the spec itself.

> (5) In SVG you have to use a <![CDATA[ thingy inside your <script> to avoid parsing <'s. That scares some learners.

This is a matter of XML vs not.  You have to do the same thing in XHTML.

In any case, none of this has to do with Doug's question, which was 
specifically about the behavior of <svg:script> and <html:script>, not 
of the specifics of the scripts running as a result.

Received on Tuesday, 10 March 2009 17:19:40 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:45 UTC