1
0
Fork 0

IE8 does not support Object.defineProperty on non-DOM objects

(see http://stackoverflow.com/questions/3830800/object-defineproperty-in-es5)
closure/master
Mike Gerwitz 2010-12-21 14:37:34 -05:00
parent e1d7b80d46
commit d5f37f294e
1 changed files with 14 additions and 6 deletions

View File

@ -103,6 +103,8 @@ exports.defineSecureProp = function( obj, prop, value )
obj[ prop ] = value; obj[ prop ] = value;
} }
else else
{
try
{ {
Object.defineProperty( obj, prop, Object.defineProperty( obj, prop,
{ {
@ -113,6 +115,12 @@ exports.defineSecureProp = function( obj, prop, value )
configurable: false, configurable: false,
}); });
} }
catch ( e )
{
// if there's an error (ehem, IE8), fall back
obj[ prop ] = value;
}
}
} }