mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Make babelHelpers.inherits even more robust against PhantomJS bugs.
This commit is contained in:
@@ -117,21 +117,21 @@ babelHelpers = {
|
||||
// using babel-runtime is almost certainly using it because of the
|
||||
// ecmascript package, which also implies ecmascript-runtime.
|
||||
Object.getOwnPropertyNames(superClass).forEach(function (k) {
|
||||
if (Object.getOwnPropertyDescriptor(subClass, k)) {
|
||||
// If subClass already has a property by this name, then it
|
||||
// would not be inherited, so it should not be copied. This
|
||||
// notably excludes properties like .prototype and .name.
|
||||
return;
|
||||
}
|
||||
|
||||
// This property descriptor dance preserves getter/setter behavior
|
||||
// in browsers that support accessor properties (all except
|
||||
// IE8). In IE8, the superClass can't have accessor properties
|
||||
// anyway, so this code is still safe.
|
||||
Object.defineProperty(
|
||||
subClass, k,
|
||||
Object.getOwnPropertyDescriptor(superClass, k)
|
||||
);
|
||||
var descriptor = Object.getOwnPropertyDescriptor(superClass, k);
|
||||
if (descriptor && typeof descriptor === "object") {
|
||||
if (Object.getOwnPropertyDescriptor(subClass, k)) {
|
||||
// If subClass already has a property by this name, then it
|
||||
// would not be inherited, so it should not be copied. This
|
||||
// notably excludes properties like .prototype and .name.
|
||||
return;
|
||||
}
|
||||
|
||||
Object.defineProperty(subClass, k, descriptor);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user