0

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 変数の割り当ての前に常に実行されます。

4

1 に答える 1

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
于 2012-06-10T09:58:02.143 に答える