Prototype: make new insertion syntax work again on Ajax.Updater

This commit is contained in:
Thomas Fuchs 2007-06-02 16:32:43 +00:00
parent 5f4bab4dcb
commit ae8d11d819
2 changed files with 10 additions and 2 deletions

View File

@ -260,8 +260,10 @@ Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
if (receiver = $(receiver)) {
if (options.insertion) {
if (typeof options.insertion == 'string')
receiver.insert( {}[options.insertion] = response );
if (typeof options.insertion == 'string') {
var insertion = {}; insertion[options.insertion] = response;
receiver.insert(insertion);
}
else options.insertion(receiver, response);
}
else receiver.update(response);

View File

@ -107,6 +107,12 @@
new Ajax.Updater("content", "fixtures/content.html", { method:'get', insertion: 'bottom' });
wait(1000,function(){
assertEqual(sentence, $("content").innerHTML.strip().toLowerCase());
$('content').update();
new Ajax.Updater("content", "fixtures/content.html", { method:'get', insertion: 'after' });
wait(1000,function(){
assertEqual('five dozen', $("content").next().innerHTML.strip().toLowerCase());
});
});
});
}},