Datasheet

Chapter 1: Enhancing Development with Dojo Core
<script type="text/javascript">
djConfig = {
isDebug: true,
parseOnLoad: true,
modulePaths: {
"decafbad": "../../ex-dojo-core/decafbad",
},
};
</script>
<script type="text/javascript"
src="../dojodev/dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("decafbad.things");
</script>
</head>
<body>
<h1>Hello Dojo Parser</h1>
<div dojoType="decafbad.things.thingA" jsId="decafbad.stuff.someThingA"
class="someThingA" alpha="true" beta="three, four"
foo="bar" baz="123" xyzzy="hello">
<p>Alpha: <span class="alpha">default</span></p>
<p>Beta: <span class="beta">default</span></p>
<p>Foo: <span class="foo">default</span></p>
<p>Baz: <span class="baz">default</span></p>
<p>Xyzzy: <span class="xyzzy">default</span></p>
</div>
</body>
</html>
Most of this should look familiar with respect to what you’ve seen so far in this chapter: The first
<script>
block sets up
djConfig
before loading up the Dojo core in the next
<script>
element.
Afterthatcomesapairof
dojo.require()
calls to load in the Dojo parser and a new module named
decafbad.thingA
.
In the page
<body>
, you can see an object instance declared with
dojoType
=
"decafbad.thingA"
,bearing
a number of custom attributes and some paragraphs contained within.
As one of those attributes,
jsId
makes its first appearance: The value of this attribute identifies a vari-
able in the global namespace where the parser should store the newly instantiated object. In this case,
decafbad.stuff.someThingA
is where the new object will be found. This feature is very useful for refer-
ring to and connecting multiple objects declared in markup — there’ll be more of this in later chapters
when working with Dijit widgets.
15