jquery队列序列更新xml

时间:2012-06-10 09:20:03

标签: jquery xml queue

我正在基于xml的UI中开发undo / redo功能,使用JQuery i加载,读取和更新xml节点。

undo_xml=actual_xml;                     //save the actual xml state before to update it,
$(this).attr("xmlattribute",newvalue);   //update a specific node with a new value
redo_xml=actual_xml;                     //save the updated xml as the redo state

问题是指令$(this).attr("xmlattribute",newvalue);始终在undo_xml=actual_xml之前运行,因此我从不根据需要记录undo_xml

我尝试了$.queue()jquery.stackevent()以及许多其他方式。

但是,

$(this).attr("xmlattribute",newvalue);

始终在xml var赋值之前运行。

1 个答案:

答案 0 :(得分:0)

我自己找到了解决方案,这不是序列问题,而是资源问题。

我希望这对你有所帮助。

undo_xml=$(actual_xml).clone();          //save the actual xml state before to update it,
$(this).attr("xmlattribute",newvalue);   //update a specific node with a new value
redo_xml=$(actual_xml).clone();          //save the updated xml as the redo state