Two days ago I closed tickets #7497 and #7376. Both sample scripts exhibited
the same behavior in IE: after some interaction they fail because
Element.Method methods are invoked on an *extended* node, but still are not
found.

This took me a while to figure out (thanks Joe for Firebug Lite) - suppose
you have a document:

  <div id="test">
    <div id="elly">I'm magical!</div>
  </div>

If you use $('elly') somewhere in your JavaScript then "elly" would get
extended, right? Prototype sets the obscure property "_extended" to true.

Now, suppose you do some string arithmetics after that to add some HTML:

  $('test').innerHTML += "<span>I'm a span!</span>"

Notice the operator. This call "rewrites" content in "test" (including
"elly") and adds a SPAN to the end.

But "elly" is still the same element, right? It remained unchanged? WRONG.

  $('elly')._extended // -> true
  $('elly').show // -> yeah, you wish. ALL added methods are lost

So, method properties are gone, but "_extended" property remained.
Element.extend() never re-applies Element.Method on the node because it
thinks it is already extended.

Workaround? Easy. When we extend a specific element, we shouldn't set
"_extended" to a boolean "true", but to some function:

  element._extended = Prototype.emptyFunction

Now when all methods are wiped from the element, "_extended" property will
be wiped, too, giving Element.extend() a chance to re-apply DOM extensions.

--
http://dev.rubyonrails.org/ticket/7497

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to