@perrin: Yeah that works ok for one element... but it's kinda hackish and not really great for larger dom constructions
On Jun 14, 12:23 pm, Perrin Perrin <[email protected]> wrote: > If you are just inserting one element and text just use grab with a position > specifier. > > http://mootools.net/shell/TtWRY/2/ > > 2010/6/14 Fábio M. Costa <[email protected]> > > > The problem is that this function works with ids too. If you pass a string > > it interprets it as an id of an element. > > Yeah, first time i've heard someone needing this. > > Thanks for your feedback. > > > -- > > Fábio Miranda Costa > > Solucione Sistemas > > Engenheiro de interfaces > > Twitter: fabiomiranda > >http://solucione.info > > > On Mon, Jun 14, 2010 at 4:13 PM, jacob <[email protected]> wrote: > > >> 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? > >
