Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 512ee08

Browse files
authored
Merge pull request gridstack#2518 from adumesny/master
parseHeight() fix
2 parents 370ae2d + 0692ced commit 512ee08

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

doc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Change log
106106
## 9.4.0-dev (TBD)
107107
* fix [#1275](https://github.com/gridstack/gridstack.js/issues/1275) div scale support - Thank you [elmehdiamlou](https://github.com/elmehdiamlou) for implementing this teh right way (add scale to current code)
108108
* fix [#2489](https://github.com/gridstack/gridstack.js/commit/2489) moved the dropped event handler to after doing everything (no more setTimeout) - Thanks [arnoudb](https://github.com/arnoudb) for suggesting a fix.
109+
* fix [#2497](https://github.com/gridstack/gridstack.js/issues/2497) Utils.parseHeight() fix
109110

110111
## 9.4.0 (2023-10-15)
111112
* revert [#2263](https://github.com/gridstack/gridstack.js/issues/2263) div scale support - causing too many issues for now (#2498 #2491)

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ export class Utils {
215215
static parseHeight(val: numberOrString): HeightData {
216216
let h: number;
217217
let unit = 'px';
218-
if (typeof val === 'string') {
218+
if (val && typeof val === 'string') {
219219
if (val === 'auto') h = 0;
220220
else {
221221
let match = val.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%)?$/);
222222
if (!match) {
223-
throw new Error('Invalid height');
223+
throw new Error(`Invalid height val = ${val}`);
224224
}
225225
unit = match[2] || 'px';
226226
h = parseFloat(match[1]);

0 commit comments

Comments
 (0)