Skip to content

Commit 5ee2460

Browse files
author
marcj
committed
Fixed double attribute value.
Sensor: Fixed calculation issue.
1 parent 2fda754 commit 5ee2460

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/ElementQueries.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,17 @@
9696
attrValue = '';
9797

9898
if (option.mode == 'min' && actualValue >= value) {
99-
attrValue += ' ' + option.value;
99+
attrValue += option.value;
100100
}
101101

102102
if (option.mode == 'max' && actualValue <= value) {
103-
attrValue += ' ' + option.value;
103+
attrValue += option.value;
104104
}
105105

106106
if (!attrValues[attrName]) attrValues[attrName] = '';
107-
attrValues[attrName] += attrValue;
107+
if (attrValue && -1 === (' '+attrValues[attrName]+' ').indexOf(' ' + attrValue + ' ')) {
108+
attrValues[attrName] += ' ' + attrValue;
109+
}
108110
}
109111

110112
for (var k in attributes) {

src/ResizeSensor.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
if (setupSensor()) {
9696
element.resizedAttached.call();
9797
}
98-
}
98+
};
9999
element.resizeSensor = document.createElement('div');
100100
element.resizeSensor.className = 'resize-sensor';
101101
var style =
@@ -125,14 +125,14 @@
125125
height = element.resizeSensor.offsetHeight;
126126

127127
if (x != width) {
128-
firstStyle.width = width - 1 + 'px';
129-
lastStyle.width = width + 1 + 'px';
128+
firstStyle.width = (width - 1) + 'px';
129+
lastStyle.width = (width + 1) + 'px';
130130
change = true;
131131
x = width;
132132
}
133133
if (y != height) {
134-
firstStyle.height = height - 1 + 'px';
135-
lastStyle.height = height + 1 + 'px';
134+
firstStyle.height = (height - 1) + 'px';
135+
lastStyle.height = (height + 1) + 'px';
136136
change = true;
137137
y = height;
138138
}

0 commit comments

Comments
 (0)