Skip to content

Commit

Permalink
fix invoking element.resizeSensor.resetSensor when it is undefined to…
Browse files Browse the repository at this point in the history
… cause js error (marcj#291)

Co-authored-by: akelley <[email protected]>
  • Loading branch information
Achara and akelley authored Apr 13, 2020
1 parent 97da8b7 commit ee21dfe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ResizeSensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,19 @@
};

this.reset = function() {
element.resizeSensor.resetSensor();
//To prevent invoking element.resizeSensor.resetSensor if it's undefined
if (element.resizeSensor.resetSensor) {
element.resizeSensor.resetSensor();
}
};
};

ResizeSensor.reset = function(element) {
forEachElement(element, function(elem){
elem.resizeSensor.resetSensor();
//To prevent invoking element.resizeSensor.resetSensor if it's undefined
if (element.resizeSensor.resetSensor) {
elem.resizeSensor.resetSensor();
}
});
};

Expand Down

0 comments on commit ee21dfe

Please sign in to comment.