Skip to content

Instantly share code, notes, and snippets.

@chirag64
Forked from joshrhoades/textContentPolyfill.js
Last active August 29, 2015 14:10
Show Gist options
  • Save chirag64/549968d5b334aee8d312 to your computer and use it in GitHub Desktop.
Save chirag64/549968d5b334aee8d312 to your computer and use it in GitHub Desktop.
if (Object.defineProperty && Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(Element.prototype, "textContent") && !Object.getOwnPropertyDescriptor(Element.prototype, "textContent").get) {
(function() {
var innerText = Object.getOwnPropertyDescriptor(Element.prototype, "innerText");
Object.defineProperty(Element.prototype, "textContent",
{
get: function() {
return innerText.get.call(this);
},
set: function(s) {
return innerText.set.call(this, s);
}
}
);
})();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment