Skip to content

Commit 87320c5

Browse files
committed
fix(pkg): xbrowser node removal
1 parent 14461fe commit 87320c5

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var bcsrf = {
2626

2727
// remove injected nodes
2828
toArray(document.querySelectorAll('[name="' + this._headerName + '"]'))
29-
.forEach(function (node) { node.remove() })
29+
.forEach(function (node) { node.parentNode.removeChild(node) })
3030

3131
// restore wrapped xhr
3232
XMLHttpRequest.prototype.send = this._xhrSend

test/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ tape('inject', function (t) {
3636
if (handled) return // concurrent xhrs may creep in here. just sniff one
3737
handled = true
3838
t.equal(this.status, 0, 'intercepted xhr')
39+
40+
// teardown
41+
stub.restore()
3942
this.abort()
4043
bcsrf.deinject()
4144
t.pass('teardown')

0 commit comments

Comments
 (0)