Adding DOMAssistant to PURE

2 views
Skip to first unread message

tchvil

unread,
Sep 16, 2008, 4:09:20 PM9/16/08
to DOMAssistant
Hi,
We developed a template tool to generate HTML from JSON data, client
side.
It is fast and keeps the HTML and the JS logic totally separated.
More information is available at http://github.com/pure/pure/wikis

Today it works only with jQuery, and should work with frameworks that
implement selectors.

Is there anyone interested in helping us to add some DOMAssistant
methods?
This should be roughly 15-20 lines of easy code for someone with the
knowledge of DOMAssistant.

Mainly:
- how to detect DOMAssistant is available in a page
- Integrate the DOMAssistant selector function as the "pure.find"
method
- and build a DOMAssistant way of the "pure.render" and
"pure.autoRender" methods

For inspiration, the jQuery implementation is available at the bottom
of the pure.js file.
You can download it with the master zip/tar at http://github.com/pure/pure/downloads/master

Thanks,
Mic

Robert Nyman

unread,
Sep 19, 2008, 4:25:41 AM9/19/08
to domass...@googlegroups.com
Hi Mic,

Thanks for the information!
We will need to consider if we can do this, and get back to you a bit later on.


Best regards,
Robert

chenghong

unread,
Sep 21, 2008, 12:04:51 AM9/21/08
to DOMAssistant
Hi Mic,

I have written a DOMAssistant implementation, you can view it at
http://www.domassistant.com/demos/pure.js

Note that I have also made changes to the following line for PURE to
work properly with DOMAssistant. The change would not affect other
libraries:

aJS.push('for(var '+currentLoop+'Index in '+currentLoop+'){if (typeof
'+currentLoop+'['+currentLoop+'Index] === \'function\') continue;');

In your allExamples.js however, you have used some jQuery-specific
methods that DOMAssistant currently do not support, like .getJSON()
and .html(). As a result, only example 1, 2, 3 and 6 works with DA.

Hope this helps!


Best regards,
Cheng Hong


On Sep 17, 4:09 am, tchvil <tch...@gmail.com> wrote:
> Hi,
> We developed a template tool to generate HTML from JSON data, client
> side.
> It is fast and keeps the HTML and the JS logic totally separated.
> More information is available athttp://github.com/pure/pure/wikis

Mic Cvilic

unread,
Sep 21, 2008, 3:09:17 PM9/21/08
to domass...@googlegroups.com, Pure-Unobtrusive...@googlegroups.com
Hi Cheng Hong,

Thank you so much for your quick and exhaustive answer.

Now the ball is in our camp for:

- integrate your code in the git repo
- check why you had to modify this line of code
- see if we can change the examples to make them working with
DOMAssistant too

When done or if I have any big issue I'll contact you.
Cheers,

chenghong

unread,
Sep 22, 2008, 11:15:43 AM9/22/08
to DOMAssistant
Hi Mic,

I've ported examples 4 and 5 to DOMAssistant. You can find the code
at

http://www.domassistant.com/demos/pure/docs/allExamples.html


Cheers,
Cheng Hong

Mic Cvilic

unread,
Sep 22, 2008, 12:19:43 PM9/22/08
to domass...@googlegroups.com, Pure-Unobtrusive...@googlegroups.com
Hi Cheng Hong,

I'm impressed.
I tested it through all my browsers, from Chrome to iPhone, it works and fast.
It looks even faster than with jQuery I'll make some more serious speed tests.

Could you tell me what was the error that made you change the line below in pure.js ?
aJS.push('for(var '+currentLoop+'Index in '+currentLoop+'){if (typeof '+currentLoop+'['+currentLoop+'Index] === \'function\') continue;');

Thanks a lot for this material.
Cheers,

chenghong

unread,
Sep 23, 2008, 4:45:30 AM9/23/08
to DOMAssistant
Hi Mic,

I think it has to do with the way DOMAssistant patches HTMLArray
prototype due to IE's inadequacy. As a result, looping through element
properties in IE returns some unexpected function objects.


Cheers.

tchvil

unread,
Sep 29, 2008, 7:31:07 AM9/29/08
to DOMAssistant
Hi Cheng Hong,
Do you think that replacing the:

for (var item in items )

by a

for (var i = 0; i < items.length;i++)

could do the trick?
Thanks,

Mic

tchvil

unread,
Sep 30, 2008, 6:15:20 AM9/30/08
to DOMAssistant
hi Cheng Hong,
Replacing the for(...), as described above, works with the 6 examples
provide so I guess it works.
Cheers,

chenghong

unread,
Sep 30, 2008, 8:08:43 AM9/30/08
to DOMAssistant
Yeah that would work too. Cheers!

Yves (BeeBole)

unread,
Oct 2, 2008, 7:13:56 AM10/2/08
to DOMAssistant
Hi Cheng Hong,

We just made a small post on BeeBuzz about PURE working with
DOMAssitant :

http://beebole.com/blog/2008/10/02/our-javascript-template-pure-becomes-cross-library/

I have to thank you again for your great effort.

Speak to you soon.

Cheers
Reply all
Reply to author
Forward
0 new messages