W3C home > Mailing lists > Public > www-svg@w3.org > January 2008

contentScriptType and type on script elements

From: Erik Dahlström <ed@opera.com>
Date: Tue, 08 Jan 2008 15:54:27 +0100
To: "www-svg@w3.org" <www-svg@w3.org>
Message-ID: <op.t4l801n2gqiacl@gnorps.palace.opera.no>

Reading the SVG 1.1 and 1.2T specs on how 'type' works on 'script'  
elements leads me to a couple of questions:

1. Given the markup below should the script element with id="s1" run?
<svg contentScriptType="foo/bar" xmlns="http://www.w3.org/2000/svg"><foo  
xmlns="http://foobar.com/baz"><script id="s1"  
xmlns="http://www.w3.org/2000/svg"> alert('whee'); </script></foo></svg>

The script element has to move across the unknown markup to get the  
default scripttype, and if it gets that it shouldn't be executed unless it  
understands "foo/bar". Otherwise, one could see it such that it defaults  
to "text/ecmascript" even though it lacks a direct 'svg' parent. The  
script is executed in ASV3, Safari 3, Firefox 3, Opera 9.x and Batik 1.7.  
I guess this can mean that either 'contentScriptType' is not supported, or  
that all viewers assume ecmascript always or that the namespace border  
isn't crossed and that it assumes that it is ecmascript. The spec isn't  
very clear on how it should work, if you are allowed to cross namespace  
boundaries in search of an 'svg' parent element, or what happens if there  
is none (although it is a required attribute in 1.1 none of the viewers  
seemed to respect that).

2. Does 'contentScriptType' work on document fragments or on documents?  
That is does nesting 'svg' elements mean that you use the innermost or  
outermost 'svg' element when getting 'contentScriptType'?

Spec[1] says: "The contentScriptType attribute on the 'svg' element  
specifies the default scripting language for the given document fragment."  
which seems to be in conflict with "Identifies the default scripting  
language for the given document."

Best regards
/Erik

[1] http://www.w3.org/TR/SVG11/script.html#ScriptElement
[2] http://www.w3.org/TR/SVGMobile12/script.html#ScriptElement

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
http://my.opera.com/macdev_ed
Received on Tuesday, 8 January 2008 14:52:38 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:38 GMT