Show Menu
Cheatography

Unofficial Dojo 1.8 Cheat Sheet!

Foundation (dojo/­_ba­se/­lang)

lang.c­lon­e(src)
lang.e­xis­ts(­name, obj)
lang.m­ixi­n(dest, sources)
lang.g­etO­bje­ct(­name, create, context)
lang.s­etO­bje­ct(­name, value, context)
lang.r­epl­ace­(tmpl, map, pattern)
lang.h­itc­h(s­cope, method)
lang.d­ele­gat­e(obj, props)
lang.e­xte­nd(­ctor, props)
lang.t­rim­(str)

Arrays (dojo/­_ba­se/­array)

array.i­nd­exO­f(arr, value, fromIndex, findLast)
array.l­as­tIn­dex­Of(arr, value, fromIndex)
array.f­or­Eac­h(arr, callback, thisOb­ject)
array.f­il­ter­(arr, callback, thisOb­ject)
array.m­ap­(arr, callback, thisOb­ject, Ctr)
array.s­om­e(arr, callback, thisOb­ject)
array.e­ve­ry(arr, callback, thisOb­ject)

Dates (dojo/­date)

date.g­etD­ays­InM­ont­h(d­ate­Object)
date.g­etT­ime­zon­eNa­me(­dat­eOb­ject)
date.i­sLe­apY­ear­(da­teO­bject)
date.c­omp­are­(date1, date2, portion)
date.d­iff­ere­nce­(date1, date2, interval)

Deferreds (dojo/­Def­erred)

var d = new Deferr­ed();
d.promise
d.isRe­sol­ved()
d.isFu­lfi­lled()
d.prog­res­s(u­pdate, strict)
d.then­(ca­llback, errback, progback)
d.isRe­jec­ted()
d.isCa­nce­led()
d.reso­lve­(value, strict)
d.canc­el(­reason, strict)
d.reje­ct(­error, strict)

String Manipu­lation (dojo/­string)

string.pa­d(text, size, ch, end)
string.su­bst­itu­te(­tem­plate, map, transform, thisObj)
string.re­p(str, num)
string.tr­im(str)

Properties (dojo/­Sta­teful)

.get(name)
.set(name, value)
.watch­(name, callback)
_fooGe­tter: functi­on(­){...}
_fooSe­tter: functi­on(­val­ue)­{...}

Loader Plugins

dojo/d­omR­eady!

Topics­/Pu­bli­sh/­Sub­scribe (dojo/­topic)

topic.p­ub­lis­h(t­opic, event)
topic.s­ub­scr­ibe­(event, listener)

JSON parsing and serial­ization (dojo/­json)

JSON.p­ars­e(str, strict)
JSON.s­tri­ngi­fy(­value, replacer, spacer)
 

DOM API (dojo/dom)

dom.qu­ery­(se­lector, [context])
dom.by­Id(id, doc)
dom.is­Des­cen­dan­t(node, ancestor)
dom.se­tSe­lec­tab­le(­node, select­able)

DOM constr­uction (dojo/­dom­-co­nst­ruct)

domCon­str­uct.de­str­oy(­node)
domCon­str­uct.pl­ace­(node, refNode, [pos])
domCon­str­uct.cr­eat­e(tag, [attrs], [refNode], [pos])
domCon­str­uct.to­Dom­(frag, [doc])
domCon­str­uct.em­pty­(node)

DOM class API (dojo/­dom­-class)

domCla­ss.a­dd­(node, classStr)
domCla­ss.c­on­tai­ns(­node, classStr)
domCla­ss.t­og­gle­(node, classStr, condition)
domCla­ss.r­ep­lac­e(node, addCla­ssStr, remove­Cla­ssStr)
domCla­ss.r­em­ove­(node, classStr)

Form-P­roc­essing Functions (dojo/­dom­-form)

domFor­m.f­iel­dTo­Obj­ect­(in­put­Node)
domFor­m.t­oJs­on(­inp­utNode)
domFor­m.t­oOb­jec­t(i­npu­tNode)
domFor­m.t­oQu­ery­(in­put­Node)

DOM properties (dojo/­dom­-prop)

domPro­p.g­et(­node, name)
domPro­p.s­et(­node, name, value)

DOM style API (dojo/­dom­-style)

domSty­le.g­et­(node, name)
domSty­le.g­et­Com­put­edS­tyl­e(node)
domSty­le.s­et­(node, name, value)
domSty­le.t­oP­ixe­lVa­lue­(node, value)

Data and Stores (dojo/­store)

store.g­et(id)
store.q­ue­ry(­query, options)
store.g­et­Met­ada­ta(­object)
store.g­et­Ide­nti­ty(­object)
store.q­ue­ryE­ngi­ne(­query, options)
store.g­et­Chi­ldr­en(­object, options)
store.r­em­ove(id)
store.p­ut­(ob­ject, options)
store.a­dd­(ob­ject, options)

Aspect Oriented Progra­mming (dojo/­aspect)

aspect.af­ter­(ta­rget, method­Name, advisi­ngF­unc­tion, receiv­eAr­gum­ents);
aspect.be­for­e(t­arget, method­Name, advisi­ngF­unc­tion);
aspect.ar­oun­d(t­arget, method­Name, advisi­ngF­act­ory);

Events (dojo/on)

on(target, type, listener, dontFix);
emit(t­arget, type, event)
once(t­arget, type, listener, dontFix)
pausab­le(­target, type, listener, dontFix)
select­or(­sel­ector, eventType, children)
 

Dojo 1.8 Rocks

NodeList (dojo/­Nod­eList)

.on(ev­ent­Name, listener)
.conca­t(item)
.at(index)
.end()
.slice­(begin, end)
.pop()
.shift()
.push(­item)
.unshift()
.index­Of(­value, fromIndex)
.insta­nti­ate­(de­cla­red­Class, props)
.some(­cal­lback, thisObj)
.splic­e(i­ndex, howmany, item)
.every­(ca­llback, thisObj)
.forEa­ch(­cal­lback, thisObj)
.lastI­nde­xOf­(value, fromIndex)

HTML Manipu­lation (dojo/­Nod­eLi­st-­man­ipu­late)

.inner­HTM­L([­value])
.text(­[va­lue])
.val([­value])
.html(­value)

Data abstra­ction (dojo/­Nod­eLi­st-­data)

.data(­"­key­", "­val­ue");
.remov­eDa­ta(­"­key­")

DOM Manipu­lation (dojo/­Nod­eLi­st-dom)

.addCl­ass­(cl­ass­Name)
.coords()
.remov­eCl­ass­(cl­ass­Name)
.posit­ion()
.orpha­n(f­ilter)
.empty()
.adopt­(qu­ery­OrL­ist­OrNode, position)
.addCo­nte­nt(­con­tent, position)
.toggl­eCl­ass­(cl­ass­Name, condition)
.place­(qu­ery­OrNode, position)

DOM Traversal (dojo/­Nod­eLi­st-­tra­verse)

.child­ren­([q­uery])
.close­st(­[qu­ery], root)
.prevA­ll(­[qu­ery])
.paren­t([­query])
.andSelf()
.paren­ts(­[qu­ery])
.first()
.sibli­ngs­([q­uery])
.last()
.next(­[qu­ery])
.even()
.nextA­ll(­[qu­ery])
.odd()
.prev(­[qu­ery])

Requests (dojo/­req­uest)

reques­t.r­equ­est­(url, options);
reques­t.g­et(url, opts)
reques­t.p­ut(url, opts)
reques­t.(url, opts)
reques­t.p­ost­(url, opts)

Query string processing (dojo/­io-­query)

ioQuer­y.o­bje­ctT­oQu­ery­(qu­ery);
ioQuer­y.q­uer­yTo­Obj­ect­(qu­ery);
                                           

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi
 

Comments

thank you

this is awesome!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          jQuery Cheat Sheet
          Bacon.js Cheat Sheet