Revert back to using document._importNode() for ajax posting

This commit is contained in:
Zach Copley 2011-04-27 19:31:27 -07:00
parent e1d36eae2d
commit b6ed694995
2 changed files with 9 additions and 9 deletions

View File

@ -273,15 +273,14 @@ var SN = { // StatusNet
}, },
success: function(data, textStatus) { success: function(data, textStatus) {
if (typeof($('form', data)[0]) != 'undefined') { if (typeof($('form', data)[0]) != 'undefined') {
var form_new = $('form', $(data).children()); var form_new = document._importNode($('form', data)[0], true);
form.replaceWith(form_new); form.replaceWith(form_new);
if (onSuccess) { if (onSuccess) {
onSuccess(); onSuccess();
} }
} }
else if (typeof($('p', data)[0]) != 'undefined') { else if (typeof($('p', data)[0]) != 'undefined') {
var p_new = $('p', $(data).children()); form.replaceWith(document._importNode($('p', data)[0], true));
form.replaceWith(p_new);
if (onSuccess) { if (onSuccess) {
onSuccess(); onSuccess();
} }
@ -503,11 +502,11 @@ var SN = { // StatusNet
success: function(data, textStatus) { success: function(data, textStatus) {
var results_placeholder = $('#profile_search_results'); var results_placeholder = $('#profile_search_results');
if (typeof($('ul', data)[0]) != 'undefined') { if (typeof($('ul', data)[0]) != 'undefined') {
var list = $('ul', $(data).children()); var list = document._importNode($('ul', data)[0], true);
results_placeholder.replaceWith(list); results_placeholder.replaceWith(list);
} }
else { else {
var _error = $('<li/>').append($('p', $(data).children())); var _error = $('<li/>').append(document._importNode($('p', data)[0], true));
results_placeholder.html(_error); results_placeholder.html(_error);
} }
form form
@ -537,12 +536,12 @@ var SN = { // StatusNet
success: function(data, textStatus) { success: function(data, textStatus) {
var results_placeholder = form.parents('.entity_tags'); var results_placeholder = form.parents('.entity_tags');
if (typeof($('.entity_tags', data)[0]) != 'undefined') { if (typeof($('.entity_tags', data)[0]) != 'undefined') {
var tags = $('.entity_tags', $(data).children()); var tags = document._importNode($('.entity_tags', data)[0], true);
$(tags).find('.editable').append($('<button class="peopletags_edit_button"/>')); $(tags).find('.editable').append($('<button class="peopletags_edit_button"/>'));
results_placeholder.replaceWith(tags); results_placeholder.replaceWith(tags);
} else { } else {
results_placeholder.find('p').remove(); results_placeholder.find('p').remove();
results_placeholder.append($('p', $(data).children())); results_placeholder.append(document._importNode($('p', data)[0], true));
form.removeClass(SN.C.S.Processing) form.removeClass(SN.C.S.Processing)
.find('.submit') .find('.submit')
.removeClass(SN.C.S.Disabled) .removeClass(SN.C.S.Disabled)
@ -694,7 +693,7 @@ var SN = { // StatusNet
nextStep(); nextStep();
} else { } else {
// Hide the placeholder... // Hide the placeholder...
var placeholder = list.find('li.notice-reply-placeholder').hide(); placeholder = list.find('li.notice-reply-placeholder').hide();
// Create the reply form entry at the end // Create the reply form entry at the end
var replyItem = $('li.notice-reply', list); var replyItem = $('li.notice-reply', list);
@ -713,6 +712,7 @@ var SN = { // StatusNet
if (SN.C.I.NoticeFormMaster) { if (SN.C.I.NoticeFormMaster) {
// We've already saved a master copy of the form. // We've already saved a master copy of the form.
// Clone it in! // Clone it in!
console.debug("we have a saved for, using it");
intermediateStep(SN.C.I.NoticeFormMaster); intermediateStep(SN.C.I.NoticeFormMaster);
} else { } else {
// Fetch a fresh copy of the notice form over AJAX. // Fetch a fresh copy of the notice form over AJAX.

2
js/util.min.js vendored

File diff suppressed because one or more lines are too long