Skip to content

Commit

Permalink
Don't look at iframeElement.contentDocument.readyState -- This may be…
Browse files Browse the repository at this point in the history
… iframe's pending state (its initial children)
  • Loading branch information
triskweline committed Jun 21, 2024
1 parent 8650356 commit 466d73a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ 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
- We no longer wait for `<video>` and `<audio>` elements to load their metadata. This did not work consistently, and would sometimes cause capybara-lockstep to wait indefinitely.


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

function hasIFrameFinishedLoading(element) {
return element.contentDocument && element.contentDocument.readyState === 'complete'
element.getAttribute('loading') !== 'lazy'
}

function isTrackableScriptType(type) {
Expand Down

0 comments on commit 466d73a

Please sign in to comment.