Skip to content

Commit 4ac9a2d

Browse files
committed
bugfix: resetTriggers should check __resizeTriggers__
1 parent e0ba76b commit 4ac9a2d

File tree

4 files changed

+32
-24
lines changed

4 files changed

+32
-24
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "javascript-detect-element-resize",
3-
"version": "0.5.3-solit",
3+
"version": "0.5.4-solit",
44
"main": "detect-element-resize.js",
55
"repository": {
66
"type": "git",

detect-element-resize.js

+15-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* https://github.com/sdecima/javascript-detect-element-resize
55
* Sebastian Decima
66
*
7-
* version: 0.5.3
7+
* version: 0.5.4
88
**/
99

1010
(function () {
@@ -25,16 +25,20 @@
2525
})();
2626

2727
function resetTriggers(element){
28-
var triggers = element.__resizeTriggers__,
29-
expand = triggers.firstElementChild,
30-
contract = triggers.lastElementChild,
31-
expandChild = expand.firstElementChild;
32-
contract.scrollLeft = contract.scrollWidth;
33-
contract.scrollTop = contract.scrollHeight;
34-
expandChild.style.width = expand.offsetWidth + 1 + 'px';
35-
expandChild.style.height = expand.offsetHeight + 1 + 'px';
36-
expand.scrollLeft = expand.scrollWidth;
37-
expand.scrollTop = expand.scrollHeight;
28+
var triggers = element.__resizeTriggers__;
29+
30+
if (triggers) {
31+
var expand = triggers.firstElementChild,
32+
contract = triggers.lastElementChild,
33+
expandChild = expand.firstElementChild;
34+
35+
contract.scrollLeft = contract.scrollWidth;
36+
contract.scrollTop = contract.scrollHeight;
37+
expandChild.style.width = expand.offsetWidth + 1 + 'px';
38+
expandChild.style.height = expand.offsetHeight + 1 + 'px';
39+
expand.scrollLeft = expand.scrollWidth;
40+
expand.scrollTop = expand.scrollHeight;
41+
}
3842
};
3943

4044
function checkTriggers(element){

jquery.resize.js

+15-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* https://github.com/sdecima/javascript-detect-element-resize
55
* Sebastian Decima
66
*
7-
* version: 0.5.3
7+
* version: 0.5.4
88
**/
99

1010
(function ( $ ) {
@@ -42,16 +42,20 @@
4242
})();
4343

4444
function resetTriggers(element){
45-
var triggers = element.__resizeTriggers__,
46-
expand = triggers.firstElementChild,
47-
contract = triggers.lastElementChild,
48-
expandChild = expand.firstElementChild;
49-
contract.scrollLeft = contract.scrollWidth;
50-
contract.scrollTop = contract.scrollHeight;
51-
expandChild.style.width = expand.offsetWidth + 1 + 'px';
52-
expandChild.style.height = expand.offsetHeight + 1 + 'px';
53-
expand.scrollLeft = expand.scrollWidth;
54-
expand.scrollTop = expand.scrollHeight;
45+
var triggers = element.__resizeTriggers__;
46+
47+
if (triggers) {
48+
var expand = triggers.firstElementChild,
49+
contract = triggers.lastElementChild,
50+
expandChild = expand.firstElementChild;
51+
52+
contract.scrollLeft = contract.scrollWidth;
53+
contract.scrollTop = contract.scrollHeight;
54+
expandChild.style.width = expand.offsetWidth + 1 + 'px';
55+
expandChild.style.height = expand.offsetHeight + 1 + 'px';
56+
expand.scrollLeft = expand.scrollWidth;
57+
expand.scrollTop = expand.scrollHeight;
58+
}
5559
};
5660

5761
function checkTriggers(element){

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "javascript-detect-element-resize",
3-
"version": "0.5.3-solit",
3+
"version": "0.5.4-solit",
44
"description": "A Cross-Browser, Event-based, Element Resize Detection",
55
"main": "detect-element-resize.js",
66
"directories": {

0 commit comments

Comments
 (0)