Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@ var log = function( msg ) {
},
// function to remove elements, input as arrays
removeElements = function( remove ) {
for (var i = 0, len = remove.length; i < len; i++ ) {
var item = Array.prototype.pop.call( remove );
if ( item !== undefined ) {
if (item.parentNode !== null ) { // check that the item was actually added to DOM
item.parentNode.removeChild( item );
if (!Array.isArray(remove)) {
Array.prototype.forEach.call(
remove,
function (index, item) {
if (item !== undefined) {
if (item.parentNode !== undefined) {
item.parentNode.removeChild(item);
}
}
}
);
return;
}

var item;
for (; item = Array.prototype.pop.call(remove);) {
if (item !== undefined) {
if (item.parentNode !== null) { // check that the item was actually added to DOM
item.parentNode.removeChild(item);
}
}
}
Expand Down