So mootools has to check if it´s a string on every adopt. this slows things
down... it´s really not necessary.

new Element('a',{
     'class': 'addButton',

     'text':  'your text would go heereee...'

   }).adopt(
     new Element('img',{
       'src': '/images/ms_add.png'
     }),
 );


2010/6/14 jacob <[email protected]>

> I always want to do something like this... but haven't come up with a
> good way to do it:
>
>    new Element('a',{
>      'class': 'addButton'
>    }).adopt(
>
>      new Element('img',{
>        'src': '/images/ms_add.png'
>      }),
>
>      'some text would go heereee...'
>
>  );
>
>
> i know you can do: this.getDocument().newTextNode('some text would go
> heereee..') -- but what do you think about extending adopt/grab/inject/
> etc. to interpret strings as text nodes? or adding a new
> Element('text') ... or something?

Reply via email to