Skip to content

Instantly share code, notes, and snippets.

@jonathantneal
Last active September 2, 2018 02:04
Show Gist options
  • Save jonathantneal/5ca2cf0d5b0c39c2450d to your computer and use it in GitHub Desktop.
Save jonathantneal/5ca2cf0d5b0c39c2450d to your computer and use it in GitHub Desktop.
HTMLElement polyfill for IE6-7
if (!window.Element) {
(function (prototype) {
function Element() {}
prototype.runtimeStyle.cssText = 'clip:rect(0 0 0 0);height:0;position:absolute;width:0';
document.getElementsByTagName('head')[0].appendChild((window.Element = Element).prototype = prototype).attachEvent('onpropertychange', function (event) {
for (var name = event.propertyName, index = 0, element; element = document.all[index]; ++index) {
if (element !== prototype) {
element[name] = prototype[name];
}
}
});
})(document.createElement('Element'));
}
@Mouvedia
Copy link

Mouvedia commented Jul 3, 2016

prototype.runtimeStyle.cssText = 'clip:rect(0 0 0 0);height:0;position:absolute;width:0';

@jonathantneal What's the reason behind this reset?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment