Skip to content

Commit

Permalink
We no longer wait for <iframe> elements that have already finished …
Browse files Browse the repository at this point in the history
…loading
  • Loading branch information
triskweline committed Jun 21, 2024
1 parent 2ec2a86 commit 9728a3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html

- We now only wait for `<script>` elements with a JavaScript type
- We only wait for `<iframe>` elements with a `[src]` attribute
- We no longer wait for `<iframe>` elements that have already finished loading


# 2.2.1
Expand Down
7 changes: 6 additions & 1 deletion lib/capybara-lockstep/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,12 @@ window.CapybaraLockstep = (function() {
function isTrackableIFrame(element) {
return element.matches('iframe[src]') &&
!hasDataSource(element) &&
element.getAttribute('loading') !== 'lazy'
element.getAttribute('loading') !== 'lazy' &&
!hasIFrameFinishedLoading(element)
}

function hasIFrameFinishedLoading(element) {
return element.contentDocument && element.contentDocument.readyState === 'complete'
}

function isTrackableScriptType(type) {
Expand Down

0 comments on commit 9728a3b

Please sign in to comment.