JQueryを使用してxmlベースのUIで元に戻す/やり直し機能を開発しています.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 変数の割り当ての前に常に実行されます。