Skip to content

Commit 25184b7

Browse files
movedoastasson
authored andcommitted
Fix IE11
1 parent 0181ef2 commit 25184b7

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

src/ResizeSensor.js

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@
8383
* @constructor
8484
*/
8585
var ResizeSensor = function(element, callback) {
86-
86+
8787
var observer;
88-
88+
8989
/**
9090
*
9191
* @constructor
@@ -161,44 +161,44 @@
161161
var lastWidth = size.width;
162162
var lastHeight = size.height;
163163
var initialHiddenCheck = true, resetRAF_id;
164-
165-
164+
165+
166166
var resetExpandShrink_ = function () {
167-
expandChild.style.width = '100000px';
168-
expandChild.style.height = '100000px';
169-
170-
expand.scrollLeft = 100000;
171-
expand.scrollTop = 100000;
172-
173-
shrink.scrollLeft = 100000;
174-
shrink.scrollTop = 100000;
175-
};
167+
expandChild.style.width = '100000px';
168+
expandChild.style.height = '100000px';
169+
170+
expand.scrollLeft = 100000;
171+
expand.scrollTop = 100000;
172+
173+
shrink.scrollLeft = 100000;
174+
shrink.scrollTop = 100000;
175+
};
176176
var reset = function() {
177-
// Check if element is hidden
178-
if (initialHiddenCheck){
179-
if (!expand.scrollTop && !expand.scrollLeft) {
180-
181-
// reset
182-
resetExpandShrink_();
183-
184-
// Check in next frame
185-
if (!resetRAF_id){
186-
resetRAF_id = requestAnimationFrame(function(){
187-
resetRAF_id = 0;
188-
189-
reset();
190-
});
191-
}
192-
193-
return;
194-
}
195-
// Stop checking
196-
else{
197-
initialHiddenCheck = false;
198-
}
199-
}
200-
201-
resetExpandShrink_();
177+
// Check if element is hidden
178+
if (initialHiddenCheck){
179+
if (!expand.scrollTop && !expand.scrollLeft) {
180+
181+
// reset
182+
resetExpandShrink_();
183+
184+
// Check in next frame
185+
if (!resetRAF_id){
186+
resetRAF_id = requestAnimationFrame(function(){
187+
resetRAF_id = 0;
188+
189+
reset();
190+
});
191+
}
192+
193+
return;
194+
}
195+
// Stop checking
196+
else{
197+
initialHiddenCheck = false;
198+
}
199+
}
200+
201+
resetExpandShrink_();
202202
};
203203
element.resizeSensor.resetSensor = reset;
204204

@@ -240,22 +240,22 @@
240240

241241
addEvent(expand, 'scroll', onScroll);
242242
addEvent(shrink, 'scroll', onScroll);
243-
243+
244244
// Fix for custom Elements
245245
requestAnimationFrame(reset);
246246
}
247-
247+
248248
if (typeof ResizeObserver != "undefined") {
249-
observer = new ResizeObserver(function(entries){
250-
for (var entry of entries) {
249+
observer = new ResizeObserver(function(element){
250+
forEachElement(element, function (elem) {
251251
callback.call(
252252
this,
253253
{
254-
width: entry.contentRect.width,
255-
height: entry.contentRect.height
254+
width: elem.contentRect.width,
255+
height: elem.contentRect.height
256256
}
257257
);
258-
}
258+
});
259259
});
260260
if (element !== undefined) {
261261
forEachElement(element, function(elem){

0 commit comments

Comments
 (0)