fix: C for loop instead of for...of

This commit is contained in:
shirakaba
2022-12-20 19:06:46 +09:00
parent eb8020a90c
commit ab56e114ea

View File

@@ -331,7 +331,10 @@ export class DOMEvent implements Event {
const eventPath = this.getEventPath(target, 'capture'); const eventPath = this.getEventPath(target, 'capture');
// Capturing phase, e.g. [Page, StackLayout, Button] // Capturing phase, e.g. [Page, StackLayout, Button]
for (const currentTarget of eventPath) { // This traditional C loop runs 150 nanoseconds faster than a for...of
// loop.
for (let i = 0; i < eventPath.length; i++) {
const currentTarget = eventPath[i];
this.currentTarget = currentTarget; this.currentTarget = currentTarget;
this.eventPhase = this.target === this.currentTarget ? this.AT_TARGET : this.CAPTURING_PHASE; this.eventPhase = this.target === this.currentTarget ? this.AT_TARGET : this.CAPTURING_PHASE;