Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 569b1f2

Browse filesBrowse files
committed
fix: determine insertion function up-front
1 parent 8b5efc1 commit 569b1f2
Copy full SHA for 569b1f2

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎packages/core/data/dom-events/dom-event.ts

Copy file name to clipboardExpand all lines: packages/core/data/dom-events/dom-event.ts
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,13 @@ export class DOMEvent implements Event {
208208
return recycledEventPath;
209209
}
210210

211+
// Determining the function up-front (rather than inside the loop) saves
212+
// 50 nanoseconds per dispatchTo() call.
213+
const insert = path === 'capture' ? recycledEventPath.unshift.bind(recycledEventPath) : recycledEventPath.push.bind(recycledEventPath);
214+
211215
let nextResponder = responder.parent;
212216
while (nextResponder) {
213-
path === 'capture' ? recycledEventPath.unshift(nextResponder) : recycledEventPath.push(nextResponder);
217+
insert(nextResponder);
214218

215219
// TODO: decide whether to walk up from Page to Frame, and whether
216220
// to then walk from Frame to Application or something.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.