Yes definitely use the data attributes.

Basically what I've been experimenting with is to have an init() method that is 
called on page load. It scans the dom looking for elements of "AjaxJQ" class, 
reads the component type from one data attribute and inits it with params from 
another data attribute.

If the init is called with no parameters it scans ("inits") the entire dom. If 
it is called with an id it restricts it self to scanning that id. So when you 
are finished updating a specific area, you call init("theAreaID") to init any 
bits that have changed. This is built in to each component that modifies the 
dom.

There are libraries that will look for changes in the dom and allow you to 
respond accordingly, but they all have performance issues when the dom gets 
big. Handling it manually and targeting the areas that you know have changed is 
a little more fragile (i.e: you could forget to scan something after a change) 
but less likely to degrade as your dom gets more complicated, and easier to 
understand (i.e: less magic).

I've also begun playing with a standard set of delegate methods that are called 
at specific points (before update, after update, etc) so you can expand the 
behaviour as you need to.

This means that all of your js can live in the head, and all of the params are 
supplied in the data attributes, and you have no js cluttering your html.

D

--
David LeBer
Codeferous Software

On 2013-05-09, at 6:19 PM, Johnny Miller <jlmil...@kahalawai.com> wrote:

> Hi Pascal,
> 
> I started working on a JQuery framework and I'm up to one component!
> 
> You can see it here: http://www.kahalawai.com/JQuery
> 
> I'm pretty busy but I think I could make one component a day.  I was 
> wondering what people thought about a couple of questions I have:
> 
> 1. Should I use data attributes?  One thing I would like to do is not pollute 
> the HTML with JavaScript code.  Now with my first example (the periodical 
> updater) I'm not sure if that's possible i.e. When the page loads I can find 
> the ajax update containers but what about an ajax update container that is 
> returned from an ajax request?  But for a lot of the other components like 
> ajax update link I could just register a trigger using the data attributes.
> 
> 2. Should I tie the framework to a look like JQueryUI or Bootstrap?  Some of 
> the components like date pickers and modal containers need a default styling. 
>  
> 
> Do you think I should keep on keeping on or has somebody already developed a 
> framework they are about to release or is there a new better idea?
> 
> Aloha,
> Mr. Johnny Miller
> Web Development Manager
> Kahalawai Media Company
> Lahaina, HI 96761
> tel: (808) 661-7962 | mobile: (808) 283-0791
> website | e-mail      
> 
> On Apr 6, 2013, at 1:41 PM, Larry Mills-Gahl <elem...@gmail.com> wrote:
> 
>> There was some talk about directing some new development effort toward 
>> jQuery in Wonder.
>> I've been working on some bits in this framework and am coming to realize 
>> that there are some organizational issues that could go a couple of 
>> different directions and I was wondering if there are any forks out there 
>> that are working on this that I might pull from and contribute to.
>> 
>> Among the questions that might benefit from some planning are about multiple 
>> frameworks and dependencies. Specifically, the ERJQueryMobile framework has 
>> jQuery javascript resources and so does the ERJQuery framework (and 
>> potentially ERJQueryUI if we decide to separate jQuery from jQuery-UI … 
>> which is probably a good idea. Since mobile and UI both depend on jQuery, 
>> would it make sense to load those from ERJQuery and update the version 
>> handling so that one could load whatever version of jQuery you need. 
>> Essentially, making some loader classes in ERJQuery able to load the right 
>> version from local resources or a CDN depending on the need. 
>> 
>> Anyway… there are a few design decisions that will affect how the 
>> framework(s) interact and I wanted to know who else out there had done work 
>> on this that I might contribute to.
>> 
>> Thanks.
>> 
>> 
>> Larry Mills-Gahl
>> elem...@gmail.com
>> 
>> 
>> 
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> Minimize network downtime and maximize team effectiveness.
>> Reduce network management and security costs.Learn how to hire 
>> the most talented Cisco Certified professionals. Visit the 
>> Employer Resources Portal
>> http://www.cisco.com/web/learning/employer_resources/index.html_______________________________________________
>> Wonder-disc mailing list
>> wonder-d...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com
> 
> This email sent to dleber_wo...@codeferous.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to