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

Version 5.0.0 #1212

Merged
merged 390 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 133 commits
Commits
Show all changes
390 commits
Select commit Hold shift + click to select a range
28cce46
Add Object.freeze to output from getPageInfo()
davidjbradshaw Feb 26, 2024
ea8f238
Add direction option to replace sizeHeight/width + add advise() and b…
davidjbradshaw Feb 26, 2024
7bafae8
First draft of upgrade to v5
davidjbradshaw Feb 26, 2024
625efa4
Tidy
davidjbradshaw Feb 26, 2024
b0f60d0
Added more details
davidjbradshaw Feb 26, 2024
cbea0b3
Update upgrade.md
davidjbradshaw Feb 26, 2024
681afcf
Add sameDomain direct message from iframe to parent
davidjbradshaw Feb 26, 2024
786a318
Add more v5 upgrade details
davidjbradshaw Feb 26, 2024
1c6a65a
tidy upgrade doc
davidjbradshaw Feb 26, 2024
f5ff0af
tidy
davidjbradshaw Feb 26, 2024
5d42eca
Title
davidjbradshaw Feb 26, 2024
88c31f4
Spelling
davidjbradshaw Feb 26, 2024
ebfa81d
grammer
davidjbradshaw Feb 26, 2024
e8bc09c
Add API preamble to upgrade guide
davidjbradshaw Feb 26, 2024
5fd4a06
Further updates to upgrade.md
davidjbradshaw Feb 26, 2024
63e7939
Updated values return by getPageInfo()
davidjbradshaw Feb 26, 2024
4e71e98
Disable broken tests
davidjbradshaw Feb 26, 2024
babd918
Add comments on making animation smoother
davidjbradshaw Feb 26, 2024
fa52412
Typo
davidjbradshaw Feb 26, 2024
9fa5ca8
DIsable broken test
davidjbradshaw Feb 26, 2024
cf0f2d6
Update values returned by getPageInfo()
davidjbradshaw Feb 26, 2024
c9c730d
Zero negative offset when calculating scrollSize
davidjbradshaw Feb 26, 2024
f97ec88
Cheat a little
davidjbradshaw Feb 27, 2024
fece436
Merge getAutoSize() and getAutoOverflow()
davidjbradshaw Feb 27, 2024
3826d41
Update upgrade.md
davidjbradshaw Feb 27, 2024
f55b430
Reset deps
davidjbradshaw Feb 27, 2024
292ac34
Move license to GPL 3
davidjbradshaw Feb 27, 2024
1a6f6de
Change offset to -1
davidjbradshaw Feb 27, 2024
2cb9031
Tell parent to stop sending pageInfo if not expecting messages
davidjbradshaw Feb 27, 2024
32b1417
Add: same domain messages from parent to child
davidjbradshaw Feb 27, 2024
df881d6
Tidy
davidjbradshaw Feb 27, 2024
9207998
Deprecate autoResize option for new direction
davidjbradshaw Feb 27, 2024
1e4bf36
Ensure size events don't fire when autoResize is false
davidjbradshaw Feb 27, 2024
49e23f4
typo
davidjbradshaw Feb 27, 2024
dfe7178
Update google_apps_script.md
davidjbradshaw Feb 28, 2024
94e64d1
Update google_apps_script.md
davidjbradshaw Feb 28, 2024
418dc94
Update google_apps_script.md
davidjbradshaw Feb 28, 2024
9233103
Update google_apps_script.md
davidjbradshaw Feb 28, 2024
c1f4234
Add width test page
davidjbradshaw Feb 28, 2024
6f78773
Migrate from Grunt to Rollup
davidjbradshaw Feb 28, 2024
647ac06
Improve detection of sameDomain
davidjbradshaw Feb 28, 2024
93a3676
Create new dist packages
davidjbradshaw Feb 28, 2024
b669147
#794 Added getParentInfo() and deprecated getPageInfo()
davidjbradshaw Feb 29, 2024
7a5a54a
Use getParentInfo() in example
davidjbradshaw Feb 29, 2024
109adbe
tidy
davidjbradshaw Feb 29, 2024
eaaa85d
#794 return visualViewpoint data instead of of window innerSizes and …
davidjbradshaw Feb 29, 2024
66fc630
Remove qUnit
davidjbradshaw Feb 29, 2024
6025b3d
Remove qUnit
davidjbradshaw Feb 29, 2024
829a21c
Make code QL ingnore built packages
davidjbradshaw Feb 29, 2024
7f0208c
Tidy getParentInfo()
davidjbradshaw Feb 29, 2024
7b195a3
Update deprication warning text
davidjbradshaw Feb 29, 2024
67bedfa
Update codeQL
davidjbradshaw Feb 29, 2024
1356e3c
Fix trailing commas
davidjbradshaw Feb 29, 2024
33c8565
Refactor build process stage one
davidjbradshaw Feb 29, 2024
2916107
Update config
davidjbradshaw Mar 1, 2024
3fade42
Refactor build process
davidjbradshaw Mar 1, 2024
a93e18e
Remove unused function
davidjbradshaw Mar 1, 2024
9c32b05
Refactor code
davidjbradshaw Mar 1, 2024
c4aef30
tidy
davidjbradshaw Mar 1, 2024
d8abc46
Fix eslint sarif
davidjbradshaw Mar 2, 2024
6d08e09
Tidy
davidjbradshaw Mar 2, 2024
76bcf95
Create dev and prod builds
davidjbradshaw Mar 2, 2024
d6f2e0b
Only build JS version in dev mode
davidjbradshaw Mar 2, 2024
2df699a
remove JS folder
davidjbradshaw Mar 2, 2024
22c7d3c
Add option to addListeners
davidjbradshaw Mar 2, 2024
ec30cf6
tidy
davidjbradshaw Mar 2, 2024
0c589ea
Tidy
davidjbradshaw Mar 2, 2024
7ab3c0a
Add eslint ignore
davidjbradshaw Mar 2, 2024
0a255f5
Update Prod build script
davidjbradshaw Mar 2, 2024
9992f71
codeQL
davidjbradshaw Mar 2, 2024
094c97a
Move constants
davidjbradshaw Mar 2, 2024
bab4fb8
disable codeql
davidjbradshaw Mar 3, 2024
5ed40fe
.
davidjbradshaw Mar 3, 2024
297d484
break up parent
davidjbradshaw Mar 3, 2024
df8f689
Remove log from docs
davidjbradshaw Mar 4, 2024
1dbda9e
pagePosition -> page.position
davidjbradshaw Mar 4, 2024
1f3a901
Rename jquery output file
davidjbradshaw Mar 4, 2024
3c6d08d
Update build
davidjbradshaw Mar 4, 2024
b135b2b
Update build
davidjbradshaw Mar 4, 2024
5e7dc0f
Setup Jest
davidjbradshaw Mar 4, 2024
87829fe
Setup Jest
davidjbradshaw Mar 4, 2024
587227c
Tidy
davidjbradshaw Mar 4, 2024
9784030
Move karma to Chrome Headless
davidjbradshaw Mar 4, 2024
d62b8fb
migrate karma to headless chrome
davidjbradshaw Mar 4, 2024
206ed30
Add deprecation warning
davidjbradshaw Mar 4, 2024
d93301b
Tidy
davidjbradshaw Mar 4, 2024
7b4af05
tidy
davidjbradshaw Mar 4, 2024
eb3931d
Remove grunt
davidjbradshaw Mar 4, 2024
a2c4ae8
Tidy test hook
davidjbradshaw Mar 4, 2024
708e0a7
Auto generate dist/*/package.json
davidjbradshaw Mar 4, 2024
b0ced80
Build js
davidjbradshaw Mar 4, 2024
5573e68
tidy
davidjbradshaw Mar 4, 2024
c2a53d7
Refactor build script
davidjbradshaw Mar 5, 2024
b8695e3
Refactor and breakup build script
davidjbradshaw Mar 5, 2024
a870c76
Fix test mode
davidjbradshaw Mar 5, 2024
8fa7a74
Create iife build in js folder
davidjbradshaw Mar 5, 2024
df64e2e
refact file layout in src
davidjbradshaw Mar 5, 2024
380136d
Update paths used by Jasmine tests
davidjbradshaw Mar 5, 2024
1fc685f
iFrameResize -> iframeResize
davidjbradshaw Mar 5, 2024
0af8488
iFrameResize -> iframeResize
davidjbradshaw Mar 5, 2024
82b8585
Fix: nested same domian
davidjbradshaw Mar 5, 2024
12d185d
Rename pkg -> pkgJson
davidjbradshaw Mar 5, 2024
614ef74
Fix: header on JQuery built files
davidjbradshaw Mar 5, 2024
fcb6ae2
Create @iframe-resizer/core
davidjbradshaw Mar 6, 2024
8b3742b
Fix test
davidjbradshaw Mar 6, 2024
deab21c
Add pkg name to error msg
davidjbradshaw Mar 6, 2024
ee0e6b5
Fold in React version into monorepo
davidjbradshaw Mar 6, 2024
d13dd4e
tidy
davidjbradshaw Mar 6, 2024
c974c38
Fix: version number of @iframe-resizer/core in built pjs.json files
davidjbradshaw Mar 6, 2024
76878ea
Tidy
davidjbradshaw Mar 6, 2024
4bbbc04
Update framework_API.md
davidjbradshaw Mar 6, 2024
a833d57
Update vue.md
davidjbradshaw Mar 6, 2024
4a8d74f
Update docs
davidjbradshaw Mar 6, 2024
6dcbb2a
Fix: Nested example and restructure example folder
davidjbradshaw Mar 7, 2024
be65a3a
Tidy Nested example
davidjbradshaw Mar 7, 2024
376fcaa
Add 'via' to nest example sendMsg
davidjbradshaw Mar 7, 2024
4b5e2fc
delint html files
davidjbradshaw Mar 7, 2024
7805146
delint
davidjbradshaw Mar 7, 2024
ca66983
Trying to get Jest to play nicely with ESM local imports
davidjbradshaw Mar 7, 2024
cb5b56c
Simplify Banner
davidjbradshaw Mar 7, 2024
1cdae5f
Simplify Banner
davidjbradshaw Mar 7, 2024
f494ab2
tidy factory does not need to cast array
davidjbradshaw Mar 7, 2024
a9f07a4
Tidy build script
davidjbradshaw Mar 7, 2024
d4c89a6
Rename src folder to packages
davidjbradshaw Mar 7, 2024
7552d79
Build README.md
davidjbradshaw Mar 8, 2024
07bc38d
Add: terser() back to JS builds
davidjbradshaw Mar 8, 2024
e4c9e53
Add: Filter generated pkg.json
davidjbradshaw Mar 8, 2024
e145709
Replace getPageInfo with getParentInfo in docs
davidjbradshaw Mar 8, 2024
6e5eae7
Add updated types
davidjbradshaw Mar 8, 2024
a0c74e0
typo
davidjbradshaw Mar 8, 2024
bd5eff7
doc formatting
davidjbradshaw Mar 8, 2024
43b92d5
Tidy docs
davidjbradshaw Mar 9, 2024
23bec88
Add missing types
davidjbradshaw Mar 9, 2024
555a770
tidy
davidjbradshaw Mar 9, 2024
65f13c8
Don't add date to js folder banners
davidjbradshaw Mar 9, 2024
fbe8e1d
Add eslint rules for specs
davidjbradshaw Mar 9, 2024
a7a43ea
Remove unused sendPermit
davidjbradshaw Mar 10, 2024
8b3ed8a
Create test-js build of child for karma
davidjbradshaw Mar 10, 2024
fc4719b
Update options.md
davidjbradshaw Mar 11, 2024
e8bedd7
Fixed: stop number being cast to a string
davidjbradshaw Mar 12, 2024
7af8936
Fix: margin calculation
davidjbradshaw Mar 12, 2024
b4f74d5
Tidy overflow example
davidjbradshaw Mar 14, 2024
723637e
Update file banner
davidjbradshaw Mar 14, 2024
4e7f426
Update version
davidjbradshaw Apr 13, 2024
e5f2df9
Pretty html
davidjbradshaw Apr 13, 2024
b5712f3
Remove console.log
davidjbradshaw Apr 13, 2024
971bb7a
Add: Freeze iframe array returned by iframeResize()
davidjbradshaw Apr 13, 2024
242d6b4
Tidy
davidjbradshaw Apr 13, 2024
d95449e
Add pubSub code
davidjbradshaw Apr 13, 2024
f63c18b
Delint spec files
davidjbradshaw Apr 13, 2024
e3591ed
chang 'on' to 'addListener'
davidjbradshaw Apr 13, 2024
c249817
Update build
davidjbradshaw Apr 13, 2024
729ee56
alpha 2 release
davidjbradshaw Apr 13, 2024
e69dbe6
Alpha 3 release
davidjbradshaw Apr 13, 2024
5c25108
Move docs to own project
davidjbradshaw Apr 13, 2024
148fdf4
Add publish script
davidjbradshaw Apr 13, 2024
46bbbf3
removeListeners -> disconnect
davidjbradshaw Apr 14, 2024
c3be78b
Alpha 4
davidjbradshaw Apr 14, 2024
9807a95
Add key
davidjbradshaw Apr 14, 2024
53503f6
Set target to last 4 versions
davidjbradshaw Apr 14, 2024
0a556a8
Tidy
davidjbradshaw Apr 14, 2024
c9559fe
Update build
davidjbradshaw Apr 14, 2024
32b15dd
Add license check
davidjbradshaw Apr 15, 2024
8e2eea2
Add license to example
davidjbradshaw Apr 16, 2024
c526062
Update project homepage
davidjbradshaw Apr 16, 2024
5d8970f
Update project homepage
davidjbradshaw Apr 16, 2024
87053ea
fix test paths
davidjbradshaw Apr 16, 2024
439a1ed
fix test
davidjbradshaw Apr 16, 2024
73c284f
Fix test
davidjbradshaw Apr 16, 2024
d5df2fa
disable a few rules for spec files
davidjbradshaw Apr 16, 2024
501be07
Test before publish
davidjbradshaw Apr 16, 2024
c012ac4
Update headers
davidjbradshaw Apr 16, 2024
969177c
Fix site link
davidjbradshaw Apr 16, 2024
bdc454e
Better formating of advise()
davidjbradshaw Apr 16, 2024
ac4d810
Alpha 5
davidjbradshaw Apr 17, 2024
3166ecc
Fix tests
davidjbradshaw Apr 17, 2024
7fc5263
Only check mode setup once
davidjbradshaw Apr 17, 2024
c85af59
Alpha 7
davidjbradshaw Apr 17, 2024
1d873ac
Release v4.3.10
davidjbradshaw Apr 18, 2024
52339e2
Add link to PR
davidjbradshaw Apr 18, 2024
ec3b625
Alpha 7
davidjbradshaw Apr 18, 2024
1153f5a
Fix Advise on Safari/Firefox
davidjbradshaw Apr 18, 2024
b205b86
#845 Fix auto resizing of widths
davidjbradshaw Apr 18, 2024
59a8a1c
#1228 Fix types - Alpha.8
davidjbradshaw Apr 22, 2024
4a04bbc
Add: editorConfig and update .eslintrc
davidjbradshaw Apr 22, 2024
208e1f8
#1228 Add license to types
davidjbradshaw Apr 24, 2024
848c7f6
Change log level on Ignored messages #1228
davidjbradshaw Apr 24, 2024
b46de58
#1228 log object rather than convert to string
davidjbradshaw Apr 24, 2024
b2c2112
Alpha 9 #1228
davidjbradshaw Apr 24, 2024
d6591ba
Add getIframeElement to React and remove DefaultProps and forwardRef …
davidjbradshaw Apr 24, 2024
db76f98
Alpha.10
davidjbradshaw Apr 24, 2024
9ac0d09
Fix: Don't case height/width to string, fix typings and use ?. notati…
davidjbradshaw Apr 25, 2024
7354e15
Add new logo
davidjbradshaw Apr 26, 2024
2930f14
Fix image url
davidjbradshaw Apr 26, 2024
b8202f7
Fix image url
davidjbradshaw Apr 26, 2024
210dea8
Update README.md
davidjbradshaw Apr 26, 2024
9af36b3
Alpha.11
davidjbradshaw Apr 26, 2024
355d4a5
typo
davidjbradshaw Apr 26, 2024
67fbac5
Remove PropTypes from React
davidjbradshaw Apr 26, 2024
6688d7f
Alpha.12
davidjbradshaw Apr 26, 2024
ecba569
Update README.md
davidjbradshaw Apr 30, 2024
2d29ae7
Remove prop types
davidjbradshaw May 2, 2024
a3bd72c
Fix react props filter
davidjbradshaw May 5, 2024
88b8d0a
Ensure size is returned when switching to autoOverflow
davidjbradshaw May 8, 2024
775ddd4
Remove range check before resizing iframe, as CSS no takes care of this
davidjbradshaw May 8, 2024
70743f2
Fix child tests
davidjbradshaw May 8, 2024
696d8f0
fix another child test
davidjbradshaw May 8, 2024
eab8506
Fix more tests
davidjbradshaw May 8, 2024
0ba6b15
Revise getPageInfo() and rename size() -> resize()
davidjbradshaw May 8, 2024
1d641dc
getPageInfo -> getParentProperties
davidjbradshaw May 8, 2024
ed8bc3d
Update build
davidjbradshaw May 8, 2024
5d5189a
Fix typo in function name getParentgetParentProperties
davidjbradshaw May 8, 2024
b0ff93b
Fix example formatting
davidjbradshaw May 8, 2024
63463d7
Remove max/min checks and create format-advise.js
davidjbradshaw May 8, 2024
8d520ae
delint
davidjbradshaw May 8, 2024
fc30c2b
Add offet and only show version once
davidjbradshaw May 9, 2024
b066104
Beta.1
davidjbradshaw May 9, 2024
6ec1976
Tidy messages
davidjbradshaw May 9, 2024
a56e338
Fix url on examples
davidjbradshaw May 9, 2024
b470579
Fix urls
davidjbradshaw May 9, 2024
1fd343d
Update deployable readme template
davidjbradshaw May 9, 2024
f4bafa8
Fix tests
davidjbradshaw May 9, 2024
2393e4a
Beta.2
davidjbradshaw May 9, 2024
4cfabdd
Update badge
davidjbradshaw May 9, 2024
edfeccd
Update badge
davidjbradshaw May 9, 2024
2182c5f
Beta.3
davidjbradshaw May 9, 2024
b516958
iFrame -> iframe
davidjbradshaw May 9, 2024
f221522
typo
davidjbradshaw May 9, 2024
8e5592b
Make header clickable
davidjbradshaw May 9, 2024
9a23454
Make header clickable
davidjbradshaw May 9, 2024
0483e19
Beta.4
davidjbradshaw May 10, 2024
1e54bc5
Delete very old npm footer
davidjbradshaw May 11, 2024
f5cf2b5
Add react example
davidjbradshaw May 13, 2024
3a99680
Update react example
davidjbradshaw May 13, 2024
c0ba965
Tidy React example
davidjbradshaw May 13, 2024
ee4cbb9
Update react example
davidjbradshaw May 14, 2024
b9fa714
GPL-v3 -> GPLv3
davidjbradshaw May 14, 2024
84f85d4
Host page -> Parent page
davidjbradshaw May 14, 2024
87f4200
Add modes
davidjbradshaw May 14, 2024
ab1d3eb
Update settings
davidjbradshaw May 14, 2024
99a7474
Update modes
davidjbradshaw May 14, 2024
f75df6e
Add missing key to tests
davidjbradshaw May 15, 2024
1476a9e
RC.1
davidjbradshaw May 15, 2024
82b6368
Add version tagging to publish script
davidjbradshaw May 17, 2024
5e2bc4a
Release 5.0.0-RC.2
davidjbradshaw May 17, 2024
18c4ea0
Update deps
davidjbradshaw May 17, 2024
5e4e21f
Add top, left and iframeId values to onScroll event
davidjbradshaw May 17, 2024
a7230f7
Change iframeId -> iframe when passed to onScroll()
davidjbradshaw May 17, 2024
610c992
Remove console
davidjbradshaw May 17, 2024
bc676c6
Release 5.0.0-RC.3
davidjbradshaw May 17, 2024
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
32 changes: 4 additions & 28 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": ["auto"],
"plugins": ["ie11"],
"env": {
"amd": true,
"browser": true,
Expand All @@ -9,50 +8,27 @@
"globals": {
"location": true
},
"parserOptions": { "ecmaVersion": 2015 },
"parserOptions": { "ecmaVersion": 2020 },
"rules": {
"const-case/uppercase": 0,
"func-names": 0,
"global-require": 0,
"no-param-reassign": 0,
"no-plusplus": 0,
"no-use-before-define": 0,
"no-shadow": 0,
"no-var": 0,
"object-shorthand": 0,
"one-var": 0,
"prefer-arrow-callback": 0,
"prefer-destructuring": 0,
"prefer-object-spread": 0,
"prefer-rest-params": 0,
"prefer-template": 0,
"vars-on-top": 0,
"yoda": 0,
"ie11/no-collection-args": ["error"],
"ie11/no-for-in-const": ["error"],
"ie11/no-loop-func": ["warn"],
"ie11/no-weak-collections": ["error"],
"import/no-amd": 0,
"lodash/prefer-noop": 0,
"lodash-fp/prefer-constant": 0,
"pii/no-email": 0,
"sonarjs/no-nested-template-literals": 0,
"switch-case/no-case-curly": 0,
"unicorn/consistent-function-scoping": 0,
"unicorn/filename-case": 0,
"unicorn/no-array-callback-reference": 0,
"unicorn/no-array-method-this-argument": 0,
"unicorn/no-this-assignment": 0,
"unicorn/prefer-date-now": 0,
"unicorn/prefer-dom-node-append": 0,
"unicorn/prefer-dom-node-remove": 0,
"unicorn/prefer-module": 0,
"unicorn/prefer-node-append": 0,
"unicorn/prefer-node-protocol": 0,
"unicorn/prefer-node-remove": 0,
"unicorn/prefer-query-selector": 0,
"unicorn/prefer-string-slice": 0,
"unicorn/prefer-top-level-await": 0,
"unicorn/prefer-number-properties": 0,
"unicorn/prevent-abbreviations": 0,
"unicorn/switch-case-braces": 0
"xss/no-mixed-html": 0
}
}
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,19 @@ jobs:
permissions:
contents: read
security-events: write
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install ESLint
run: |
npm install eslint@8
npm install @microsoft/eslint-formatter-sarif@2.1.7
run: npm install @microsoft/eslint-formatter-sarif@3

- name: Run ESLint
run: npx eslint .
--config .eslintrc.js
--ext .js,.jsx,.ts,.tsx
--format @microsoft/eslint-formatter-sarif
--output-file eslint-results.sarif
run: npm run eslint:sarif
continue-on-error: true

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: eslint-results.sarif
wait-for-processing: true
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Good bug reports are extremely helpful, so thanks!

Guidelines for bug reports:

0. **Lint your code** — Use [jshint](http://jshint.com/)
0. **Lint your code** — Using `npm run eslint:fix`
to ensure your problem isn't caused by a simple error in your own code.

1. **Use the GitHub issue search** — check if the issue has already been
Expand Down
212 changes: 191 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<img src="https://raw.githubusercontent.com/davidjbradshaw/iframe-resizer/master/img/logo-no-background.svg" alt="iFrame Resizer" style="margin-bottom: -20">

[![NPM version](https://badge.fury.io/js/iframe-resizer.svg)](http://badge.fury.io/js/iframe-resizer)
[![NPM Downloads](https://img.shields.io/npm/dm/iframe-resizer.svg)](https://npm-stat.com/charts.html?package=iframe-resizer&from=2014-12-31)
[![](https://data.jsdelivr.com/v1/package/npm/iframe-resizer/badge?style=rounded)](https://www.jsdelivr.com/package/npm/iframe-resizer)
[![NPM Downloads](https://img.shields.io/npm/dm/iframe-resizer.svg)](https://npm-stat.com/charts.html?package=iframe-resizer&from=2014-12-31) <!--
[![](https://data.jsdelivr.com/v1/package/npm/iframe-resizer/badge?style=rounded)](https://www.jsdelivr.com/package/npm/iframe-resizer) -->
[![Coverage Status](https://coveralls.io/repos/davidjbradshaw/iframe-resizer/badge.svg?branch=master&service=github)](https://coveralls.io/github/davidjbradshaw/iframe-resizer)

This library enables the automatic resizing of the height and width of both same and cross domain iFrames to fit their contained content. It provides a range of features to address the most common issues with using iFrames, these include:
Expand All @@ -12,7 +12,8 @@ This library enables the automatic resizing of the height and width of both same
- Domain authentication for cross domain iFrames.
- Provides a range of page size calculation methods to support complex CSS layouts.
- Detects changes to the DOM that can cause the page to resize using [MutationObserver](https://developer.mozilla.org/en/docs/Web/API/MutationObserver).
- Detects events that can cause the page to resize (Window Resize, CSS Animation and Transition, Orientation Change and Mouse events).
- Detects HTML elements resizing with [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/ResizeObserver).
- Detects events that can cause the page to resize (Window Resize, CSS Animation and Transition, Orientation Change, Browser Tab visability, plus a selection of Mouse and Touch events).
- Simplified messaging between iFrame and host page via [postMessage](https://developer.mozilla.org/en-US/docs/Web/API/window.postMessage).
- Fixes in page links in iFrame and supports links between the iFrame and parent page.
- Provides custom sizing and scrolling methods.
Expand Down Expand Up @@ -87,14 +88,14 @@ IFrame-Resizer provides an extensive range of options and APIs for both the pare
- [Angular](https://github.com/davidjbradshaw/iframe-resizer/issues/478#issuecomment-347958630)
- [Ember](https://github.com/alexlafroscia/ember-iframe-resizer-modifier)
- [jQuery](https://github.com/davidjbradshaw/iframe-resizer/blob/master/docs/use_with/jquery.md)
- [Google Apps Script](https://stackoverflow.com/a/65724113/2087070)
- [Google Apps Script](https://github.com/davidjbradshaw/iframe-resizer/blob/master/docs/use_with/google_apps_script.md)
- [Troubleshooting](https://github.com/davidjbradshaw/iframe-resizer/blob/master/docs/troubleshooting.md)
- [Upgrade from version 3](https://github.com/davidjbradshaw/iframe-resizer/blob/master/docs/upgrade.md)
- [Version history](https://github.com/davidjbradshaw/iframe-resizer/blob/master/CHANGELOG.md)

## License

Copyright &copy; 2013-23 [David J. Bradshaw](https://github.com/davidjbradshaw) -
Copyright &copy; 2013-24 [David J. Bradshaw](https://github.com/davidjbradshaw) -
Licensed under the [MIT License](LICENSE)

<!--
Expand Down
31 changes: 8 additions & 23 deletions docs/iframed_page/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,16 @@ Returns the ID of the iFrame that the page is contained in.

Ask the containing page for its positioning coordinates. You need to provide a callback which receives an object with the following properties:

* **documentHeight** The containing document's height in pixels (the equivalent of `document.documentElement.clientHeight` in the container)
* **documentWidth** The containing document's width in pixels (the equivalent of `document.documentElement.clientWidth` in the container)
* **iframeHeight** The height of the iframe in pixels
* **iframeWidth** The width of the iframe in pixels
* **offsetLeft** The number of pixels between the left edge of the containing page and the left edge of the iframe
* **offsetTop** The number of pixels between the top edge of the containing page and the top edge of the iframe
* **scrollLeft** The number of pixels between the left edge of the iframe and the left edge of the iframe viewport
* **scrollTop** The number of pixels between the top edge of the iframe and the top edge of the iframe viewport
* **documentHeight** The containing document's height in pixels (the equivalent of `document.documentElement.clientHeight` in the container)
* **documentWidth** The containing document's width in pixels (the equivalent of `document.documentElement.clientWidth` in the container)
* **scrollX** The number of pixels between the top edge of the iframe and the top edge of the iframe viewport (`window.scrollX`)
* **scrollY** The number of pixels between the left edge of the iframe and the left edge of the iframe viewport (`window.scrollY`)
* **windowHeight** The containing window's height in pixels (the equivalent of `window.innerHeight` in the container)
* **windowWidth** The containing window's width in pixels (the equivalent of `window.innerWidth` in the container)
* **clientHeight** (deprecated) The height of the containing document, considering the viewport, in pixels (`max(documentHeight, windowHeight)`).
* **clientWidth** (deprecated) The width of the containing document, considering the viewport, in pixels (`max(documentWidth, windowWidth)`).


Your callback function will be recalled when the parent page is scrolled or resized.
Expand All @@ -54,25 +52,12 @@ Scroll the parent page to the coordinates x and y relative to the position of th

Send data to the containing page, `message` can be any data type that can be serialized into JSON. The `targetOrigin` option is used to restrict where the message is sent to; to stop an attacker mimicking your parent page. See the MDN documentation on [postMessage](https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage) for more details.

<!--
### setHeightCalculationMethod(heightCalculationMethod)

Change the method use to workout the height of the iFrame.
-->

### size ([customHeight],[ customWidth])
### size()

Manually force iFrame to resize. This method optionally accepts two arguments: **customHeight** & **customWidth**. To use them you need first to disable the `autoResize` option to prevent auto resizing and enable the `sizeWidth` option if you wish to set the width.

```js
iFrameResize({
autoResize: false,
sizeWidth: true
})
```

Then you can call the `size` method with dimensions:

```js
if ('parentIFrame' in window) {
parentIFrame.size(100); // Set height to 100px
}
```
Manually force iFrame to resize. If for some reason a change in content size is not detected, this method allows you to nudge iframe-resizer to recalculate the page size.
23 changes: 14 additions & 9 deletions docs/iframed_page/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@ The following options can be set from within the iFrame page by creating a `wind
<script src="js/iframeresizer.contentwindow.js"></script>
```

### targetOrigin
### heightCalculationMethod / widthCalculationMethod

default: '*'
type: string
default: null
type: function() { return integer }

This option allows you to restrict the domain of the parent page, to prevent other sites mimicking your parent page.
Add a custom function to calculate page size. Function must return size as an integer. This can be useful when none of the standard ways of working out the size provide a suitable result. However, normally problems with sizing are due to CSS issues and this should be looked at first.

### heightCalculationMethod / widthCalculationMethod
### offsetHeight / offsetWidth

default: null
type: string | function() { return integer }
default: 0
type: integer

Modify the computed size of the iframe. This is useful if the page in the iframe returns a size value that is consitantly slightly different to how you want the iframe to be sized.

These options can be used to override the option set in the parent page (See above for details on available values). This can be useful when moving between pages in the iFrame that require different values for these options.
### targetOrigin

Altenatively you can pass a custom function that returns the size as an integer. This can be useful when none of the standard ways of working out the size are suitable. However, normally problems with sizing are due to CSS issues and this should be looked at first.
default: '*'
type: string

This option allows you to restrict the domain of the parent page, to prevent other sites mimicking your parent page.
16 changes: 8 additions & 8 deletions docs/parent_page/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ onClosed: (iframeID) => undefined

Called after iFrame is closed via `parentIFrame.close()` or `iframe.iFrameResizer.close()` methods.

### onInit

```js
onInit: (iframe) => undefined
```

Called after initial setup.

### onMessage

```js
Expand All @@ -50,6 +42,14 @@ onMouseLeave: ({iframe,height,width,type}) => undefined

Function called after the mouse leaves the iframe. Passes `messageData` object containing the **iFrame**, **screenX**, **screenY** and the **type** of event that triggered the callback.

### onReady

```js
onReady: (iframe) => undefined
```

Called after initial setup.

### onResized

```js
Expand Down
49 changes: 32 additions & 17 deletions docs/parent_page/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,41 @@ When set to true, only allow incoming messages from the domain listed in the `sr

When enabled in page linking inside the iFrame and from the iFrame to the parent page will be enabled.

<!--
### heightCalculationMethod

default: 'bodyOffset'
values: 'bodyOffset' | 'bodyScroll' | 'documentElementOffset' | 'documentElementScroll' |
'max' | 'min' | 'grow' | 'lowestElement' | 'taggedElement'
default: 'documentElementBoundingClientRect'
values: 'documentElementBoundingClientRect' | 'documentElementOffset' | 'documentElementScroll' |
'bodyBoundingClientRect' | 'bodyOffset' | 'bodyScroll' |
'max' | 'min' | 'lowestElement' | 'lowestDivElement' | 'taggedElement'

By default the height of the iFrame is calculated by converting the margin of the `body` to <i>px</i> and then adding the top and bottom figures to the offsetHeight of the `body` tag.
In most cases the default option will work the best and you won't need to adjust this setting.

In cases where CSS styles causes the content to flow outside the `body` you may need to change this setting to one of the following options. Each can give different values depending on how CSS is used in the page and each has varying side-effects. You will need to experiment to see which is best for any particular circumstance.

* **bodyOffset** uses `document.body.offsetHeight`
* **bodyScroll** uses `document.body.scrollHeight` <sup>*</sup>
* **documentElementBoundingClientRect** uses `document.documentElement.getBoundingClientRect().bottom`
* **documentElementOffset** uses `document.documentElement.offsetHeight`
* **documentElementScroll** uses `document.documentElement.scrollHeight` <sup>*</sup>
* **max** takes the largest value of the main four options <sup>*</sup>
* **min** takes the smallest value of the main four options <sup>*</sup>
* **bodyBoundingClientRect** uses `document.body.getBoundingClientRect().bottom`
* **bodyOffset** uses `document.body.offsetHeight`
* **bodyOffsetMargin** uses `document.body.offsetHeight` + top and bottom margin
* **bodyScroll** uses `document.body.scrollHeight` <sup>*</sup>
* **max** takes the largest value of the above options <sup>*</sup>
* **min** takes the smallest value of the above options <sup>*</sup>
* **lowestElement** Loops though every element in the DOM and finds the lowest bottom point <sup>†</sup>
* **lowestDivElement** Loops though every `<div />` element in the DOM to find the lowest bottom point
* **taggedElement** Finds the bottom of the lowest element with a `data-iframe-height` attribute

<i>Notes:</i>

<i>**If the default option doesn't work then the best solutions is to use either** taggedElement, **or** lowestElement</i>**.** Alternatively it is possible to add your own custom sizing method directly inside the iFrame, see the [iFrame Page Options](../iframed_page/options.md) section for more details.

<sup> † </sup> <i>The **lowestElement** option is the most reliable way of determining the page height. However, it does have a performance impact, as it requires checking the position of every element on the page. The **taggedElement** option provides much greater performance by limiting the number of elements that need their position checked</i>.
<i>Where a factional value is returned for the height, such as 123.45, it will be rounded up to the nearest whole pixel</i>.

<sup> † </sup> <i>The **lowestElement** option is the most reliable way of determining the page height. However, it can have a performance impact on complex page, due to it checking the position of every element on the page. The **lowestDivElement** and **taggedElement** option provides much greater performance by limiting the number of elements that need their position checked</i>.

<sup>*</sup> These methods can cause screen flicker in some browsers.
-->

### maxHeight / maxWidth

Expand All @@ -95,12 +104,14 @@ Set maximum height/width of iFrame.

Set minimum height/width of iFrame.

### resizeFrom
### offsetHeight / offsetWidth

default: 'parent'
values: 'parent', 'child'
default: 0
type: integer

Listen for resize events from the parent page, or the iFrame. Select the 'child' value if the iFrame can be resized independently of the browser window. <i>Selecting this value can cause issues with some height calculation methods on mobile devices</i>.
Modify the computed size of the iframe. This is useful if the page in the iframe returns a size value that is consitantly slightly different to how you want the iframe to be sized.

<sup>*</sup> This value can also be set on a per page basis in the iframe.

### scrolling

Expand Down Expand Up @@ -143,11 +154,12 @@ Set the number of pixels the iFrame content size has to change by, before trigge

Set the number of milliseconds after which a warning is logged if the iFrame has not responded. Set to `0` to supress warning messages of this type.


<!--
### widthCalculationMethod

default: 'scroll'
values: 'bodyOffset' | 'bodyScroll' | 'documentElementOffset' | 'documentElementScroll' |
values: 'bodyOffset' | 'bodyScroll' | 'bodyBoundingClientRect' |
'documentElementOffset' | 'documentElementScroll' | 'documentElementBoundingClientRect' |
'max' | 'min' | 'scroll' | 'rightMostElement' | 'taggedElement'

By default the width of the page is worked out by taking the greater of the **documentElement** and **body** scrollWidth values.
Expand All @@ -156,11 +168,13 @@ Some CSS techniques may require you to change this setting to one of the followi

* **bodyOffset** uses `document.body.offsetWidth`
* **bodyScroll** uses `document.body.scrollWidth` <sup>*</sup>
* **bodyBoundingClientRect** uses `document.body.getBoundingClientRect().right`
* **documentElementOffset** uses `document.documentElement.offsetWidth`
* **documentElementScroll** uses `document.documentElement.scrollWidth` <sup>*</sup>
* **documentElementBoundingClientRect** uses `document.documentElement.getBoundingClientRect().right`
* **scroll** takes the largest value of the two scroll options <sup>*</sup>
* **max** takes the largest value of the main four options <sup>*</sup>
* **min** takes the smallest value of the main four options <sup>*</sup>
* **max** takes the largest value of the main six options <sup>*</sup>
* **min** takes the smallest value of the main six options <sup>*</sup>
* **rightMostElement** Loops though every element in the DOM and finds the right most point <sup>†</sup>
* **taggedElement** Finds the left most element with a `data-iframe-width` attribute

Expand All @@ -169,3 +183,4 @@ Alternatively it is possible to add your own custom sizing method directly insid
<sup> † </sup> <i>The **rightMostElement** option is the most reliable way of determining the page width. However, it does have a performance impact as it requires calculating the position of every element on the page. The **taggedElement** option provides much greater performance by limiting the number of elements that need their position checked.</i>

<sup>*</sup> These methods can cause screen flicker in some browsers.
-->
Loading
Loading