Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
fix(main): Update height and width calculation to prevent NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlee44 committed Nov 3, 2015
1 parent 4e781f0 commit d77e40d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ function augmentWidthOrHeight(element, name, extra, isBorderBox, styles) {
start = name === "Width" ? 1 : 0;
for (i = j = ref = start; j <= 3; i = j += 2) {
if (extra === "margin") {
val += parseFloat(styles["" + extra + cssExpand[i]]);
val += parseFloat(styles["" + extra + cssExpand[i]] || 0);
}
if (isBorderBox) {
if (extra === "content") {
val -= parseFloat(styles["padding" + cssExpand[i]]);
val -= parseFloat(styles["padding" + cssExpand[i]] || 0);
}
if (extra !== "margin") {
val -= parseFloat(styles["border" + cssExpand[i]]);
val -= parseFloat(styles["border" + cssExpand[i]] || 0);
}
} else {
val += parseFloat(styles["padding" + cssExpand[i]]);
val += parseFloat(styles["padding" + cssExpand[i]] || 0);
if (extra !== "padding") {
val += parseFloat(styles["border" + cssExpand + "Width"]);
val += parseFloat(styles["border" + cssExpand + "Width"] || 0);
}
}
}
Expand Down

0 comments on commit d77e40d

Please sign in to comment.