Do not crash if element to remove is not found
This commit is contained in:
parent
d61db76039
commit
adb6255d5d
1 changed files with 1 additions and 1 deletions
|
@ -53,7 +53,7 @@ module ApplicationHelper
|
|||
script = "(function() {";
|
||||
script << "var el = document.querySelector('#{selector}');"
|
||||
method = (inner ? "el.innerHTML = ''" : "el.parentNode.removeChild(el)")
|
||||
script << "setTimeout(function() { #{method}; }, #{timeout});";
|
||||
script << "if (el) { setTimeout(function() { #{method}; }, #{timeout}); }";
|
||||
script << "})();"
|
||||
# rubocop:disable Rails/OutputSafety
|
||||
raw(script);
|
||||
|
|
Loading…
Reference in a new issue