Skip to content

Instantly share code, notes, and snippets.

@hax hax/gist:3482308
Created Aug 26, 2012

What would you like to do?
How to create a naked Object in old Browsers (eg. IE 6,7,8) which not support Object.create(null) or {__proto__: null}
function nakedObject() {
var iframe = document.createElement('iframe')
iframe.width = iframe.height = 0 = 'none'
iframe.src = 'javascript:'
var proto = iframe.contentWindow.Object.prototype
iframe = null
var props = [
'constructor', 'hasOwnProperty', 'propertyIsEnumerable',
'isPrototypeOf', 'toLocaleString', 'toString', 'valueOf'
for (var i = 0; i < props.length; i++) {
delete proto[props[i]]
return proto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.