Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3529906
D9781.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
824 B
Referenced Files
None
Subscribers
None
D9781.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 25, 9:57 PM (2 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2703282
Default Alt Text
D9781.diff (824 B)
Attached To
Mode
D9781: [Flow202][web][skip-ci] [15/x] Fix Flow issues in htmlTargetFromEvent
Attached
Detach File
Event Timeline
Log In to Comment