From 037d34d544dbd0fa7498cf70d7f1482b6698e556 Mon Sep 17 00:00:00 2001 From: Myth Date: Thu, 21 Mar 2019 15:31:20 +0800 Subject: [PATCH 1/3] fix: browser compatibility issues --- src/component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/component.ts b/src/component.ts index ded5b29..557bcdb 100644 --- a/src/component.ts +++ b/src/component.ts @@ -109,6 +109,13 @@ const reservedPropertyNames = [ 'filter' ] +const shouldIgnore = { + 'prototype': true, + 'arguments': true, + 'callee': true, + 'caller': true +} + function forwardStaticMembers ( Extended: typeof Vue, Original: typeof Vue, @@ -117,7 +124,7 @@ function forwardStaticMembers ( // We have to use getOwnPropertyNames since Babel registers methods as non-enumerable Object.getOwnPropertyNames(Original).forEach(key => { // `prototype` should not be overwritten - if (key === 'prototype') { + if (shouldIgnore[key]) { return } From 459efcdb82fd3700e978bfcc4ec6ed70cecd70d1 Mon Sep 17 00:00:00 2001 From: Myth Date: Thu, 21 Mar 2019 17:47:56 +0800 Subject: [PATCH 2/3] style: removed the quotes --- src/component.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/component.ts b/src/component.ts index 557bcdb..246b481 100644 --- a/src/component.ts +++ b/src/component.ts @@ -110,10 +110,10 @@ const reservedPropertyNames = [ ] const shouldIgnore = { - 'prototype': true, - 'arguments': true, - 'callee': true, - 'caller': true + prototype: true, + arguments: true, + callee: true, + caller: true } function forwardStaticMembers ( From 58176ff60991913ddbdcfe567522afc96a7f6562 Mon Sep 17 00:00:00 2001 From: Myth Date: Thu, 21 Mar 2019 18:01:33 +0800 Subject: [PATCH 3/3] fix: updated comment --- src/component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/component.ts b/src/component.ts index 246b481..6524e7c 100644 --- a/src/component.ts +++ b/src/component.ts @@ -123,7 +123,7 @@ function forwardStaticMembers ( ): void { // We have to use getOwnPropertyNames since Babel registers methods as non-enumerable Object.getOwnPropertyNames(Original).forEach(key => { - // `prototype` should not be overwritten + // Skip the properties that should not be overwritten if (shouldIgnore[key]) { return }