Closed Bug 233334 Opened 22 years ago Closed 22 years ago

SVG script tag syntax different from [IE, Batik]

Categories

(Core :: SVG, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 62485

People

(Reporter: tpassin, Assigned: alex)

Details

User-Agent: Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7a) Gecko/20040205 For a straight svg file - i.e., no embeds or object elements - one that has a document element like <s:svg xmlns:s="http://www.w3.org/2000/svg" >...</s:svg> IE + Adobe and Batik use a different script tag syntax than Mozilla does. It would be **good** if all three agreed. This syntax works for Mozilla - <script type='text/javascript' src='svg1b.js' xmlns='http://www.w3.org/1999/xhtml'/> This for works for IE + Adobe and Batik - <script type='text/ecmascript' xlink:href="svg1b.js" xmlns:xlink='http://www.w3.org/1999/xlink'/> (Hope the angle brackets show up OK) I am not sure that the SVG Rec actually specifies a syntax, but leading browsers should use the same form. Right now, each one ignores the other, so you can insert a version for each browser, but that is an irritating work-around. I suggest allowing Moz to accept **either** form so as not to break backwards compatibility. There is a similar issue with inline scripts, except that you do not need the xlink and href/src parts. Reproducible: Always Steps to Reproduce: 1.Create an external javascript file that just has an alert in it, such as alert('This is a test') This alert should pop up when the script executes - no user action is required. 2. Create a working svg file, and verify that it works on all three browsers. 3. Insert a script element into the svg document using one of the syntax exampes given above. Reload the svg file. For the browser(s) it works on, an alert will pop up. For the other(s), it will not. Change to the other syntax and verify that which browsers pop up the alert change to the other set. Insert another script element with the other syntax, so that both forms are in one svg file. Reload the browers and verify that all three now pop up the alert. Actual Results: Depending on which form of the script element is used, either IE and Batik, or Moz will pop up the alert. Only if both forms are inserted into the same svg document will all three browsers act as desired. Expected Results: All SVG browsers should accept the same syntax for script elements.
The Adobe SVG Viewer plug-in (rather than MSIE itself) and Batik are indeed following the SVG recommendation [1]. They give a sample SVG document with script [2] that displays on Mozilla-with-SVG but does not react to mouse clicks. [1] http://www.w3.org/TR/SVG11/script.html#ScriptElement [2] http://www.w3.org/TR/SVG/images/script/script01.svg Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7a) Gecko/20040209
text/ecmascript is not a registered MIME type. mozilla.org's possition seems to be that the W3C should not be specifying MIME types in their specifications without first having them registered. Whether Mozilla should just add text/ecmascript and other widely used MIME types to make the lives of Web developers easier or not is questionable. However this issue is tracked by bug 62485. You may wish to vote or comment there.
Status: UNCONFIRMED → NEW
Depends on: text-ecmascript
Ever confirmed: true
*** This bug has been marked as a duplicate of 62485 ***
Status: NEW → RESOLVED
Closed: 22 years ago
No longer depends on: text-ecmascript
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.