Oracle Magazine Special offer for AjaxImpact.com Visitors!! Subscribe to Oracle Magazine for Free!
AJAX IMPACT



AJAX NEWS
Dollar E: A document.createElement Wrapper on Prototype
03/30/2006, By Ajax Impact News



Over the Arantius.com Anthony Lieuallen has posted an wrapper for document.createElement to create an UI element on your page that made use of Ajax. He have used Prototype JavaScript library as base to write this wrapper.

He writes "The primary new feature ( from my perspective ;-) ) was a brand new UI that made use of AJAX, which I built on top of the Prototype JavaScript library. There was a lot of dynamic element creation based on the data coming back from the AJAX calls, and thus a lot of document.createElement calls, along with the appendChild and insertBefore and the element-property-setting statements. It's very verbose.

At one point early on, I decided to write a wrapper function for document.createElement to avoid typing that out so often, and ended up realizing I should reduce more typing by figuring out a way to pass in attributes like the class and ID to be set. And then I realized, and it feels obvious in retrospect, that it should be able to handle creating a whole tree. I'm sure I'm not the first person to think of this, or even to write such a function. But I have found this to be very useful, and so after getting permission to do so from my company, I came here to release it as open source."

Anthony have named this wrapper as function $E() or "Dollar E". As he saw that it is the reverse of the $() function in prototype. The $() function gets an element that exists, the $E() function creates a new element that doesn't. It is passed a custom data structure, and it returns a (tree of) DOM element(s).

You can check out the sample source code and an example, and the HTML string produced by running the example also.

Sponsered Link:

   Explore It...


 Rate this Ajax News
 Rating: 0.0 out of votes cast

AJAX NEWS
04/01/2007 wxJavaScript : porting wxWidgets to JavaScript.
03/31/2007 DED|Chain - The web developers JavaScript Kit
03/30/2007 Clipperz Crypto Library - a JavaScript library of crypto primitives
03/28/2007 ETech - AJAX Unplugged Slides
03/27/2007 Stripe Generator: ajax powered web 2.0 tool!
03/26/2007 Finally Microsoft joins the OpenAjax Alliance


INDUSTRY NEWS
05/19/2006 Ajax grabs center stage at JavaOne, By Tony Baer
05/15/2006 Oracle to boost AJAX, Java , By Paul Krill
05/13/2006 Open AJAX Group Drafts Development Plans, By Stacy Cowley
05/13/2006 AJAX Powers Interactive Marketing ASP, By AjaxWorld News Desk
05/12/2006 AJAX Experts Tackle Security, Other Issues , By Darryl K. Taft
05/11/2006 Adobe Releases Spry Framework for AJAX, By AjaxWorld News Desk
More 
       

      © 2008 ajaximpact.com. All rights reserved.