Element#insert taking multiple contents

25 views
Skip to first unread message

Ngan Pham

unread,
Nov 5, 2009, 3:53:30 PM11/5/09
to Prototype: Core
Would it be reasonable to implement it so that Element.insert takes as many content as you pass it?  This will exclude insertion points of course...

container.insert(part1);
container.insert(part2);
container.insert(part3);

would be:

container.insert(part1, part2, part3);

Thanks.

Радослав Станков

unread,
Nov 6, 2009, 8:05:53 AM11/6/09
to Prototype: Core
I had made a list of useful Element#insert goodies here -
http://gist.github.com/164751
There was a ticket for this
https://prototype.lighthouseapp.com/projects/8886/tickets/752-elementinsert-to-accept-array-as-insertions-option#ticket-752-4
but as far I understand major changes to Element.insert are planed for
2.0 versio, so for now I use this functionality as a plugin

Deadelus

unread,
Nov 6, 2009, 2:54:07 AM11/6/09
to Prototype: Core
Probably easier to implement using an Array:

container.insert({
top: [part1, part2, part3],
bottom: [part4, part5],
after: "<p>Hello World</p>"
});

Mike Rumble

unread,
Nov 7, 2009, 6:22:22 PM11/7/09
to Prototype: Core
Agreed. Have often thought that this would be a useful addition.

Element.insert(part1, part2, part3)

and

Element.insert({
top : [part1, part2, part3]
);

should both be able to be implemented without too much hassle and
would provide some really valuable functionality - let's make it
happen!

Mike.
Reply all
Reply to author
Forward
0 new messages