Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#1735 closed defect (wontfix)

MochiKit 1.3.1 not working with Dojo 0.4

Reported by: James Burke Owned by: James Burke
Priority: high Milestone:
Component: General Version: 0.3
Keywords: mochikit Cc:
Blocked By: Blocking:

Description

There was an issue reported using Dojo 0.4 and MochiKit? 1.3.1. This is the test file that was used (put in dojo tests directory, and put mochikit folder containing mochikit js in test directory too:

<html>
	<head>
		<title>Mochi Kit</title>
		<script type="text/javascript">
			// Dojo configuration
			djConfig = { 
				isDebug: true
			};
		</script>
		
<script type="text/javascript" src="../dojo.js"></script>
<script type="text/javascript" src="mochikit/MochiKit.js"></script>
		
	</body>
</html>

Change History (2)

comment:1 Changed 13 years ago by James Burke

Resolution: wontfix
Status: newclosed

There were two issues:

1) mochikit is using deprecated methods in its package.js files. Those methods were deprecated in 0.3.1 and removed in 0.4. 2) The test file needed to tell Dojo the resource path for mochikit.

1) In mochikit's package.js file, it uses dojo.hostenv.conditionalLoadModule() and dojo.hostenv.moduleLoaded(). These methods have been removed in 0.4. Instead, the package.js file should look like this:

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

That fixes the resource loading, but then I get an error in MochiKit? (using a non-packed version, just the loose, lib .js files):

"m has no properties" line 72 of MochiKit?.js. When I was in Firebug, I believe it was trying to do something with Signal at that point.

2) The test file needs to tell Dojo where it can find mochikit resources, and if it does this, it actually does not need the separate script tag include.

<html>
	<head>
		<title>Mochi Kit</title>
		<script type="text/javascript">
			// Dojo configuration
			djConfig = { 
				isDebug: true
			};
		</script>
		
		<script type="text/javascript" src="../dojo.js"></script>
		<script type="text/javascript">
		dojo.registerModulePath("MochiKit", "tests/mochikit");
		dojo.require("MochiKit.MochiKit");
		</script>
	</head>
	<body>
	</body>
</html>

Note that this still suffers from the "m has no properties" error. If I do the following, this seems to load with no errors (but it would be nice if the dojo.require path worked):

<html>
	<head>
		<title>Mochi Kit</title>
		<script type="text/javascript">
			// Dojo configuration
			djConfig = {
				isDebug: true
			};
		</script>
		
		<script type="text/javascript" src="mochikit/MochiKit.js"></script>
		<script type="text/javascript" src="../dojo.js"></script>
		<script type="text/javascript">
		</script>
	</head>
	<body>
	</body>
</html>

Closing this bug now. It seems like the solution is to ask MochiKit? to update. Note that it can update to use the new methods in 0.4, but they will work in in 0.3.1 and earlier too.

Another option is to define this chunk of JS after dojo.js, but before any mochikit code:

dojo.hostenv.moduleLoaded = function(){
	return dojo.hostenv.startPackage.apply(dojo.hostenv, arguments);
}
dojo.hostenv.conditionalLoadModule = function(){
	dojo.kwCompoundRequire.apply(dojo, arguments);
}

but I don't think this will solve the "m has no properties error." Will need to ask Mochikit dev for that issue.

comment:2 Changed 13 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.