mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
We should use feature detection. Thanks @brendandahl
This commit is contained in:
parent
d70e6ab40c
commit
44d0802700
1 changed files with 10 additions and 3 deletions
|
@ -79,9 +79,16 @@
|
|||
|
||||
// Object.defineProperty() ?
|
||||
(function checkObjectDefinePropertyCompatibility() {
|
||||
// safari 5 and 6 cannot use this on DOM objects and thus it's unusable,
|
||||
if ((typeof Object.defineProperty !== 'undefined') &&
|
||||
!/Safari/.test(navigator.userAgent)) return;
|
||||
if (typeof Object.defineProperty !== 'undefined') {
|
||||
// Some browsers (e.g. safari) cannot use this on DOM objects
|
||||
var definePropertyPossible = true;
|
||||
try {
|
||||
Object.defineProperty(new Image(), 'id', { value: 'test' });
|
||||
} catch (e) {
|
||||
definePropertyPossible = false;
|
||||
}
|
||||
if (definePropertyPossible) return true;
|
||||
}
|
||||
|
||||
Object.defineProperty = function objectDefineProperty(obj, name, def) {
|
||||
delete obj[name];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue