[Dojo-interest] Including Dojo in an SVG
Jack Beauregard
jbeauregard.ch at gmail.com
Thu Aug 11 04:12:16 EDT 2011
Hello Rock,
thank your for investigation.
The button is in the html, not in the svg. The consoles tells me about
a unknown dojo in the svg. That is the 1st problem. Here are the
sources:
1. HTML
<body>
<script>
dojo.addOnLoad(function() {
var button1 = dojo.byId("b1");
dojo.connect(button1, "onmouseup", function(evt){
dojo.publish("alerting", []);
});
});
</script>
<div>
<button id="b1">b1</button>
</div>
<div>
<object id="object" data="stateIndicator.svg" type="image/svg+xml" />
</div>
</body>
2. The JavaScript part in the svg:
<script type="text/javascript"><![CDATA[
dojo.ready(function(){
dojo.subscribe("alerting", function(){
alert("alerting was triggered");
});
})
]]></script>
What I'm doing wrong?
best regards
Jack
On Thu, Aug 11, 2011 at 8:51 AM, Rock <ruanqig at gmail.com> wrote:
> Didn't see the "button" here, so I guess it's in the svg, right? I made a
> testcase like below:
>
> dojo.ready(function(){
> dojo.subscribe("alerting", function(){alert();});
> var button = dojo.byId("button");
> dojo.connect(button, "onmouseup", function(evt){dojo.publish("alerting",
> []);});
> })
>
>
> And it works, something I missed?
More information about the Dojo-interest
mailing list