From b47e896389960cc72fb8fd0f2a09c17925dfef58 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Fri, 11 Feb 2011 18:08:35 +0100 Subject: [PATCH] Implement Bootstrap.js changes: Fix Firefox support for beans through __defineGetter/Setter__. Fix redefinition of properties on Safari through call to delete first. --- src/Bootstrap.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Bootstrap.js b/src/Bootstrap.js index 1bcd8dae..cb45b192 100644 --- a/src/Bootstrap.js +++ b/src/Bootstrap.js @@ -44,10 +44,15 @@ new function() { // Bootstrap scope function define(obj, name, desc) { if (_define) - try { return _define(obj, name, desc); } catch (e) {} + try { + // Fix Safari bug of redefining properties even if they are + // configurable + delete obj[name]; + return _define(obj, name, desc); + } catch (e) {} if ((desc.get || desc.set) && obj.__defineGetter__) { - if (desc.get) obj.__defineGetter__(obj, desc.get); - if (desc.set) obj.__defineSetter__(obj, desc.set); + if (desc.get) obj.__defineGetter__(name, desc.get); + if (desc.set) obj.__defineSetter__(name, desc.set); } else { obj[name] = desc.value; }