mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Update to latest straps.js
Enabling paper.install(window) again.
This commit is contained in:
parent
6bb681b56d
commit
268003f241
1 changed files with 26 additions and 23 deletions
|
@ -45,8 +45,20 @@ var Base = new function() {
|
||||||
// support Firefox 3.5 & 3.6, and this hack works there:
|
// support Firefox 3.5 & 3.6, and this hack works there:
|
||||||
return { __proto__: proto };
|
return { __proto__: proto };
|
||||||
},
|
},
|
||||||
_define = Object.defineProperty || function(obj, name, desc) {
|
_define = Object.defineProperty,
|
||||||
// Emulate Object.defineProperty for outdated browsers
|
_describe = Object.getOwnPropertyDescriptor;
|
||||||
|
|
||||||
|
function define(obj, name, desc) {
|
||||||
|
try {
|
||||||
|
// Unfortunately Safari seems to ignore configurable: true and does
|
||||||
|
// not override existing properties, so we need to delete first:
|
||||||
|
delete obj[name];
|
||||||
|
return _define(obj, name, desc);
|
||||||
|
} catch (e) {}
|
||||||
|
// Emulate Object.defineProperty for outdated browsers.
|
||||||
|
// NOTE: We're also falling back on this scenario currently when the
|
||||||
|
// above trigggers an exception, e.g. when using Base.define on the
|
||||||
|
// window object.
|
||||||
if ((desc.get || desc.set) && obj.__defineGetter__) {
|
if ((desc.get || desc.set) && obj.__defineGetter__) {
|
||||||
if (desc.get)
|
if (desc.get)
|
||||||
obj.__defineGetter__(name, desc.get);
|
obj.__defineGetter__(name, desc.get);
|
||||||
|
@ -56,32 +68,23 @@ var Base = new function() {
|
||||||
obj[name] = desc.value;
|
obj[name] = desc.value;
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
},
|
|
||||||
_describe = Object.getOwnPropertyDescriptor || function(obj, name) {
|
|
||||||
// Emulate Object.getOwnPropertyDescriptor for outdated browsers
|
|
||||||
var get = obj.__lookupGetter__ && obj.__lookupGetter__(name);
|
|
||||||
return get
|
|
||||||
? { get: get, set: obj.__lookupSetter__(name),
|
|
||||||
enumerable: true, configurable: true }
|
|
||||||
: obj.hasOwnProperty(name)
|
|
||||||
? { value: obj[name], enumerable: true,
|
|
||||||
configurable: true, writable: true }
|
|
||||||
: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
function define(obj, name, desc) {
|
|
||||||
try {
|
|
||||||
// Unfortunately Safari seems to ignore configurable: true and does
|
|
||||||
// not override existing properties, so we need to delete first:
|
|
||||||
delete obj[name];
|
|
||||||
return _define(obj, name, desc);
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function describe(obj, name) {
|
function describe(obj, name) {
|
||||||
try {
|
try {
|
||||||
return _describe(obj, name);
|
return _describe(obj, name);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
// Emulate Object.getOwnPropertyDescriptor for outdated browsers
|
||||||
|
// NOTE: We're also falling back on this scenario currently when the
|
||||||
|
// above trigggers an exception.
|
||||||
|
var get = obj.__lookupGetter__ && obj.__lookupGetter__(name);
|
||||||
|
return get
|
||||||
|
? { get: get, set: obj.__lookupSetter__(name),
|
||||||
|
enumerable: true, configurable: true }
|
||||||
|
: obj.hasOwnProperty(name)
|
||||||
|
? { value: obj[name], writable: true ,
|
||||||
|
enumerable: true, configurable: true }
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue