Skip to content

Commit

Permalink
Merge pull request #936 from lukesmurray/style-strings
Browse files Browse the repository at this point in the history
check for number before adding px to styles
  • Loading branch information
davidjbradshaw authored Apr 26, 2021
2 parents 72cce22 + 858c487 commit 3f84a35
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/iframeResizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -936,18 +936,19 @@
)
}

function isNumber(value) {
return typeof value === 'number'
}

function setupIFrame(iframe, options) {
function setLimits() {
function addStyle(style) {
if (
Infinity !== settings[iframeId][style] &&
0 !== settings[iframeId][style]
) {
iframe.style[style] = settings[iframeId][style] + 'px'
log(
iframeId,
'Set ' + style + ' = ' + settings[iframeId][style] + 'px'
)
var styleValue = settings[iframeId][style]
if (Infinity !== styleValue && 0 !== styleValue) {
iframe.style[style] = isNumber(styleValue)
? styleValue + 'px'
: styleValue
log(iframeId, 'Set ' + style + ' = ' + iframe.style[style])
}
}

Expand Down

0 comments on commit 3f84a35

Please sign in to comment.