On Sat, 27 Sep 2008 11:39:05 +0200, Markus Bleicher wrote:
> Bump.
>
> Hello,
>
> I put some javascript into the edit-macro of a homegrown widget.
>
> <script type="text/javascript" language="javascript">
> var testv="TestTest";
> </script>
> <script type="text/javascript" language="javascript">
> // <![CDATA[
>
> alert(testv);
>
> // ]]>
> </script>
>
> with strange results:
> The scope of the variable is limited to its enclosing script-tag, so it
> is not defined when the alert fct. ist called. And the resulting error
> is silently swallowed.
>
> writing: alert("Blah"); works.
>
> So: Does kss swallow errors and how to see them? Any clue where this
> scoping problem comes from, is there some reordering of tags while they
> are inserted into the page-dom?
What you describe sounds weird to me, and I am not sure what exactly
happens. But the solution is simple: don't embed
the javascript in your widget, instead put your javascript in a
javascript resource file.
You can also create a kss action and this way you can easily execute your
javascript from a :load event that triggers each time your widget is
inserted.
It is very unlikely that we will support this use case (execution of
embedded <script>) from kss, because it's in general considered as bad
practice to embed your javascript into the page.
Best wishes,
--
Balazs Ree
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers