Can you implement things on particular elements only? Or do you have to check the type of element in the implements function and deal with it there?
Steve
Like if i only want to implement something on a table element for example
Thats what i have been doing but i thought i would ask the question anyway
If you plan to use document.id() everywhere (thus assuming no extended natives at all) you could add the tagName check inside the wrapper and then make it seem transparent to the outside. This, too, is a waste of time IMO. Just use get('tag') if you want this feature to be compatible with all Moo-supported browsers.
-- Sandy
Select.style()
Input.style()
Radio.style()
And so on but i will most likely have to do it a different way
-----Original Message-----
From: Sanford Whiteman [mailto:sa...@cypressintegrated.com]
Sent: Friday, 15 July 2011 3:28 PM
To: mootool...@googlegroups.com
Subject: Re: [Moo] Element.implement
var el = $('el');el.whatev = function (){};
Even when browsers allow you to extend the subinterfaces of HTMLElement, you are still restricted to the standard subinterfaces. So you can't extend radios or checkboxes separately, and you shouldn't even expect to extend <EM> and <STRONG> or even <SPAN> tags individually, since per the DOM specs, all these hang directly off the generic HTMLElement.
In sum, even in cutting-edge browsers, you may have to check the current element's tag and/or type before continuing, so for simplicity you might as well extend the whole Element. I'd guess that with a _extremely_ high ratio of uninteresting elements to your "interesting" elements, you might actually see that extending, say, just HTMLInputElement would be faster at runtime, but it's unlikely to be worth it.
-- S.
$$("input[type=radio]").implement({
style : function () {}
});
Is what i was hoping to be able to do
-----Original Message-----
From: Sanford Whiteman [mailto:sa...@cypressintegrated.com]
Clone it / download it, pop open Demos/index.html
https://github.com/rpflorence/mootools-custom-form