Skip to content

Commit 580bd65

Browse files
Address feedback: Avoid infinite loop
1 parent 5df5d93 commit 580bd65

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/common/color-element.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ const Self = class ColorElement extends NudeElement {
158158
return Self.Color.get(color);
159159
}
160160

161-
if (!CSS.supports("color", value)) {
162-
// Not supported or invalid value
161+
if (!CSS.supports("color", value) || !element) {
162+
// Not supported/invalid value, or no element to resolve the color value from
163163
return null;
164164
}
165165

@@ -168,7 +168,7 @@ const Self = class ColorElement extends NudeElement {
168168
let color = getComputedStyle(element).backgroundColor;
169169
element.style.backgroundColor = "";
170170

171-
let resolvedColor = Self.resolveColor(color, element);
171+
let resolvedColor = Self.resolveColor(color);
172172
if (resolvedColor) {
173173
Self.#resolvedColors.set(value, color);
174174
}

0 commit comments

Comments
 (0)