Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/browser/register-element.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ function patchCallbacks(target: any, targetName: string, method: string, callbac
if (descriptor && descriptor.value) {
descriptor.value = wrapWithCurrentZone(descriptor.value, source);
_redefineProperty(opts.prototype, callback, descriptor);
} else {
} else if (prototype[callback]) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a check for prototype.hasOwnProperty(callback) a few lines above.
Does it mean that the properties exists, but are falsy? (That would be unexpected.)

@JiaLiPassionJiaLiPassionJan 20, 2019

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, hasOwnProperty return true, but prototype[call back] is undefined.
Some case like this.

var a = {
key: undefined
};
console.log('hasOwnProperty', a.hasOwnProperty('key')); // output is true
console.log('prop', a.key); // output is undefined.

prototype[callback] = wrapWithCurrentZone(prototype[callback], source);
}
} else if (prototype[callback]) {
Expand Down