Wee. This is very well done. Thanks martin and please submit this. It's lovely

On 2/5/07, Martin Str�m <[EMAIL PROTECTED]> wrote:
>
> I was just about to submit a patch to trac so instead I bring it up
> here for discussion.
> Since we already have the Builder in script.aculo.us I don't think is
> necessary to bring an advanced builder into core. I've been using this
> code in my recent project and it is lightweight and reads out very
> well.
>
> First we add Element.writeAttributes (or whatever it should be named
> but since we already have readAttribute I thought this name should
> match) to let chaining works when settings an element's attribute(s):
>
> Element.addMethods({
>         // ...
>         writeAttributes: function(element, properties) {
>                 element = $(element);
>                 for (var property in properties)
>                         element[property] = properties[property];
>                 return element;
>         },
>         // ...
> });
>
> Then replace the current:
> var Element = new Object();
>
> with something like:
>
> function Element(tagName, options) {
>         return 
> Element.extend(document.createElement(tagName)).writeAttributes(options
> || {});
> }
>
> This way it would be really easy to create new elements when you don't
> need the full functionallity from Builder with all it's fixes and
> tweaks:
>
> var myHeader = new Element('div', {id: 'header'});
> $('container').appendChild(myHeader);
>
> What do you think? I would happily provide a patch with tests if you
> like this approach.
>
> Btw, is there any way to view Sam's proposition for us without account
> on the rails basecamp site?
>
> On 2/3/07, Tobie Langel <[EMAIL PROTECTED]> wrote:
> >
> > Sam's proposition for changing element update (see basecamp: http://
> > rails.updatelog.com/projects/279620/msg/cat/1905466/3314374/comments)
> > doubles the functionality of a DOM builder IMO.
> >
> >
> >
> >
> > >
> >
>
>
> --
> burnfield.com/martin
>
> >
>


-- 
Regards, Kjell
www.m3nt0r.de

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to