I see a lot of questions coming into the Dojo Toolkit that says something like the following:
How do I add a node to a document using the DOJO* Toolkit? Please help me!
…or something similar. While I can entirely appreciate the sentiment (i.e. I’m confused, can you give me a hand?), I’m also seeing a continuing trend—which is the idea that the major libraries out there (Dojo, JQuery, MooTools, Prototype, etc.) have been written so that you don’t have to learn the whole concept of the DOM + JavaScript bindings.
That’s not right.
If you are one of those people who are just getting your toes wet in the whole concept of “using the browser as an application platform”, there’s one rule I’d recommend you write down and sleep with for a week on your pillow: the libraries that are out there are not designed to replace, but to augment.
In other words, you’re not going to get very far if you don’t have a basic grasp of things like node.appendChild, document.getElementById, node.getAttribute, etc. If you don’t have a basic understanding of how the Document Object Model (i.e. DOM) works, you’re not going to get very far.
This is not to say that you have to have a truly comprehensive understanding. There are plenty of tasks out there (such as “how do I check that a value of an input field meets certain criteria”) that don’t require a lot of in-depth learning. But the idea that you can slap a dijit ContentPane into a document as if you’re working with a separate window object (i.e. an iframe element) and then wonder why things don’t work as planned—with little to no knowledge of how a browser interprets markup for your manipulation—is like expecting, for the first time, to sit behind the steering wheel of a car and be able to race in a Grand Tourismo, without knowing that the long pedal is the one that makes the car go, and the small pedal is the one that’s going to save your ass because it stops the damn car in the first place.
In other words, you have to have at least a basic understanding of how JavaScript can interact with a document.
If you don’t, I’d suggest you at least try to look around before making a lot of noise on forums, mailing lists, Google Groups or whatever.
Bear in mind that I’m fully aware that many have been given directives with little-to-no-time to try to figure things out. Trust me on this one—just a little bit of research will save you a lot of time (in business terms, resources and budget) in the long run.
* As a side note: it’s not DOJO, it’s “Dojo”. As the person that designed the first two iterations of the logo for the Dojo Toolkit—and being one of the first involved, as well as having a major influence due to my own f(m) toolkit, from way back when—it drives me NUTS when people call it that. It’s like you’re shouting the name back at us.
Please stop =)