Skip to content

Instantly share code, notes, and snippets.

@rlemon
Created December 12, 2011 19:43
Show Gist options
  • Select an option

  • Save rlemon/1468750 to your computer and use it in GitHub Desktop.

Select an option

Save rlemon/1468750 to your computer and use it in GitHub Desktop.
@Raynos
("textContent" in Element.prototype) || Object.defineProperty(Element.prototype, "textContent", {
get: function () { return this.innerText; },
set: function (v) { this.innerText = v; }
});
@Zirak
var getText = (function () {
var textProp = 'textContent' in document.createElement( 'div' ) ? 'textContent' : 'innerText';
return function ( elem ) {
return elem[ textProp ];
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment