[Dojo-interest] Dojo without dojo special tag attribs

Dustin Machi dmachi at sitepen.com
Thu Aug 7 14:04:47 UTC 2008


I think you are confusing/overlapping dojo (which is comparable to 
jQuery) and Dijit, which is the widget library written with Dojo.  You 
can use dojo in almost the exact same way/syntax as jquery if you like.  
dojo.query(".foo").forEach().... that kind of thing.

Michał Zieliński wrote:
> Thanks Peter for all the info.
> It seems to be enough for me to start and get into Dojo world, hopefully ;)
>
> I used to work with jQuery which I fount very useful and easy to  quick
> adoption. It`s just simple and powerfull.
> To be honest, Zend Framework and its Dojo built-in component is the thing
> why I decided to give dojo another chance. When I looked first at dojo
> examples I fount it strange, ugly and complicated. That`s why I decided to
> look for another js lib in the past. I wonder how many people react similar.
>
> I like tidy html so I`m glad that you consider to extend docs with some
> examples for guys like me ;)
>
> Regards,
> Mike
>
>
>
> Peter E Higgins-2 wrote:
>   
>> Michał Zieliński wrote:
>>     
>>> Hi.
>>>
>>> I`m new to Dojo and I`d like to play with it a bit more.
>>> I like simplicity and don`t like mess in HTML code. Simple tags with ids
>>> or
>>> classes should be enough to write javascript stuff. Dojo needs some
>>> special
>>> atrribs in HTML tags. I read in manual that there is an option to use
>>> Dojo
>>> without this attribs. 
>>>
>>>   
>>>       
>> Nope, the dojoType attribute is optional.
>>
>> <div dojoType="dijit.TitlePane" id="myTitlePane" 
>> title="Wonderbar!">Content</div>
>>
>> can be expressed without the parser like:
>>
>> new dijit.TitlePane({ title:"Wonderbar" }, "myTitlePane");
>> <div id="myTitlePane">Content</div>
>>
>>     
>>> Could you please tell me if the is any tutorial/article/note which
>>> describes
>>> more precisely how to achive clean HTML cooperates with Dojo?
>>> It would be nice to have some examples.
>>>
>>>   
>>>       
>> The first couple examples come to mind:
>> http://higginsforpresident.net/2008/08/dojo-degradability/
>> http://turtle.dojotoolkit.org/~dante/skewDemo/demo.html (mostly valid 
>> html, new version is, but not published yet)
>> http://turtle.dojotoolkit.org/~dante/dojo.moj.oe/mojo.html (same case, 
>> just not published since update)
>>
>> It is an aim of the new doc system to provide more copy/pastable 
>> programmatic examples. They currently exist as tests within the tests 
>> with the dojoTypes, so they are hard to spot sometimes (they don't stand 
>> out, because, well, they look like regular html ;) )
>>     
>>> (I don`t want to start discussion on standards, W3C, DTD, Validation,
>>> etc.
>>> It is my way of coding, the less the better and please don`t argue with
>>> this
>>> ;))
>>>
>>>   
>>>       
>> No worries ... We have to do a lot of testing, and know the dojoType 
>> works ... it is TONS easier to offload the heavy lifting of creation 
>> onto the dojo.parser when we get into repetitious use cases, "add 
>> another example testing this tag", etc ...
>>     
>>> Regards,
>>> Mike
>>>   
>>>       
>> Zend Framework offers dual declarative and programmatic options, and the 
>> way they pull it off is actually quite clever ... I have been meaning to 
>> write up a blog or something describing it, but the summary is:
>>
>> keep a global object hash of id->widget props, onLoad, use dojo.attr() 
>> to decorate the nodes with the invalid tags, then run the parser 
>> immediately after ... the code is like 3 lines:
>>
>> var dijitsInPage = [{ id:"foo", type:"dijit.TitlePane, title:"Hi!" }];
>> dojo.forEach(dijitsInPage, function(comp){
>>        var n = dojo.byId(comp['id']);
>>        dojo.attr(n, comp);
>> });
>> dojo.parser.parse();
>>
>> Because validity one counts on initial page load ...
>>
>> Hope this helps,
>>
>> Regards,
>> Peter Higgins
>>
>>
>>
>> _______________________________________________
>> FAQ: http://dojotoolkit.org/support/faq
>> Book: http://dojotoolkit.org/docs/book
>> Forums: http://dojotoolkit.org/forum
>> Dojo-interest at dojotoolkit.org
>> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest
>>
>>
>>     
>
>   


More information about the Dojo-interest mailing list