Check if parentNode exists

We need to check if parentNode exists, as in some scenarios it does not (e.g. phantomjs < 2)
This commit is contained in:
DanielApt 2015-03-27 16:58:10 +00:00
parent 4a7f27356a
commit 633f1f53d3

View File

@ -70,6 +70,6 @@ exports.remove = function (element) {
if (typeof element.remove !== 'undefined') { if (typeof element.remove !== 'undefined') {
element.remove(); element.remove();
} else { } else {
element.parentNode.removeChild(element); element.parentNode && element.parentNode.removeChild(element);
} }
}; };