iframe (同じオリジン) 内で次の jQuery コードを使用して、ノードを iframe からメイン (トップ) ドキュメントに移動しようとしています。
var dest = $(window.top.document).find('#dest_id');
dest.append($('#source_id'));
以下は正常に動作します:
window.top.document.getElementById('dest_id').innerHTML = document.getElementById('source_id').innerHTML;
フレーム間での DOM ノードの移動には制限があると思います。プレーンjsまたはjqueryでこれを回避する方法はありますか?
編集:ownerDocument
プロパティと関係があるのでしょうか?on #dest_idに変更しようとしwindow.top.document
ましたが、うまくいきませんでした。
編集、同様の質問: Can't appendChild to a node created from another frame