Too much recursion 

Higher Order Javascript


   Subscribe in NewsGator Online    Subscribe in Rojo    Add to Google      Add to My AOL   Subscribe in FeedLounge   Add to netvibes  

Brendan Eich's Roadmap  Standard ECMA-262  Yahoo! UI Library     

Friday, August 04, 2006


FireFox innerText

FireFox, Opera innerText fix:
// Firefox InnerText R.E.M 2006
// Credits: Matthias Hertel , Erik Arvidsson, check by jvance
// emulates IE's innertext on Firefox's Proprietary __defineGetter__
if (typeof HTMLElement != "undefined" && typeof HTMLElement.prototype.__defineGetter__ != "undefined") {
HTMLElement.prototype.__defineGetter__("innerText", function () {
if (this.textContent) { return(this.textContent) }
else{var r=this.ownerDocument.createRange(); r.selectNodeContents(this);return r.toString();}});
HTMLElement.prototype.__defineSetter__("innerText", function (sText) {
if (this.textContent) {this.innerHTML=sText.textContent; }
else {this.innerHTML = sText.replace(/\&/g, "&").replace(//g, ">"); }} );
// opera innerText is broken
String.fixText=function($INPUT) {
return $INPUT.replace(/\&/g, "&").replace(/\</g, "<").replace(/\>/g, ">");

Thank you! I didn't know they picked up on it until I saw your comment.
Post a Comment

Links to this post:

Create a Link

<< Home


June 2006   July 2006   August 2006   September 2006  

This page is powered by Blogger. Isn't yours?