diff options
Diffstat (limited to 'tests/frontend')
-rw-r--r-- | tests/frontend/specs/drag_and_drop.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/frontend/specs/drag_and_drop.js b/tests/frontend/specs/drag_and_drop.js index bcec0bd2..821d3aac 100644 --- a/tests/frontend/specs/drag_and_drop.js +++ b/tests/frontend/specs/drag_and_drop.js @@ -154,7 +154,15 @@ describe('drag and drop', function() { var $target = getLine(targetLineNumber); $target.sendkeys('{selectall}{rightarrow}{leftarrow}'); - // insert content - innerDocument.execCommand('insertHTML', false, draggedHtml); + // Insert content. + // Based on http://stackoverflow.com/a/6691294, to be IE-compatible + var range = innerDocument.getSelection().getRangeAt(0); + var frag = innerDocument.createDocumentFragment(); + var el = innerDocument.createElement('div'); + el.innerHTML = draggedHtml; + while (el.firstChild) { + frag.appendChild(el.firstChild); + } + range.insertNode(frag); } }); |