Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1388 closed defect (invalid)

dojo.require Bug?

Reported by: ole_ersoy@… Owned by: James Burke
Priority: high Milestone:
Component: Loader Version: 0.3
Keywords: Cc: ole_ersoy@…
Blocked By: Blocking:

Description

If I:

dojo.require('dojo.widget.Button');

dojo.require("dojo.presentation.application.NamespacedTagToComponentClassMap?");

Then NamespacedTagToComponentClassMap? loads fine insde the html test page.

If

dojo.require('dojo.widget.Button');

is commented out, the other no longer loads.

Here is the test page:

<!DOCTYPE html

PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"

xmlns:dojo="http://www.dojotoolkit.org" xml:lang="en" lang="en">

<head>

<title>AbstractViewHandler? Test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script language="JavaScript?" type="text/javascript">

Dojo configuration djConfig = {

isDebug: true

};

</script> <script

type="text/javascript" src="../../../../../../lib/dojo/dojo.js">

</script> <script

type="text/javascript" src="../../../../../../lib/jsunit/app/jsUnitCore.js">

</script> <script language="JavaScript?" type="text/javascript">

dojo.require('dojo.widget.*'); dojo.require('dojo.widget.Button'); dojo.require("dojo.presentation.application.NamespacedTagToComponentClassMap?");

</script>

</head> <body>

<script language="JavaScript?" type="text/javascript">

dojo.require("dojo.presentation.application.NamespacedTagToComponentClassMap?"); dojo.declare("dojo.presentation.components.Button", null, {

componentType: "dojo.presentation.components.Button", componentFamily: "a really nice family",

});

dojo.declare("com.organization.Button", null, {

componentType: "com.organization.Button", componentFamily: "a really nice family",

});

map = new dojo.presentation.application.NamespacedTagToComponentClassMap?(); map.add("dojo:button", "dojo.presentation.components.Button"); map.add("organization:button", "com.organization.Button");

function testGetComponentClass() {

assertTrue(map.getComponentClass("dojo:button")=="dojo.presentation.components.Button");

}

</script>

</body> </html>

Here is the NamesapcedTag? code....

dojo.provide("dojo.presentation.application.HTMLViewHandler"); dojo.require("dojo.collections.Dictionary");

/*

  • This has to be initialized by the page loading the component libraries */

dojo.declare("dojo.presentation.application.NamespacedTagToComponentClassMap?", dojo.collections.Dictionary, {

getComponentClass: function(tag) {

if (this.contains(tag)) {

return this.entry(tag);

} else {

dojo.raise("Can not create component for tag: " + tag, Error("Component Creation Exception"));

}

}

});

Attachments (1)

testNameSpacedTagToComponentClassMap.html (1.6 KB) - added by guest 13 years ago.

Download all attachments as: .zip

Change History (7)

Changed 13 years ago by guest

comment:1 Changed 13 years ago by guest

This might be a separate bug/issue:

When I run this test, it passes: try {

map.getComponentClass('monkey');

}

catch(e) {

Test Passed - Sort of - Dojo raise swollows the exception or something...

}

And if I simply do this:

map.getComponentClass('monkey');

It also passes, although if you open the test page in a browser, dojo does show the error message. It looks like dojo.raise() swollows the exception...

comment:2 Changed 13 years ago by ole_ersoy@…

Dojo also shows the

FATAL: Can not create component for tag: monkey: Component Creation Exception

When I catch the exception.

Since I'm using try catch I knew that there was a possibility of this error and I wanted to catch it and deal with it myself without any 'assistance'.

The message appears regardless of whether debug is set to true or false...

comment:3 Changed 13 years ago by dylan

Component: GeneralPackageSystem
Milestone: 0.4
Owner: changed from anonymous to alex

comment:4 Changed 13 years ago by James Burke

Owner: changed from alex to James Burke

Stealing io and package bugs from Alex. Holler if you want it back.

comment:5 Changed 13 years ago by James Burke

Cc: ole_ersoy@… added
Resolution: invalid
Status: newclosed

Try doing a dojo.require("dojo.lang.declare"); at the top of NamespacedTagToComponentClassMap?.js. I think that will fix the problem. See my comments in trac #1358 for more information.

Closing as resolved/invalid, but feel free to reopen with more information if the dojo.require("dojo.lang.declare") does not work.

comment:6 Changed 12 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.