OH even worse! I posted in the wrong thread!

This wasn't about the question or the answer - my fault for having thirty
tabs open! :-D

-keif


keif wrote:
> 
> Why don't you all get off that guy's back?
> 
> He's obviously a genius that none of you idiots can understand.
> 
> 
> ....done laughing yet?
> 
> I'm not going to waste time arguing with an idiot, because he'll just
> bring me down to his level and beat me with years of experience.
> 
> As a comment on it though, the harshness he takes towards anything that
> isn't his makes it an automatic write off, IMO.
> 
> So I ask you all - let the guy run on and burn off his fumes. There's no
> reason to stoke his fire, all it'll do is make mootools fans look bad by
> reaming people who refuse to actually optimally test instead of crapping
> results onto a page.
> 
> (that being said, I'm not accusing anyone of giving him the finger, I'm
> just saying, if you feel you should leave a comment along the lines of
> "mootools rox u sux" please don't).
> 
> okay? okay.
> 
> -keif :-)
> 
> 
> loki der quaeler wrote:
>> 
>> 
>> 
>> you'll want your class to implement a method called toElement which  
>> returns the Element instance which you'd like inserted in the DOM  
>> (this.button in your class example below).
>> 
>> once it implements this method you can refer to an instance wrapped  
>> by the $ function to have access to the instance's Element. in other  
>> words:
>> var myButton = new Button();
>> var domElement = $(myButton);
>> 
>> odd: you can really have the javascript
>>      (new Button()).inject(document.body);
>> executed with the Button class described below, and receive no  
>> javascript error?
>> 
>> 
>> On Sep 12, 2008, at 4.27 PM, Luca Pillonel wrote:
>> 
>>>
>>> I have a class creating elements. I.E.
>>>
>>> var Button = new Class({
>>>     initialize : function(){
>>>             this.button = new Element('div', {html : 'my button'});
>>>             return this.button;
>>>     },
>>>     setContent : function(content){
>>>             this.button.set('html', content);
>>>     }
>>> });
>>>
>>> So i can create an element in my DOM like this :
>>> var myButton = new Button().inject(document.body);
>>>
>>> But how can I make
>>> myButton.setContent('some new content');
>>> ?
>>>
>>> Thank you
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/can-a-class-return-both-himself-and-an-element--tp1085143p1086611.html
Sent from the MooTools Users mailing list archive at Nabble.com.

Reply via email to