Skip to content

Instantly share code, notes, and snippets.

@dotspencer
Last active November 24, 2020 18:31
Show Gist options
  • Save dotspencer/84ce9878df84023f11a94e14a6e91711 to your computer and use it in GitHub Desktop.
Save dotspencer/84ce9878df84023f11a94e14a6e91711 to your computer and use it in GitHub Desktop.
Default attributes on window (chrome)
(() => {
const defaultKeys = {"window":true,"self":true,"document":true,"name":true,"location":true,"customElements":true,"history":true,"locationbar":true,"menubar":true,"personalbar":true,"scrollbars":true,"statusbar":true,"toolbar":true,"status":true,"closed":true,"frames":true,"length":true,"top":true,"opener":true,"parent":true,"frameElement":true,"navigator":true,"origin":true,"external":true,"screen":true,"innerWidth":true,"innerHeight":true,"scrollX":true,"pageXOffset":true,"scrollY":true,"pageYOffset":true,"visualViewport":true,"screenX":true,"screenY":true,"outerWidth":true,"outerHeight":true,"devicePixelRatio":true,"clientInformation":true,"screenLeft":true,"screenTop":true,"defaultStatus":true,"defaultstatus":true,"styleMedia":true,"onsearch":true,"isSecureContext":true,"performance":true,"onappinstalled":true,"onbeforeinstallprompt":true,"crypto":true,"indexedDB":true,"webkitStorageInfo":true,"sessionStorage":true,"localStorage":true,"onabort":true,"onblur":true,"oncancel":true,"oncanplay":true,"oncanplaythrough":true,"onchange":true,"onclick":true,"onclose":true,"oncontextmenu":true,"oncuechange":true,"ondblclick":true,"ondrag":true,"ondragend":true,"ondragenter":true,"ondragleave":true,"ondragover":true,"ondragstart":true,"ondrop":true,"ondurationchange":true,"onemptied":true,"onended":true,"onerror":true,"onfocus":true,"onformdata":true,"oninput":true,"oninvalid":true,"onkeydown":true,"onkeypress":true,"onkeyup":true,"onload":true,"onloadeddata":true,"onloadedmetadata":true,"onloadstart":true,"onmousedown":true,"onmouseenter":true,"onmouseleave":true,"onmousemove":true,"onmouseout":true,"onmouseover":true,"onmouseup":true,"onmousewheel":true,"onpause":true,"onplay":true,"onplaying":true,"onprogress":true,"onratechange":true,"onreset":true,"onresize":true,"onscroll":true,"onseeked":true,"onseeking":true,"onselect":true,"onstalled":true,"onsubmit":true,"onsuspend":true,"ontimeupdate":true,"ontoggle":true,"onvolumechange":true,"onwaiting":true,"onwebkitanimationend":true,"onwebkitanimationiteration":true,"onwebkitanimationstart":true,"onwebkittransitionend":true,"onwheel":true,"onauxclick":true,"ongotpointercapture":true,"onlostpointercapture":true,"onpointerdown":true,"onpointermove":true,"onpointerup":true,"onpointercancel":true,"onpointerover":true,"onpointerout":true,"onpointerenter":true,"onpointerleave":true,"onselectstart":true,"onselectionchange":true,"onanimationend":true,"onanimationiteration":true,"onanimationstart":true,"ontransitionrun":true,"ontransitionstart":true,"ontransitionend":true,"ontransitioncancel":true,"onafterprint":true,"onbeforeprint":true,"onbeforeunload":true,"onhashchange":true,"onlanguagechange":true,"onmessage":true,"onmessageerror":true,"onoffline":true,"ononline":true,"onpagehide":true,"onpageshow":true,"onpopstate":true,"onrejectionhandled":true,"onstorage":true,"onunhandledrejection":true,"onunload":true,"alert":true,"atob":true,"blur":true,"btoa":true,"cancelAnimationFrame":true,"cancelIdleCallback":true,"captureEvents":true,"clearInterval":true,"clearTimeout":true,"close":true,"confirm":true,"createImageBitmap":true,"fetch":true,"find":true,"focus":true,"getComputedStyle":true,"getSelection":true,"matchMedia":true,"moveBy":true,"moveTo":true,"open":true,"postMessage":true,"print":true,"prompt":true,"queueMicrotask":true,"releaseEvents":true,"requestAnimationFrame":true,"requestIdleCallback":true,"resizeBy":true,"resizeTo":true,"scroll":true,"scrollBy":true,"scrollTo":true,"setInterval":true,"setTimeout":true,"stop":true,"webkitCancelAnimationFrame":true,"webkitRequestAnimationFrame":true,"chrome":true,"speechSynthesis":true,"onpointerrawupdate":true,"trustedTypes":true,"crossOriginIsolated":true,"openDatabase":true,"webkitRequestFileSystem":true,"webkitResolveLocalFileSystemURL":true};
const added = Object.keys(window).filter(k => !defaultKeys[k]).map(k => [k, window[k]]);
console.log('added:', added);
})();
{
"window": true,
"self": true,
"document": true,
"name": true,
"location": true,
"customElements": true,
"history": true,
"locationbar": true,
"menubar": true,
"personalbar": true,
"scrollbars": true,
"statusbar": true,
"toolbar": true,
"status": true,
"closed": true,
"frames": true,
"length": true,
"top": true,
"opener": true,
"parent": true,
"frameElement": true,
"navigator": true,
"origin": true,
"external": true,
"screen": true,
"innerWidth": true,
"innerHeight": true,
"scrollX": true,
"pageXOffset": true,
"scrollY": true,
"pageYOffset": true,
"visualViewport": true,
"screenX": true,
"screenY": true,
"outerWidth": true,
"outerHeight": true,
"devicePixelRatio": true,
"clientInformation": true,
"screenLeft": true,
"screenTop": true,
"defaultStatus": true,
"defaultstatus": true,
"styleMedia": true,
"onsearch": true,
"isSecureContext": true,
"performance": true,
"onappinstalled": true,
"onbeforeinstallprompt": true,
"crypto": true,
"indexedDB": true,
"webkitStorageInfo": true,
"sessionStorage": true,
"localStorage": true,
"onabort": true,
"onblur": true,
"oncancel": true,
"oncanplay": true,
"oncanplaythrough": true,
"onchange": true,
"onclick": true,
"onclose": true,
"oncontextmenu": true,
"oncuechange": true,
"ondblclick": true,
"ondrag": true,
"ondragend": true,
"ondragenter": true,
"ondragleave": true,
"ondragover": true,
"ondragstart": true,
"ondrop": true,
"ondurationchange": true,
"onemptied": true,
"onended": true,
"onerror": true,
"onfocus": true,
"onformdata": true,
"oninput": true,
"oninvalid": true,
"onkeydown": true,
"onkeypress": true,
"onkeyup": true,
"onload": true,
"onloadeddata": true,
"onloadedmetadata": true,
"onloadstart": true,
"onmousedown": true,
"onmouseenter": true,
"onmouseleave": true,
"onmousemove": true,
"onmouseout": true,
"onmouseover": true,
"onmouseup": true,
"onmousewheel": true,
"onpause": true,
"onplay": true,
"onplaying": true,
"onprogress": true,
"onratechange": true,
"onreset": true,
"onresize": true,
"onscroll": true,
"onseeked": true,
"onseeking": true,
"onselect": true,
"onstalled": true,
"onsubmit": true,
"onsuspend": true,
"ontimeupdate": true,
"ontoggle": true,
"onvolumechange": true,
"onwaiting": true,
"onwebkitanimationend": true,
"onwebkitanimationiteration": true,
"onwebkitanimationstart": true,
"onwebkittransitionend": true,
"onwheel": true,
"onauxclick": true,
"ongotpointercapture": true,
"onlostpointercapture": true,
"onpointerdown": true,
"onpointermove": true,
"onpointerup": true,
"onpointercancel": true,
"onpointerover": true,
"onpointerout": true,
"onpointerenter": true,
"onpointerleave": true,
"onselectstart": true,
"onselectionchange": true,
"onanimationend": true,
"onanimationiteration": true,
"onanimationstart": true,
"ontransitionrun": true,
"ontransitionstart": true,
"ontransitionend": true,
"ontransitioncancel": true,
"onafterprint": true,
"onbeforeprint": true,
"onbeforeunload": true,
"onhashchange": true,
"onlanguagechange": true,
"onmessage": true,
"onmessageerror": true,
"onoffline": true,
"ononline": true,
"onpagehide": true,
"onpageshow": true,
"onpopstate": true,
"onrejectionhandled": true,
"onstorage": true,
"onunhandledrejection": true,
"onunload": true,
"alert": true,
"atob": true,
"blur": true,
"btoa": true,
"cancelAnimationFrame": true,
"cancelIdleCallback": true,
"captureEvents": true,
"clearInterval": true,
"clearTimeout": true,
"close": true,
"confirm": true,
"createImageBitmap": true,
"fetch": true,
"find": true,
"focus": true,
"getComputedStyle": true,
"getSelection": true,
"matchMedia": true,
"moveBy": true,
"moveTo": true,
"open": true,
"postMessage": true,
"print": true,
"prompt": true,
"queueMicrotask": true,
"releaseEvents": true,
"requestAnimationFrame": true,
"requestIdleCallback": true,
"resizeBy": true,
"resizeTo": true,
"scroll": true,
"scrollBy": true,
"scrollTo": true,
"setInterval": true,
"setTimeout": true,
"stop": true,
"webkitCancelAnimationFrame": true,
"webkitRequestAnimationFrame": true,
"chrome": true,
"speechSynthesis": true,
"onpointerrawupdate": true,
"trustedTypes": true,
"crossOriginIsolated": true,
"openDatabase": true,
"webkitRequestFileSystem": true,
"webkitResolveLocalFileSystemURL": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment