diff --git a/lib/propobj.js b/lib/propobj.js index 7ea372d..38d59e6 100644 --- a/lib/propobj.js +++ b/lib/propobj.js @@ -46,12 +46,17 @@ var util = require( './util' ), */ exports.setup = function( dest, properties, methods ) { + var obj = dest; + // this constructor is an extra layer atop of the destination object, which // will contain the private methods - var obj_ctor = function() {}; - obj_ctor.prototype = dest; + if ( defprop ) + { + var obj_ctor = function() {}; + obj_ctor.prototype = dest; - var obj = new obj_ctor(); + obj = new obj_ctor(); + } // initialize each of the properties for this instance to // ensure we're not sharing references to prototype values diff --git a/test/test-class-visibility.js b/test/test-class-visibility.js index 2179874..72c72a3 100644 --- a/test/test-class-visibility.js +++ b/test/test-class-visibility.js @@ -479,6 +479,13 @@ var common = require( './common' ), */ ( function testParentsShouldNotHaveAccessToPrivateMembersOfSubtypes() { + // browsers that do not support the property proxy will not support + // encapsulating properties + if ( !( propobj.supportsPropProxy() ) ) + { + return; + } + // property assert.equal( sub_foo.nonOverrideGetProp( '_pfoo' ),