1 parent 14461fe commit 87320c5Copy full SHA for 87320c5
2 files changed
src/index.js
@@ -26,7 +26,7 @@ var bcsrf = {
26
27
// remove injected nodes
28
toArray(document.querySelectorAll('[name="' + this._headerName + '"]'))
29
- .forEach(function (node) { node.remove() })
+ .forEach(function (node) { node.parentNode.removeChild(node) })
30
31
// restore wrapped xhr
32
XMLHttpRequest.prototype.send = this._xhrSend
test/index.js
@@ -36,6 +36,9 @@ tape('inject', function (t) {
36
if (handled) return // concurrent xhrs may creep in here. just sniff one
37
handled = true
38
t.equal(this.status, 0, 'intercepted xhr')
39
+
40
+ // teardown
41
+ stub.restore()
42
this.abort()
43
bcsrf.deinject()
44
t.pass('teardown')
0 commit comments