Thought: what about declaring this method using a setter? Won't affect
IE, and works fine in Mozilla, without touching Prototype's source.

something along the lines of (haven't tested, thinking on gmail):

HTMLElement.prototype.__defineSetter__("innerHTML", function(html) {
  var newEl = this.cloneNode(false);
  newEl.innerHTML = html;
  this.parentNode.replaceChild(newEl, this);
  return html;

This will work in Mozilla, won't work in IE, and you don't need to
modify any existing code. If it works, that is :P


On 9/13/07, Mislav Marohnić <[EMAIL PROTECTED]> wrote:
> On 9/13/07, Ryan Gahl <[EMAIL PROTECTED]> wrote:
> >  You'd be losing attached event observers anyway when you do a plain old 
> > .innerHTML = "..."
> He meant the target element, not the subelements. Yeah, it will remove event 
> handlers. Prototype, however, is able to remove all attached handlers 
> automatically and re-applying them on the new element.
> However, you'll be losing the reference to the old target element if you ever 
> had one.
>   var element = $('foo')
>   element.update("Yeah baby!")
>   element --> no longer in the document tree; you're screwed
> So there are gotchas, true.
>  >

You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to