Fabio, I saw that method - but it doesn't work from within an adopt if the element you want to append text to isn't in the dom yet -- i'll just stick to this.getDocument().newTextNode(text) (which is essentially what append text is doing)... i'm just surprised no one else runs into this... i run into it all the time and have to do little hacky work arounds.
On Jun 14, 11:59 am, Fábio M. Costa <[email protected]> wrote: > There's the appendText function. > > http://mootools.net/docs/core/Element/Element#Element:appendText > > -- > Fábio Miranda Costa > Solucione Sistemas > Engenheiro de interfaces > Twitter: fabiomirandahttp://solucione.info > > On Mon, Jun 14, 2010 at 3:53 PM, André Fiedler <[email protected] > > > wrote: > > 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? > >
