I have some additional information on this problem.  First of all, the issue
doesn't appear to be specific to MockiKit; I tried including the Dojo
toolkit, and saw exactly the same behaviour.  Secondly, the problem seems to
be an interaction between Google's back-end, IE, and my code.  In short:

I include two JS files in my gadget (my actual gadget, not the test case I
mentioned in my earlier messages): MochiKit, and my application logic.  I
use two SCRIPT tags, like so:

<SCRIPT type="text/javascript"
src="http://www.house-o-games.com/neknek/gadgets/play/MochiKit.js";></SCRIPT>
<SCRIPT type="text/javascript"
src="http://www.house-o-games.com/neknek/gadgets/play/play.js";></SCRIPT>

When I look at the rendered Gadget, however, Google has replaced these two
tags with the following one:

<SCRIPT 
src="//1-sandbox.gmodules.com/gadgets/concat?refresh=86400&container=ig&rewriteMime=text/javascript&gadget=http%3A%2F%2Fwww.house-o-games.com%2Fneknek%2Fgadgets%2Fplay.xml&fp=-182800334&1=http%3A%2F%2Fwww.house-o-games.com%2Fneknek%2Fgadgets%2Fplay%2FMochiKit.js&2=http%3A%2F%2Fwww.house-o-games.com%2Fneknek%2Fgadgets%2Fplay%2Fplay.js"
type="text/javascript"></SCRIPT>

Which, if you look at the URL, seems to be a composite of the two files
cached on Google's servers somewhere.  This composite doesn't sit well with
IE.

I worked around the problem by generating the SCRIPT tags dynamically:

<SCRIPT type="text/javascript">
        var i, externs;
        externs = [     
'http://www.house-o-games.com/neknek/gadgets/play/MochiKit.js',
                        
'http://www.house-o-games.com/neknek/gadgets/play/play.js'];

        for (i = 0; i < externs.length; i++)
                document.write(unescape("%3Cscript src='" + externs[i] + "'
type='text/javascript'%3E%3C/script%3E"));
</SCRIPT>

This code prevents the composition of the JS files, and keeps IE happy.

I talk about this issue at slightly greater length on my blog (
http://www.mlsite.net/blog/?p=168).  Thanks for answering my e-mail, and
looking at my problem.

MochiKit works just fine for Google Gadgets, you just have to be careful how
you include it.

-- Mike

On Tue, Apr 28, 2009 at 8:51 PM, Per Cederberg <[email protected]> wrote:

>
> In order to break this down a bit, could you try the page with just
> the MochiKit.Base module? Use the download customizer to create a
> minimized version with the modules you wish to try.
>
> http://svn.mochikit.com/mochikit/trunk/packed/MochiKit/customize.html
>
> We need to know more details about which module that breaks to analyze
> this. It is not a known issue.
>
> Cheers,
>
> /Per
>
> On Wed, Apr 29, 2009 at 1:32 AM, MXH <[email protected]> wrote:
> >
> > I'm having trouble using MochiKit with a Gadget I'm writing for the
> > iGoogle interface.  Specifically, even the inclusion of the
> > MochiKit.js file (via a SCRIPT tag) seems to break otherwise-
> > functional Gadgets in IE6 or (more seriously) IE7.  (Other browsers
> > seem fine.)
> >
> > Here's what I'm seeing:
> >
> > 1.) I create a Gadget that *doesn't* depend on MochiKit
> > 2.) The Gadget works (i.e. it renders properly on load, which involves
> > JS building up the DOM)
> > 3.) I add a SCRIPT tag to the Gadget to import MochiKit.js
> > 4.) The Gadget breaks (i.e. it won't render properly on load 90% of
> > the time)
> >
> > Some clarifications:
> >
> > a.) The Gadget has an "html" Content Type (To clarify the
> > clarification:  "Content Type" refers to the parameter in Google's
> > Gadget XML spec, not the HTML Header.)
> >
> > b.) This happens even if I include the "MochiKit={__export__:false};"
> > line at the top of MochKit.js, which should suppess symbol export.
> >
> > c.) Again, the Gadget isn't making any use of MochiKit, it's just
> > trying to import the JavaScript.
> >
> > d.) The failure is intermittent, but I've never seen it fail w/o the
> > MochiKit include, and it fails ~90% of the time with the include, so I
> > feel pretty sure the two are related.
> >
> >
> > My question:  "Is this a known problem?  Has anyone else had
> > experiences, good or bad, with IE6 or IE7 compatibility when using
> > MochiKit to develop Google Gadgets?"
> >
> > Thanks for reading.  If you're interested, the XML for the Gadget I am
> > using for testing can be fetched here:
> >
> > http://www.house-o-games.com/neknek/gadgets/neknek.xml
> >
> > (The failure occurs in the "canvas" view".)
> >
> > >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to