We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
あるスタンザから別のスタンザの内容を更新する機能(スタンザの相互連携機能)の実現で、スタンザタグの属性値を変更する方法をncgcさんに教えていただいたのですが、 nsgc/ts_provider@master...update-actions この方法だと、複数のパラメータを変更したい場合に、スタンザ更新イベントも複数回発生してしまい、意図しない結果になりました。
//値が変更されている個数分だけイベントが発生する $("togostanza-protein_compound").attr({ 'up_id': params.up_id, 'standard_type': standard_type});
そこで属性変更ではなく、スタンザタグを置換(削除&作成)する方法を考えましたが、こちらもcreateElementで要素を組み立てる段階及び各属性追加の度にイベントが発生しました。
//createElement, setAttribute毎に、計3回イベントが発生する var stanza_elem = element = document.createElement('togostanza-protein_compound'); stanza_elem.setAttribute('up_id', params.up_id); stanza_elem.setAttribute('standard_type', standard_type); //DOM追加処理(省略)
最終的にスタンザタグをHTMLテキストで編集してDOMのイベントを一回だけに抑えると、スタンザ更新イベントも一回だけしか発生しませんでした。
var stanza_elem = '<togostanza-protein_compound up_id="' + up_id + '" standard_type="' + standard_type + '"'></togostanza-protein_compound>' //置換 var current_elem = $("togostanza-protein_compound") current_elem.before(stanza_elem); current_elem.remove();
一つの属性値変更であれば問題ないのですが、複数指定した場合に予期しない挙動になるので(気付きにくい)、特に決まった用途がなければ属性変更によるスタンザ更新イベントは無くてもいいかと思いました。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
あるスタンザから別のスタンザの内容を更新する機能(スタンザの相互連携機能)の実現で、スタンザタグの属性値を変更する方法をncgcさんに教えていただいたのですが、
nsgc/ts_provider@master...update-actions
この方法だと、複数のパラメータを変更したい場合に、スタンザ更新イベントも複数回発生してしまい、意図しない結果になりました。
属性値の更新
そこで属性変更ではなく、スタンザタグを置換(削除&作成)する方法を考えましたが、こちらもcreateElementで要素を組み立てる段階及び各属性追加の度にイベントが発生しました。
スタンザタグの置換(createElementでの作成)
最終的にスタンザタグをHTMLテキストで編集してDOMのイベントを一回だけに抑えると、スタンザ更新イベントも一回だけしか発生しませんでした。
スタンザタグの置換(HTMLテキストでの追加)
一つの属性値変更であれば問題ないのですが、複数指定した場合に予期しない挙動になるので(気付きにくい)、特に決まった用途がなければ属性変更によるスタンザ更新イベントは無くてもいいかと思いました。
The text was updated successfully, but these errors were encountered: