Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: WeakMap TypeError on 0 height iframes #1276

Merged
merged 6 commits into from
Jun 24, 2024
Merged
Changes from 1 commit
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
11 changes: 7 additions & 4 deletions packages/child/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,10 @@

let elVal = 0
let len = calcElements.length
let maxEl
let maxVal = 0
let maxEl = document.documentElement
let maxVal = hasTags
? 0
: document.documentElement.getBoundingClientRect().bottom
let timer = performance.now()

calcElements.forEach((element) => {
Expand Down Expand Up @@ -896,11 +898,12 @@
if (len > 1) usedEl(maxEl)

const logMsg = `
Parsed ${len} element${(len = SINGLE ? '' : 's')} in ${timer.toPrecision(3)}ms
Parsed ${len} element${len === SINGLE ? '' : 's'} in ${timer.toPrecision(3)}ms
${Side} ${hasTags ? 'tagged ' : ''}element found at: ${maxVal}px
Position calculated from HTML element: ${getElementName(maxEl)} (${elementSnippet(maxEl, 100)})`

if (timer < 1.1 || isInit || hasTags) {
if (timer < 4 || len < 10 || hasTags || isInit) {
console.log('len', len)
Fixed Show fixed Hide fixed
log(logMsg)
} else {
if (perfWarned > timer) return maxVal
Expand Down
Loading