Dojo and MochiKit not playing nice

4 views
Skip to first unread message

Matt

unread,
Oct 29, 2006, 8:37:35 AM10/29/06
to MochiKit
Sorry to bring this sort of topic up again, but none of the old posts
solved my issues.

I'm trying to use Dojo (either 0.4 or 0.3.1) with the latest SVN of
MochiKit as I really like Mochi's implementation of the Scriptaculous
Sortables as well as how Mochi handles things in general. Nothing I've
tried has properly worked, giving me all imagineable sorts of errors.

Does anyone have this working? I would love to use MochiKit with Dojo
instead of having to go back and rewrite the entire app using Dojo,
just so I have access to a few Dojo widgets.

If anyone wants more specifics on anything, please post and I will
clarify as best I can.

Eric Waldheim

unread,
Oct 29, 2006, 8:55:38 AM10/29/06
to Matt, MochiKit
I tried Dojo w/ MochiKit for a while but kept running into Dojo
issues (including the crashing of my browser).
Every time I played with Dojo (even Dojo w/out MochiKit), I came away
thinking "this is a mess".
Things are much simpler since I switched to yui and yui-ext with
MochiKit.
So while not helping much with your question, I suggest seeing if YUI/
YUI-EXT can provide the widgets you're looking for.

http://developer.yahoo.com/yui/
http://www.jackslocum.com/yui/index.php

Bob Ippolito

unread,
Oct 29, 2006, 11:37:20 AM10/29/06
to Matt, MochiKit

This is a known issue. The Dojo support was done a LONG time ago and
nobody has maintained it while Dojo's package system has evolved.

There's a ticket for this issue with a link to some information, but I
probably won't fix it myself because I don't know Dojo. Patches
accepted.

http://trac.mochikit.com/ticket/205

-bob

b3d70

unread,
Oct 30, 2006, 12:49:37 AM10/30/06
to MochiKit
hi mr.Matt,
We've been use dojo and mochi quite well. Our dojo version is 3.1 and
we used mochi from svn (packed version).

I never used sortable function area, but for general things, like
signal, DOM, XMLHTTPREQUEST, and visual effect is working fine for me.

On every our page, we always call mochi first before we call dojo
script.
I hope its can help you.

Matt

unread,
Oct 30, 2006, 6:44:43 AM10/30/06
to MochiKit
I'm trying to make a post on the ticket system regarding this, but it
keeps rejecting it as spam. :(

Bob Ippolito

unread,
Oct 30, 2006, 4:45:37 PM10/30/06
to Matt, MochiKit
On 10/30/06, Matt <mkwi...@gmail.com> wrote:
>
> I'm trying to make a post on the ticket system regarding this, but it
> keeps rejecting it as spam. :(
>

So post it here instead.

-bob

Matt

unread,
Nov 8, 2006, 11:36:09 AM11/8/06
to MochiKit
Sorry for the delay, my PSU went bad so I couldn't get at my code.

I'm no Javascript guru (nor am I all that familiar with either MochiKit
or Dojo internals), but based on the info linked, here's a
quick-and-dirty to get things up and going with Dojo .4 and the current
MochiKit CVS:

In mochikit/MochiKit/__package__.js, replace everything with the
following:

dojo.kwCompoundRequire({
"common": [
"MochiKit.Base",
"MochiKit.Iter",
"MochiKit.DOM",
"MochiKit.Async",
"MochiKit.Style",
"MochiKit.Color",
"MochiKit.Visual",
"MochiKit.Signal",
"MochiKit.DateTime",
"MochiKit.Logging",
"MochiKit.LoggingPane",
"MochiKit.Format",
"MochiKit.DragAndDrop"
]
});
dojo.provide("MochiKit.*");

***

It seems that most of the errors occur if the above aren't listed in a
particular order. I also wasn't able to get New.js or Sortable.js to
properly load when included in that list, so they must be manually
included in the file. Here's my test file and my directory structure:

./test.htm
./js/dojo/dojo.js
./js/mochikit/MochiKit/MochiKit.js

***

<html>
<head>
<script type="text/javascript" src="./js/dojo/dojo.js"></script>
<script type="text/javascript">
dojo.registerModulePath("MochiKit", "../mochikit/MochiKit");
dojo.require("MochiKit.MochiKit");
dojo.require("dojo.lfx");
</script>
<script type="text/javascript"
src="./js/mochikit/MochiKit/New.js"></script>
<script type="text/javascript"
src="./js/mochikit/MochiKit/Sortable.js"></script>
</head>
<body>
<div>
<div id="test_mochi" style="display: none;"></div>
and
<div id="test_dojo" style="display: none;"><h1>Dojo</h1></div>
</div>

<script>
MochiKit.DOM.appendChildNodes('test_mochi',MochiKit.DOM.createDOM('h1','MochiKit'));
MochiKit.Visual.appear('test_mochi');
</script>
<script>
dojo.lfx.html.wipeIn('test_dojo').play();
</script>
</body>
</html>

***

I have yet to encounter any Dojo/Mochi conflicts using this setup.
Hopefully someone more learned than I can make it into a bit more
elegant of a solution.

-Matt

Bob Ippolito

unread,
Nov 8, 2006, 2:05:38 PM11/8/06
to Matt, MochiKit

I've integrated (but not tested) the __package__.js changes, but I do
not currently plan to have Sortable and DragAndDrop automatically
included with "MochiKit.*", to mirror what you get with the packed
distribution.

-bob

Reply all
Reply to author
Forward
0 new messages