Mochikit seems to be getting a lot of requests like these (may of them
from myself). As Bob has previously pointed out, making functions do
different things is bad so in this case a new function would be
better, buuut...
I think there is no need in this case since one can always do this:
map(removeElement, elements);
Maybe someone needs to come up with the Zen of Mochikit. :o)
Arnar
On 2/11/07, Aaron Faanes <[EMAIL PROTECTED]> wrote:
>
> should removeElement have the ability to remove multiple elements?
>
> /** @id MochiKit.DOM.removeElement */
> removeElement: function (elem) {
> if(elem instanceof Array) {
> for(var i=0;i<elem.length; i++) {
> MochiKit.DOM.removeElement(elem[i]);
> }
> return;
> }
> var e = MochiKit.DOM.getElement(elem);
> e.parentNode.removeChild(e);
> return e;
> },
>
>
> or, alternatively:
>
> /** @id MochiKit.DOM.removeElement */
> removeElement: function (elem) {
> if(arguments.length > 1) {
> for(var i=0;i<arguments.length; i++) {
> MochiKit.DOM.removeElement(arguments[i]);
> }
> return;
> }
> var e = MochiKit.DOM.getElement(elem);
> e.parentNode.removeChild(e);
> return e;
> },
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---