From 8caeda7e3990cd32958c8d065504bdb13af9625f Mon Sep 17 00:00:00 2001 From: Cody Mize Date: Sun, 5 Apr 2015 04:59:22 -0400 Subject: [PATCH] Fetch descriptor from prototype chain --- zone.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/zone.js b/zone.js index 4afc557c1..f754fde43 100644 --- a/zone.js +++ b/zone.js @@ -644,11 +644,18 @@ Zone.patchRegisterElement = function () { 'detachedCallback', 'attributeChangedCallback' ]; + var getPropertyDescriptor = function(obj, prop) { + var descriptor; + while (obj && !(descriptor = Object.getOwnPropertyDescriptor(obj, prop))) { + obj = obj.__proto__; + } + return descriptor; + }; document.registerElement = function (name, opts) { callbacks.forEach(function (callback) { if (opts.prototype[callback]) { - var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback); - if (descriptor.value) { + var descriptor = getPropertyDescriptor(opts.prototype, callback); + if (descriptor && descriptor.value) { descriptor.value = zone.bind(descriptor.value || opts.prototype[callback]); Zone._redefineProperty(opts.prototype, callback, descriptor); }