Fabio -- yeah i saw that method... but how would you invoke it within the adopt if you were creating a larger/more complex object?
On Jun 14, 12:06 pm, jacob <[email protected]> wrote: > Well... your example doesn't work:http://mootools.net/shell/CR3k5/1/ > > The text node comes before the image in your code (which isn't what it > should do...) the point is that you should be able to place the text > node relative to the other elements being adopted... > > this is what I want to do : > > http://mootools.net/shell/TtWRY/1/ > > but i just thought there might be a nicer way of doing it > thanks anyways > > On Jun 14, 11:53 am, 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? > >
