iframe-resizer 4.2.10 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc CHANGED
@@ -1,23 +1,26 @@
1
1
  {
2
- "extends": ["airbnb-base", "adjunct", "prettier"],
3
- "plugins": ["prettier", "ie11"],
2
+ "extends": ["auto"],
3
+ "plugins": ["ie11"],
4
4
  "env": {
5
5
  "amd": true,
6
6
  "browser": true,
7
7
  "jasmine": true
8
8
  },
9
+ "globals": {
10
+ "location": true
11
+ },
9
12
  "parserOptions": { "ecmaVersion": 2015 },
10
13
  "rules": {
11
14
  "func-names": 0,
12
15
  "global-require": 0,
13
16
  "no-param-reassign": 0,
14
17
  "no-plusplus": 0,
15
- "no-restricted-globals": 0,
16
18
  "no-use-before-define": 0,
17
19
  "no-shadow": 0,
18
20
  "no-var": 0,
19
21
  "object-shorthand": 0,
20
22
  "one-var": 0,
23
+ "prefer-arrow-callback": 0,
21
24
  "prefer-destructuring": 0,
22
25
  "prefer-rest-params": 0,
23
26
  "prefer-template": 0,
@@ -28,12 +31,21 @@
28
31
  "ie11/no-loop-func": ["warn"],
29
32
  "ie11/no-weak-collections": ["error"],
30
33
  "import/no-amd": 0,
34
+ "lodash/prefer-noop": 0,
35
+ "lodash-fp/prefer-constant": 0,
31
36
  "unicorn/consistent-function-scoping": 0,
32
37
  "unicorn/filename-case": 0,
38
+ "unicorn/no-array-callback-reference": 0,
39
+ "unicorn/no-this-assignment": 0,
40
+ "unicorn/prefer-date-now": 0,
41
+ "unicorn/prefer-dom-node-append": 0,
42
+ "unicorn/prefer-dom-node-remove": 0,
43
+ "unicorn/prefer-module": 0,
33
44
  "unicorn/prefer-node-append": 0,
34
45
  "unicorn/prefer-node-remove": 0,
35
46
  "unicorn/prefer-query-selector": 0,
36
- "unicorn/prevent-abbreviations": 0,
37
- "unicorn/prefer-string-slice": 0
47
+ "unicorn/prefer-string-slice": 0,
48
+ "unicorn/prefer-number-properties": 0,
49
+ "unicorn/prevent-abbreviations": 0
38
50
  }
39
51
  }
package/CHANGELOG.md CHANGED
@@ -1,107 +1,218 @@
1
1
  # Version History
2
2
 
3
+ - v4.3.2 [#936](https://github.com/davidjbradshaw/iframe-resizer/issues/936) Allow max/min values for iFrame size to be set using units other than `px` [[Luke Murray](https://github.com/lukesmurray)]
4
+
5
+ - v4.3.1 [#901](https://github.com/davidjbradshaw/iframe-resizer/issues/901) Fix backwards compatability issue with mouse events
6
+
7
+ - v4.3.0 Add `onMouseEnter` and `onMouseLeave` event callbacks [DEPRECATED]
8
+
9
+ - v4.2.11 Remove `unicorn/prefer-number-properties` from eslint rules and revert `Number.parseInt` to `parseInt`
10
+
3
11
  - v4.2.10 [#787](https://github.com/davidjbradshaw/iframe-resizer/issues/787) Replace `const` with `var` in index.js for IE10 [[Thomas Jaggi](https://github.com/backflip)]
12
+
4
13
  - v4.2.9 [#783](https://github.com/davidjbradshaw/iframe-resizer/issues/783) Bind `requestAnimationFrame` to `window` to fix issue with FireFox Content-Scripts [[Greg Soltis](https://github.com/gsoltis)]
14
+
5
15
  - v4.2.8 [#779](https://github.com/davidjbradshaw/iframe-resizer/issues/779) Fix issue with `javascript:void(0)` and `about:blank` URLs [[ceckoslab](https://github.com/ceckoslab)]
16
+
6
17
  - v4.2.7 Add support for NPM funding
18
+
7
19
  - v4.2.4 [#772](https://github.com/davidjbradshaw/iframe-resizer/issues/772) Fix issue with iframes inside ShaddowDOM elements [[Martin Belanger](https://github.com/martinbelanger)]
20
+
8
21
  - v4.2.3 [#683](https://github.com/davidjbradshaw/iframe-resizer/issues/683) Include border top/bottom, plus padding top/bottom, when calculating heights on iframe with `box-sizing: border-box;` [[Jim Doyle](https://github.com//superelement)]. [#768](https://github.com/davidjbradshaw/iframe-resizer/issues/768) Fix issue with hidden iframes [[Tony Living]](https://github.com//tonyliving)
22
+
9
23
  - v4.2.2 [#761](https://github.com/davidjbradshaw/iframe-resizer/pull/761) Check for iframe.src when parsing it for remoteHost [[Filip Stollar](https://github.com//SuNaden)]
24
+
10
25
  - v4.2.1 [#723](https://github.com/davidjbradshaw/iframe-resizer/pull/723) Fix option to turn off `autoResize` from iframe, when `resizeFrom` is set to `parent` [[Dennis Kronbügel]](https://github.com//deBFM)
26
+
11
27
  - v4.2.0 Add `onClose()` event to parent
28
+
12
29
  - v4.1.1 [#686](https://github.com/davidjbradshaw/iframe-resizer/pull/694) Fix IE11 regression with Object.values [[Jonathan Lehman](https://github.com//jdlehman)]
30
+
13
31
  - v4.1.0 [#686](https://github.com/davidjbradshaw/iframe-resizer/pull/686) Split client(Height/Width) into document and window values [[Bernhard Mäder](https://github.com//nuschk)]
32
+
14
33
  - v4.0.4 [#674](https://github.com/davidjbradshaw/iframe-resizer/pull/674) Fix default export
34
+
15
35
  - v4.0.3 [#606](https://github.com/davidjbradshaw/iframe-resizer/pull/606) Force height of clearFix div in iframe to 0
36
+
16
37
  - v4.0.2 [#671](https://github.com/davidjbradshaw/iframe-resizer/pull/671) Fix issue with window resize
38
+
17
39
  - v4.0.1 Fix documentation links in `README.md`
40
+
18
41
  - v4.0.0 Drop support for IE8-10 and Andriod 4, renamed event handlers from `fooCallback` to `onFoo` and restructure documentation. Reformat code with Prettier and add eslint to build
42
+
19
43
  - v3.6.5 [#658](https://github.com/davidjbradshaw/iframe-resizer/pull/658) Add `.npmignore` to project [[Sebastian Lamelas](https://github.com/smulesoft)]
44
+
20
45
  - v3.6.4 [#651](https://github.com/davidjbradshaw/iframe-resizer/pull/651) Fix issue resource leak when iframe removed from the page [[Steffen Eckardt](https://github.com/seckardt)]. [#651](https://github.com/davidjbradshaw/iframe-resizer/pull/651) Make Require.js optional when it is included on the page before iframe-resizer [[Dahmian Owen](https://github.com/dahmian)]
46
+
21
47
  - v3.6.3 [#635](https://github.com/davidjbradshaw/iframe-resizer/pull/635) Fix issue with undefined ID [[Henry Schein](https://github.com/ddxdental)]. [#582](https://github.com/davidjbradshaw/iframe-resizer/pull/582) Add `omit` option to `scrolling` config [[Matt Ryan](https://github.com/mryand)]
48
+
22
49
  - v3.6.2 [#596](https://github.com/davidjbradshaw/iframe-resizer/pull/596) Add Passive Event Listener for Performance [[Henrik Vendelbo](https://github.com/thepian)]. [#613](https://github.com/davidjbradshaw/iframe-resizer/pull/613) Check if the iFrameResize function is attached to the prototype of jQuery [[Paul Antal](https://github.com/paul-antal)]. [#620](https://github.com/davidjbradshaw/iframe-resizer/pull/620) Fixed an issue where host page fires init before iframe receiver setup [[Mark Zhou](https://github.com/mrmarktyy)]. [#620](https://github.com/davidjbradshaw/iframe-resizer/pull/620) Add `removeListeners` method to better support React [[Khang Nguyen](https://github.com/khangiskhan)]
50
+
23
51
  - v3.6.1 [#576](https://github.com/davidjbradshaw/iframe-resizer/pull/576) Fix race condition caused by react-iframe-resizer removing the domNode and calling `close()`
52
+
24
53
  - v3.6.0 [#562](https://github.com/davidjbradshaw/iframe-resizer/pull/562) Fix issue with debounce getPageInfo when their is more than one iFrame on the page [[Thomas Pringle](https://github.com/thomaspringle)]. [#568](https://github.com/davidjbradshaw/iframe-resizer/pull/568) Fix bug in Chrome 65 when iframe parent element has `display:none` set [[Steve Hong](https://github.com/aniude)]
54
+
25
55
  - v3.5.16 [#554](https://github.com/davidjbradshaw/iframe-resizer/issues/554) Fix throttling of init event [[SHOTA](https://github.com/senta)]. [#553](https://github.com/davidjbradshaw/iframe-resizer/issues/553) Prevents unhandled exception in IE11 [[vitoss](https://github.com/vitoss)]. [#555](https://github.com/davidjbradshaw/iframe-resizer/issues/555) Fix IE PolyFil and make grunt-cli local [[Jan Schmidle](https://github.com/bitcloud)]
56
+
26
57
  - v3.5.15 [#498](https://github.com/davidjbradshaw/iframe-resizer/issues/498) Fix bug "Cannot read property 'firstRun' of undefined" [[Shaun Johansen](https://github.com/shaunjohansen)]. [#517] Fix readyState issue in iFrame [[lostincomputer](https://github.com/lostincomputer)]
58
+
27
59
  - v3.5.14 [#477](https://github.com/davidjbradshaw/iframe-resizer/issues/477) Fix bug when iFrame closed before first resize
60
+
28
61
  - v3.5.13 [#473](https://github.com/davidjbradshaw/iframe-resizer/issues/473) Improve no response from iFrame warning message
62
+
29
63
  - v3.5.12 [#475](https://github.com/davidjbradshaw/iframe-resizer/issues/475) Delay onResize until after the iFrame has resized [[Codener](https://github.com/codener)]
64
+
30
65
  - v3.5.11 [#470](https://github.com/davidjbradshaw/iframe-resizer/issues/470) Fix jQuery reference error [[Russell Schick](https://github.com/rschick)]
66
+
31
67
  - v3.5.10 [#461](https://github.com/davidjbradshaw/iframe-resizer/issues/461) Don't run for server-side render
68
+
32
69
  - v3.5.9 Show warning message if no response from iFrame. [#463](https://github.com/davidjbradshaw/iframe-resizer/issues/463) Suppress warning message when code loaded via module [[Sergey Pereskokov](https://github.com/SerjoPepper)]
70
+
33
71
  - v3.5.8 [#315](https://github.com/davidjbradshaw/iframe-resizer/issues/315) Allow Scrolling to be set to 'auto'
72
+
34
73
  - v3.5.7 [#438](https://github.com/davidjbradshaw/iframe-resizer/issues/438) Check jQuery pluging wrapper not already loaded. [#423](https://github.com/davidjbradshaw/iframe-resizer/issues/423) Properly remove event listeners [[Aaron Hardy](https://github.com/Aaronius)]. [#401](https://github.com/davidjbradshaw/iframe-resizer/issues/401) Make tagged element fall back to all elements if tag not found. [#381](https://github.com/davidjbradshaw/iframe-resizer/issues/381) Fixing disconnect when iframe is missing temporarly [[Jeff Hicken](https://github.com/jhicken)]. Added warnings for missing iFrame and deprecated options
74
+
35
75
  - v3.5.5 [#373](https://github.com/davidjbradshaw/iframe-resizer/issues/373) Add option for custom size calculation methods in iFrame. [#374](https://github.com/davidjbradshaw/iframe-resizer/issues/374) Fix bug with in page links called from parent page
76
+
36
77
  - v3.5.4 [#362](https://github.com/davidjbradshaw/iframe-resizer/issues/362) Handle jQuery being loaded in odd ways. [#297](https://github.com/davidjbradshaw/iframe-resizer/issues/297) Ensure document ready before resizing
78
+
37
79
  - v3.5.3 [#283](https://github.com/davidjbradshaw/iframe-resizer/issues/283) Added _readystatechange_ event listener
80
+
38
81
  - v3.5.2 [#314](https://github.com/davidjbradshaw/iframe-resizer/pull/314) Add iframeHeight and iframeWidth properties to pageInfo [[Pierre Olivier](https://github.com/pomartel)]. [#303](https://github.com/davidjbradshaw/iframe-resizer/issues/303) Fix issue with IE8 polyFils
82
+
39
83
  - v3.5.1 [#286](https://github.com/davidjbradshaw/iframe-resizer/issues/286) Fixed _taggedElement / lowestElement / rightMostElement_ to calculate correct margin [[Dan Ballance](https://github.com/danballance)]
84
+
40
85
  - v3.5.0 Recall getPageInfo callback when parent page position changes. Added _Array.prototype.forEach_ to IE8 polyfils
86
+
41
87
  - v3.4.2 Only teardown events on close if currently enabled
88
+
42
89
  - v3.4.1 [#271](https://github.com/davidjbradshaw/iframe-resizer/issues/271) Fix bower.json to point to _js_ folder, rather then _src_ [[Yachi](https://github.com/yachi)]
90
+
43
91
  - v3.4.0 [#262](https://github.com/davidjbradshaw/iframe-resizer/issues/262) Add _getPageInfo_ method to _parentIFrame_ [[Pierre Olivier](https://github.com/pomartel)]. [#263](https://github.com/davidjbradshaw/iframe-resizer/issues/263) Change _leftMostElement_ to rightMostElement [[Luiz Panariello](https://github.com/LuizPanariello)]. [#265](https://github.com/davidjbradshaw/iframe-resizer/issues/265) Fix issue when no options being passed and added test for this
92
+
44
93
  - v3.3.1 Point index.js to the JS folder, instead of the src folder. Added touch event listeners. _AutoResize_ method now returns current state
94
+
45
95
  - v3.3.0 [#97](https://github.com/davidjbradshaw/iframe-resizer/issues/97) Add _autoResize_ method to _parentIFrame_. Fix bug when _setHeightCalculationMethod_ is called with invalid value. Add interval timer to event teardown. Log targetOrigin\*. [#253](https://github.com/davidjbradshaw/iframe-resizer/issues/253) Work around bug with MooTools interfering with system objects
96
+
46
97
  - v3.2.0 Added calculation of margin to _LowestElement_, _LeftMostElement_ and _taggedElement_ calculation modes. Check callback function is a function before calling it. [#246](https://github.com/davidjbradshaw/iframe-resizer/issues/246) Fixed issue when _onScroll_ changes the page position. [#247](https://github.com/davidjbradshaw/iframe-resizer/issues/247) Fix rounding issue when page is zoomed in Chrome [[thenewguy](https://github.com/thenewguy)]
98
+
47
99
  - v3.1.1 Added _onReady_ to iFrame. Create _iFrameResizer_ object on iFrame during setup, rather than waiting for init message to be returned from iFrame. Add ref to iFrame in host page log messages. [#245](https://github.com/davidjbradshaw/iframe-resizer/issues/245) Fix issue with iFrame not correctly resizing when multiple images are injected into the page [[mdgbayly](https://github.com/mdgbayly)]. [#246](https://github.com/davidjbradshaw/iframe-resizer/issues/246) Fix issue with including ':' in messages passed to iFrames
100
+
48
101
  - v3.1.0 [#101](https://github.com/davidjbradshaw/iframe-resizer/issues/101) Support async loading of iFrame script. [#239](https://github.com/davidjbradshaw/iframe-resizer/issues/239) Throttle size checking to once per screen refresh (16ms). Fixed issue with hidden iFrames in FireFox. Improved handling of parent page events. [#236](https://github.com/davidjbradshaw/iframe-resizer/issues/236) Cope with iFrames that don't have a _src_ value. [#242](https://github.com/davidjbradshaw/iframe-resizer/issues/242) Fix issue where iFrame is removed and then put back with same ID [[Alban Mouton](https://github.com/albanm)]
102
+
49
103
  - v3.0.0 Added _taggedElement_ size calculation method. [#199](https://github.com/davidjbradshaw/iframe-resizer/issues/199) Added in page options to iFrame. [#70](https://github.com/davidjbradshaw/iframe-resizer/issues/70) Added width calculation method options. Added methods to bound iFrames to comunicate from parent to iFrame. Ignore calls to setup an already bound iFrame. Improved event handling. Refactored MutationObserver functions. Moved IE8 polyfil from docs to own JS file and added _Funtion.prototype.bind()_. Added detection for tab focus. Fixed bug with nested inPageLinks. Public methods in iFrame now always enabled and option removed. Renamed enableInPageLinks to inPageLinks. Added double iFrame example
104
+
50
105
  - v2.8.10 Fixed bug with resizeFrom option not having default value in iFrame, if called from old version in parent page
106
+
51
107
  - v2.8.9 [#220](https://github.com/davidjbradshaw/iframe-resizer/issues/220) Switched from using _deviceorientation_ to _orientationchange_ event listner [[Brandon Kobel]/https://github.com/kobelb)]
108
+
52
109
  - v2.8.8 [#213](https://github.com/davidjbradshaw/iframe-resizer/issues/213) Ensure onInit fires when iFrame not sized during initialisation. Check autoResize option before resizing from parent. Lower message about resize before initialisation from 'warn' to 'log'. Updated hover example
110
+
53
111
  - v2.8.7 [#205](https://github.com/davidjbradshaw/iframe-resizer/issues/205) Fix race condition when page resized during page init [[Ian Caunce](https://github.com/IanCaunce)]. [#203](https://github.com/davidjbradshaw/iframe-resizer/issues/203) Added option for _checkOrigin_ to have list of allowed domains for the iFrame [[Andrej Golcov](https://github.com/andrej2k)]. [#202](https://github.com/davidjbradshaw/iframe-resizer/issues/202) Handle script being loaded more than once [[Nickolay Ribal](https://github.com/elektronik2k5)].
54
112
  [#167](https://github.com/davidjbradshaw/iframe-resizer/issues/167) Added WebPack support [[Stephan Salat](https://github.com/ssalat)]
113
+
55
114
  - v2.8.6 [#163](https://github.com/davidjbradshaw/iframe-resizer/issues/163) Moved window resize event detection from iFrame to parent page. [#160](https://github.com/davidjbradshaw/iframe-resizer/issues/160) Warn, rather than error, if iFrame has been unexpectantly removed from page. The _parentIFrame.close()_ method nolonger calls _onResized()_
115
+
56
116
  - v2.8.5 [#173](https://github.com/davidjbradshaw/iframe-resizer/issues/173) Scope settings to iFrame. [#171](https://github.com/davidjbradshaw/iframe-resizer/issues/171) Fixed _parentIFrame.close()_ to work with 0 height iframes [Both [Reed Dadoune](https://github.com/ReedD)]
117
+
57
118
  - v2.8.4 Added switch for inPageLinking support
119
+
58
120
  - v2.8.3 Throw error if passed a non-DOM object
121
+
59
122
  - v2.8.2 [#145](https://github.com/davidjbradshaw/iframe-resizer/issues/145) Fixed in page links, to work with HTML IDs that are not valid CSS IDs [[Erin Millard](https://github.com/ezzatron)]. Moved map files from src to js folder. Added to NPM
123
+
60
124
  - v2.8.1 [#138](https://github.com/davidjbradshaw/iframe-resizer/issues/138) Added option to pass in iFrame object, instead of selector
125
+
61
126
  - v2.8.0 [#68](https://github.com/davidjbradshaw/iframe-resizer/issues/68) Added support for in page links and _onScroll()_ function. [#140](https://github.com/davidjbradshaw/iframe-resizer/issues/140) Added listener for _transitionend_ event [[Mat Brown](https://github.com/outoftime)]. Added listeners for animation events. Added listener for _deviceorientation_ event. Improved logging for nested iFrames
127
+
62
128
  - v2.7.1 [#131](https://github.com/davidjbradshaw/iframe-resizer/issues/131) Fix code that works out position of iFrame on host page
129
+
63
130
  - v2.7.0 [#129](https://github.com/davidjbradshaw/iframe-resizer/issues/129) Parse data passed to _parentIFrame.sendMessage()_ into JSON to allow complex data types to be sent to _onMessage()_
131
+
64
132
  - v2.6.5 [#107](https://github.com/davidjbradshaw/iframe-resizer/issues/107) Added Node support for use with Browserify
133
+
65
134
  - v2.6.4 [#115](https://github.com/davidjbradshaw/iframe-resizer/issues/115) Added _parentIFrame.scrollToOffset()_ method
135
+
66
136
  - v2.6.3 [#115](https://github.com/davidjbradshaw/iframe-resizer/issues/115) Fixed issue with the range check sometimes causing non-resizing messages to be rejected
137
+
67
138
  - v2.6.2 [#104](https://github.com/davidjbradshaw/iframe-resizer/issues/104) Fixed issue with jQuery.noConflict [[Dmitry Mukhutdinov](https://github.com/flyingleafe)]
139
+
68
140
  - v2.6.1 [#91](https://github.com/davidjbradshaw/iframe-resizer/issues/91) Fixed issue with jQuery version requiring empty object if no options are being set
141
+
69
142
  - v2.6.0 Added _parentIFrame.scrollTo()_ method. Added _Tolerance_ option. [#85](https://github.com/davidjbradshaw/iframe-resizer/issues/85) Update troubleshooting guide [[Kevin Sproles](https://github.com/kevinsproles)]
143
+
70
144
  - v2.5.2 [#67](https://github.com/davidjbradshaw/iframe-resizer/issues/67) Allow lowercase `<iframe>` tags for XHTML complience [[SlimerDude](https://github.com/SlimerDude)]. [#69](https://github.com/davidjbradshaw/iframe-resizer/issues/69) Fix watch task typo in gruntfile.js [[Matthew Hupman](https://github.com/mhupman)]. Remove trailing comma in heightCalcMethods array [#76](https://github.com/davidjbradshaw/iframe-resizer/issues/76) [[Fabio Scala](https://github.com/fabioscala)]
145
+
71
146
  - v2.5.1 [#58](https://github.com/davidjbradshaw/iframe-resizer/issues/58) Fixed endless loop and margin issues with an unnested mid-tier iframe. [#59](https://github.com/davidjbradshaw/iframe-resizer/issues/59) Fixed main property of [Bower](https://github.com/http://bower.io/) config file
147
+
72
148
  - v2.5.0 Added _minHeight_, _maxHeight_, _minWidth_ and _maxWidth_ options. Added _onInit_ and _onClosed_ functions (Close event calling _onResized_ is deprecated). Added **grow** and **lowestElement** _heightCalculationMethods_. Added AMD support. [#52](https://github.com/davidjbradshaw/iframe-resizer/issues/52) Added _sendMessage_ example. [#54](https://github.com/davidjbradshaw/iframe-resizer/issues/54) Work around IE8's borked JS execution stack. [#55](https://github.com/davidjbradshaw/iframe-resizer/issues/55) Check datatype of passed in options
149
+
73
150
  - v2.4.8 Fix issue when message passed to onMessage contains a colon
151
+
74
152
  - v2.4.7 [#49](https://github.com/davidjbradshaw/iframe-resizer/issues/49) Deconflict requestAnimationFrame
153
+
75
154
  - v2.4.6 [#46](https://github.com/davidjbradshaw/iframe-resizer/issues/46) Fix iFrame event listener in IE8
155
+
76
156
  - v2.4.5 [#41](https://github.com/davidjbradshaw/iframe-resizer/issues/41) Prevent error in FireFox when body is hidden by CSS [[Scott Otis](https://github.com//Scotis)]
157
+
77
158
  - v2.4.4 Enable nested iFrames ([#31](https://github.com/davidjbradshaw/iframe-resizer/issues/31) Filter incoming iFrame message in host-page script. [#33](https://github.com/davidjbradshaw/iframe-resizer/issues/33) Squash unexpected message warning when using nested iFrames. Improved logging for nested iFrames). [#38](https://github.com/davidjbradshaw/iframe-resizer/issues/38) Detect late image loads that cause a resize due to async image loading in WebKit [[Yassin](https://github.com//ynh)]. Fixed :Hover example in FireFox. Increased trigger timeout lock to 64ms
159
+
78
160
  - v2.4.3 Simplified handling of double fired events. Fixed test coverage
161
+
79
162
  - v2.4.2 Fix missing 'px' unit when resetting height
163
+
80
164
  - v2.4.1 Fix screen flicker issue with scroll height calculation methods in v2.4.0
165
+
81
166
  - v2.4.0 Improved handling of alternate sizing methods, so that they will now shrink on all trigger events, except _Interval_. Prevent error when incoming message to iFrame is an object
167
+
82
168
  - v2.3.2 Fix backwards compatibility issue between V2 iFrame and V1 host-page scripts
169
+
83
170
  - v2.3.1 Added setHeightCalculationMethod() method in iFrame. Added _min_ option to the height calculation methods. Invalid value for _heightCalculationMethod_ is now a warning rather than an error and now falls back to the default value
171
+
84
172
  - v2.3.0 Added extra _heightCalculationMethod_ options. Inject clearFix into 'body' to work around CSS floats preventing the height being correctly calculated. Added meaningful error message for non-valid values in _heightCalculationMethod_. Stop **click** events firing for 50ms after **size** events. Fixed hover example in old IE
173
+
85
174
  - v2.2.3 [#26](https://github.com/davidjbradshaw/iframe-resizer/issues/26) Locally scope jQuery to \$, so there is no dependancy on it being defined globally
175
+
86
176
  - v2.2.2 [#25](https://github.com/davidjbradshaw/iframe-resizer/issues/25) Added click listener to Window, to detect CSS checkbox resize events
177
+
87
178
  - v2.2.1 [#24](https://github.com/davidjbradshaw/iframe-resizer/issues/24) Prevent error when incoming message to host page is an object [[Torjus Eidet](https://github.com/torjue)]
179
+
88
180
  - v2.2.0 Added targetOrigin option to sendMessage function. Added bodyBackground option. Expanded troubleshooting section
181
+
89
182
  - v2.1.1 [#16](https://github.com/davidjbradshaw/iframe-resizer/issues/16) Option to change the height calculation method in the iFrame from offsetHeight to scrollHeight. Troubleshooting section added to docs
183
+
90
184
  - v2.1.0 Added sendMessage() and getId() to window.parentIFrame. Changed width calculation to use scrollWidth. Removed deprecated object name in iFrame
185
+
91
186
  - v2.0.0 Added native JS public function, renamed script filename to reflect that jQuery is now optional. Renamed _do(Heigh/Width)_ to _size(Height/Width)_, renamed _contentWindowBodyMargin_ to _bodyMargin_ and renamed _callback_ _onResized_. Improved logging messages. Stop _resize_ event firing for 50ms after _interval_ event. Added multiple page example. Workout unsized margins inside the iFrame. The _bodyMargin_ property now accepts any valid value for a CSS margin. Check message origin is iFrame. Removed deprecated methods
187
+
92
188
  - v1.4.4 Fixed _bodyMargin_ bug
189
+
93
190
  - v1.4.3 CodeCoverage fixes. Documentation improvements
191
+
94
192
  - v1.4.2 Fixed size(250) example in IE8
193
+
95
194
  - v1.4.1 Setting `interval` to a negative number now forces the interval test to run instead of [MutationObserver](https://developer.mozilla.org/en/docs/Web/API/MutationObserver)
195
+
96
196
  - v1.4.0 [#12](https://github.com/davidjbradshaw/iframe-resizer/issues/12) Option to enable scrolling in iFrame, off by default. [#13](https://github.com/davidjbradshaw/iframe-resizer/issues/13) Bower dependancies updated
197
+
97
198
  - v1.3.7 Stop _resize_ event firing for 50ms after _size_ event. Added size(250) to example
199
+
98
200
  - v1.3.6 [#11](https://github.com/davidjbradshaw/iframe-resizer/issues/11) Updated jQuery to v1.11.0 in example due to IE11 having issues with jQuery v1.10.1
201
+
99
202
  - v1.3.5 Documentation improvements. Added Grunt-Bump to build script
203
+
100
204
  - v1.3.0 IFrame code now uses default values if called with an old version of the host page script. Improved function naming. Old names have been deprecated and removed from docs
205
+
101
206
  - v1.2.5 Fix publish to [plugins.jquery.com](https://plugins.jquery.com)
207
+
102
208
  - v1.2.0 Added autoResize option, added height/width values to iFrame public size function, set HTML tag height to auto, improved documentation [All [Jure Mav](https://github.com/jmav)]. Plus setInterval now only runs in browsers that don't support [MutationObserver](https://developer.mozilla.org/en/docs/Web/API/MutationObserver) and is on by default, sourceMaps added and close() method introduced to parentIFrame object in iFrame
209
+
103
210
  - v1.1.1 Added event type to messageData object
211
+
104
212
  - v1.1.0 Added DOM [MutationObserver](https://developer.mozilla.org/en/docs/Web/API/MutationObserver) trigger to better detect content changes in iFrame, [#7](https://github.com/davidjbradshaw/iframe-resizer/issues/7) Set height of iFrame body element to auto to prevent resizing loop, if it's set to a percentage
213
+
105
214
  - v1.0.3 [#6](https://github.com/davidjbradshaw/iframe-resizer/issues/6) Force incoming messages to string. Migrated to Grunt 4.x. Published to Bower
215
+
106
216
  - v1.0.2 [#2](https://github.com/davidjbradshaw/iframe-resizer/issues/2) mime-type changed for IE8-10
217
+
107
218
  - v1.0.0 Initial pubic release.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013-2019 David J. Bradshaw
3
+ Copyright (c) 2013-2021 David J. Bradshaw
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -18,12 +18,13 @@ This library enables the automatic resizing of the height and width of both same
18
18
  - Fixes in page links in iFrame and supports links between the iFrame and parent page.
19
19
  - Provides custom sizing and scrolling methods.
20
20
  - Exposes parent position and viewport size to the iFrame.
21
+ - Provides `onMouseEnter` and `onMouseLeave` events for the iFrame.
21
22
  - Works with [ViewerJS](http://viewerjs.org/) to support PDF and ODF documents.
22
23
  - Supports IE 11 ([V3 supports back to IE8](https://github.com/davidjbradshaw/iframe-resizer/tree/V3))
23
24
 
24
25
  ## Donate
25
26
 
26
- Iframe-resizer is the result of many 100s of hours of work, if you would like to join others in showing support for the development of this project, then please feel free to buy me a coffee.
27
+ Iframe-resizer is the result of many 100s of hours of work, if you would like to join others in showing support for the continued development of this project, then please feel free to buy me a coffee.
27
28
 
28
29
  <a href="https://www.buymeacoffee.com/davidjbradshaw " target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
29
30
 
@@ -35,7 +36,7 @@ This package can be installed via NPM (`npm install iframe-resizer --save`).
35
36
 
36
37
  ### Usage
37
38
 
38
- The package contains two minified JavaScript files in the [js](https://github.com/davidjbradshaw/iframe-resizer/js) folder. The first ([iframeResizer.min.js](https://raw.githubusercontent.com/davidjbradshaw/iframe-resizer/master/js/iframeResizer.min.js)) is for the page hosting the iFrames. It can be called with via JavaScript:
39
+ The package contains two minified JavaScript files in the [js](https://github.com/davidjbradshaw/iframe-resizer/tree/master/js) folder. The first ([iframeResizer.min.js](https://raw.githubusercontent.com/davidjbradshaw/iframe-resizer/master/js/iframeResizer.min.js)) is for the page hosting the iFrames. It can be called with via JavaScript:
39
40
 
40
41
  ```js
41
42
  const iframes = iFrameResize( [{options}], [css selector] || [iframe] );
@@ -84,19 +85,21 @@ IFrame-Resizer provides an extensive range of options and APIs for both the pare
84
85
  - [React](https://github.com/davidjbradshaw/iframe-resizer-react)
85
86
  - [Vue](https://github.com/davidjbradshaw/iframe-resizer/blob/master/docs/use_with/vue.md)
86
87
  - [Angular](https://github.com/davidjbradshaw/iframe-resizer/issues/478#issuecomment-347958630)
88
+ - [Ember](https://github.com/alexlafroscia/ember-iframe-resizer-modifier)
87
89
  - [jQuery](https://github.com/davidjbradshaw/iframe-resizer/blob/master/docs/use_with/jquery.md)
90
+ - [Google Apps Script](https://stackoverflow.com/a/65724113/2087070)
88
91
  - [Troubleshooting](https://github.com/davidjbradshaw/iframe-resizer/blob/master/docs/troubleshooting.md)
89
92
  - [Upgrade from version 3](https://github.com/davidjbradshaw/iframe-resizer/blob/master/docs/upgrade.md)
90
93
  - [Version history](https://github.com/davidjbradshaw/iframe-resizer/blob/master/CHANGELOG.md)
91
94
 
92
95
  ## License
93
96
 
94
- Copyright &copy; 2013-20 [David J. Bradshaw](https://github.com/davidjbradshaw).
95
- Licensed under the [MIT License](LICENSE).
97
+ Copyright &copy; 2013-21 [David J. Bradshaw](https://github.com/davidjbradshaw) -
98
+ Licensed under the [MIT License](LICENSE)
96
99
 
97
100
  <!--
98
101
  [![NPM](https://nodei.co/npm/iframe-resizer.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/iframe-resizer/)
99
- [![Greenkeeper badge](https://badges.greenkeeper.io/davidjbradshaw/iframe-resizer.svg)](https://greenkeeper.io/)
102
+
100
103
  [![Build Status](https://travis-ci.org/davidjbradshaw/iframe-resizer.svg?branch=master)](https://travis-ci.org/davidjbradshaw/iframe-resizer)
101
104
  [![Known Vulnerabilities](https://snyk.io/test/github/davidjbradshaw/iframe-resizer/badge.svg)](https://snyk.io/test/github/davidjbradshaw/iframe-resizer)
102
105
  -->
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  // eslint-disable-next-line sonarjs/cognitive-complexity, no-shadow-restricted-names
12
- ;(function(undefined) {
12
+ ;(function (undefined) {
13
13
  if (typeof window === 'undefined') return // don't run for server side render
14
14
 
15
15
  var autoResize = true,
@@ -32,6 +32,7 @@
32
32
  interval = 32,
33
33
  intervalTimer = null,
34
34
  logging = false,
35
+ mouseEvents = false,
35
36
  msgID = '[iFrameSizer]', // Must match host page msg ID
36
37
  msgIdLen = msgID.length,
37
38
  myID = '',
@@ -53,17 +54,17 @@
53
54
  widthCalcModeDefault = 'scroll',
54
55
  widthCalcMode = widthCalcModeDefault,
55
56
  win = window,
56
- onMessage = function() {
57
+ onMessage = function () {
57
58
  warn('onMessage function not defined')
58
59
  },
59
- onReady = function() {},
60
- onPageInfo = function() {},
60
+ onReady = function () {},
61
+ onPageInfo = function () {},
61
62
  customCalcMethods = {
62
- height: function() {
63
+ height: function () {
63
64
  warn('Custom height calculation function not defined')
64
65
  return document.documentElement.offsetHeight
65
66
  },
66
- width: function() {
67
+ width: function () {
67
68
  warn('Custom width calculation function not defined')
68
69
  return document.body.scrollWidth
69
70
  }
@@ -78,7 +79,7 @@
78
79
  {},
79
80
  {
80
81
  passive: {
81
- get: function() {
82
+ get: function () {
82
83
  passiveSupported = true
83
84
  }
84
85
  }
@@ -109,8 +110,8 @@
109
110
  result,
110
111
  timeout = null,
111
112
  previous = 0,
112
- later = function() {
113
- previous = getNow()
113
+ later = function () {
114
+ previous = Date.now()
114
115
  timeout = null
115
116
  result = func.apply(context, args)
116
117
  if (!timeout) {
@@ -119,8 +120,8 @@
119
120
  }
120
121
  }
121
122
 
122
- return function() {
123
- var now = getNow()
123
+ return function () {
124
+ var now = Date.now()
124
125
 
125
126
  if (!previous) {
126
127
  previous = now
@@ -152,13 +153,6 @@
152
153
  }
153
154
  }
154
155
 
155
- var getNow =
156
- Date.now ||
157
- function() {
158
- /* istanbul ignore next */ // Not testable in PhantonJS
159
- return new Date().getTime()
160
- }
161
-
162
156
  function formatLogMsg(msg) {
163
157
  return msgID + '[' + myID + '] ' + msg
164
158
  }
@@ -179,7 +173,7 @@
179
173
 
180
174
  function init() {
181
175
  readDataFromParent()
182
- log('Initialising iFrame (' + location.href + ')')
176
+ log('Initialising iFrame (' + window.location.href + ')')
183
177
  readDataFromPage()
184
178
  setMargin()
185
179
  setBodyStyle('background', bodyBackground)
@@ -189,6 +183,7 @@
189
183
  checkWidthMode()
190
184
  stopInfiniteResizingOfIFrame()
191
185
  setupPublicMethods()
186
+ setupMouseEvents()
192
187
  startEventListeners()
193
188
  inPageLinks = setupInPageLinks()
194
189
  sendSize('init', 'Init message from host page')
@@ -216,6 +211,7 @@
216
211
  inPageLinks.enable = undefined !== data[12] ? strBool(data[12]) : false
217
212
  resizeFrom = undefined !== data[13] ? data[13] : resizeFrom
218
213
  widthCalcMode = undefined !== data[14] ? data[14] : widthCalcMode
214
+ mouseEvents = undefined !== data[15] ? Boolean(data[15]) : mouseEvents
219
215
  }
220
216
 
221
217
  function depricate(key) {
@@ -311,7 +307,7 @@
311
307
 
312
308
  function manageTriggerEvent(options) {
313
309
  var listener = {
314
- add: function(eventName) {
310
+ add: function (eventName) {
315
311
  function handleEvent() {
316
312
  sendSize(options.eventName, options.eventType)
317
313
  }
@@ -320,7 +316,7 @@
320
316
 
321
317
  addEventListener(window, eventName, handleEvent, { passive: true })
322
318
  },
323
- remove: function(eventName) {
319
+ remove: function (eventName) {
324
320
  var handleEvent = eventHandlersByName[eventName]
325
321
  delete eventHandlersByName[eventName]
326
322
 
@@ -582,8 +578,11 @@
582
578
  }
583
579
 
584
580
  function checkLocationHash() {
585
- if ('' !== location.hash && '#' !== location.hash) {
586
- findTarget(location.href)
581
+ var hash = window.location.hash
582
+ var href = window.location.href
583
+
584
+ if ('' !== hash && '#' !== hash) {
585
+ findTarget(href)
587
586
  }
588
587
  }
589
588
 
@@ -641,6 +640,22 @@
641
640
  }
642
641
  }
643
642
 
643
+ function setupMouseEvents() {
644
+ if (mouseEvents !== true) return
645
+
646
+ function sendMouse(e) {
647
+ sendMsg(0, 0, e.type, e.screenY + ':' + e.screenX)
648
+ }
649
+
650
+ function addMouseListener(evt, name) {
651
+ log('Add event listener: ' + name)
652
+ addEventListener(window.document, evt, sendMouse)
653
+ }
654
+
655
+ addMouseListener('mouseenter', 'Mouse Enter')
656
+ addMouseListener('mouseleave', 'Mouse Leave')
657
+ }
658
+
644
659
  function setupPublicMethods() {
645
660
  log('Enable public methods')
646
661
 
@@ -671,7 +686,7 @@
671
686
  onPageInfo = callback
672
687
  sendMsg(0, 0, 'pageInfo')
673
688
  } else {
674
- onPageInfo = function() {}
689
+ onPageInfo = function () {}
675
690
  sendMsg(0, 0, 'pageInfoStop')
676
691
  }
677
692
  },
@@ -731,7 +746,7 @@
731
746
  function initInterval() {
732
747
  if (0 !== interval) {
733
748
  log('setInterval: ' + interval + 'ms')
734
- intervalTimer = setInterval(function() {
749
+ intervalTimer = setInterval(function () {
735
750
  sendSize('interval', 'setInterval: ' + interval)
736
751
  }, Math.abs(interval))
737
752
  }
@@ -773,7 +788,7 @@
773
788
 
774
789
  function imageEventTriggered(event, type, typeDesc) {
775
790
  removeImageLoadListener(event.target)
776
- sendSize(type, typeDesc + ': ' + event.target.src, undefined, undefined)
791
+ sendSize(type, typeDesc + ': ' + event.target.src)
777
792
  }
778
793
 
779
794
  function imageLoaded(event) {
@@ -819,7 +834,7 @@
819
834
  observer = createMutationObserver()
820
835
 
821
836
  return {
822
- disconnect: function() {
837
+ disconnect: function () {
823
838
  if ('disconnect' in observer) {
824
839
  log('Disconnect body MutationObserver')
825
840
  observer.disconnect()
@@ -873,7 +888,7 @@
873
888
  elVal = 0,
874
889
  maxVal = 0,
875
890
  Side = capitalizeFirstLetter(side),
876
- timer = getNow()
891
+ timer = Date.now()
877
892
 
878
893
  for (var i = 0; i < elementsLength; i++) {
879
894
  elVal =
@@ -884,7 +899,7 @@
884
899
  }
885
900
  }
886
901
 
887
- timer = getNow() - timer
902
+ timer = Date.now() - timer
888
903
 
889
904
  log('Parsed ' + elementsLength + ' HTML elements')
890
905
  log('Element position calculated in ' + timer + 'ms')
@@ -894,12 +909,12 @@
894
909
  return maxVal
895
910
  }
896
911
 
897
- function getAllMeasurements(dimention) {
912
+ function getAllMeasurements(dimensions) {
898
913
  return [
899
- dimention.bodyOffset(),
900
- dimention.bodyScroll(),
901
- dimention.documentElementOffset(),
902
- dimention.documentElementScroll()
914
+ dimensions.bodyOffset(),
915
+ dimensions.bodyScroll(),
916
+ dimensions.documentElementOffset(),
917
+ dimensions.documentElementScroll()
903
918
  ]
904
919
  }
905
920
 
@@ -911,7 +926,7 @@
911
926
 
912
927
  var elements = document.querySelectorAll('[' + tag + ']')
913
928
 
914
- if (0 === elements.length) noTaggedElementsFound()
929
+ if (elements.length === 0) noTaggedElementsFound()
915
930
 
916
931
  return getMaxElement(side, elements)
917
932
  }
@@ -929,7 +944,7 @@
929
944
  )
930
945
  },
931
946
 
932
- offset: function() {
947
+ offset: function () {
933
948
  return getHeight.bodyOffset() // Backwards compatability
934
949
  },
935
950
 
@@ -1113,7 +1128,7 @@
1113
1128
  log('Trigger event lock on')
1114
1129
  }
1115
1130
  clearTimeout(triggerLockedTimer)
1116
- triggerLockedTimer = setTimeout(function() {
1131
+ triggerLockedTimer = setTimeout(function () {
1117
1132
  triggerLocked = false
1118
1133
  log('Trigger event lock off')
1119
1134
  log('--')
@@ -1175,7 +1190,7 @@
1175
1190
 
1176
1191
  init()
1177
1192
  firstRun = false
1178
- setTimeout(function() {
1193
+ setTimeout(function () {
1179
1194
  initLock = false
1180
1195
  }, eventCancelTimer)
1181
1196
  },