lib/capybara/screenshot/diff/stabilization.rb in capybara-screenshot-diff-1.4.2 vs lib/capybara/screenshot/diff/stabilization.rb in capybara-screenshot-diff-1.5.0

- old
+ new

@@ -19,16 +19,16 @@ return false; }() JS HIDE_CARET_SCRIPT = <<~JS - if (!document.getElementById('csdHideCaretStyle')) { - let style = document.createElement('style'); - style.setAttribute('id', 'csdHideCaretStyle'); - document.head.appendChild(style); - let styleSheet = style.sheet; - styleSheet.insertRule("* { caret-color: transparent !important; }", 0); - } + if (!document.getElementById('csdHideCaretStyle')) { + let style = document.createElement('style'); + style.setAttribute('id', 'csdHideCaretStyle'); + document.head.appendChild(style); + let styleSheet = style.sheet; + styleSheet.insertRule("* { caret-color: transparent !important; }", 0); + } JS def take_stable_screenshot(comparison, stability_time_limit:, wait:) previous_file_name = comparison.old_file_name screenshot_started_at = last_image_change_at = Time.now