Page MenuHomePhabricator

D9781.id33835.diff
No OneTemporary

D9781.id33835.diff

diff --git a/web/vector-utils.js b/web/vector-utils.js
--- a/web/vector-utils.js
+++ b/web/vector-utils.js
@@ -4,14 +4,16 @@
declare class SVGElement extends Element {}
-function htmlTargetFromEvent(event: SyntheticEvent<*>): HTMLElement {
- let target = event.target;
+function htmlTargetFromEvent(event: SyntheticEvent<EventTarget>): HTMLElement {
+ let target: EventTarget = event.target;
while (!(target instanceof HTMLElement)) {
invariant(
target instanceof SVGElement,
- 'non-HTMLElements in typeahead should be SVGElements',
+ 'non-HTMLElements in DOM should be SVGElements',
);
- target = target.parentNode;
+ const { parentNode } = target;
+ invariant(parentNode, 'non-HTMLElements in DOM should have parentNode');
+ target = parentNode;
}
return target;
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 7:49 AM (12 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2703282
Default Alt Text
D9781.id33835.diff (824 B)

Event Timeline