Skip to content

Instantly share code, notes, and snippets.

@bubach
Forked from jonathantneal/HTMLElement.js
Created September 2, 2018 02:04
Show Gist options
  • Save bubach/d6dd3ae62a08c04263315f006423c780 to your computer and use it in GitHub Desktop.
Save bubach/d6dd3ae62a08c04263315f006423c780 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'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment