You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use Prototype and Classy in the same project, and I ran into an issue with Classy's Class.$noConflict.
I looked into it, and essentially there's a bug in the "old_class = Class" line. Essentially, this assumes that since at this point Class hasn't been defined by Classy, "Class" refers to whatever object is currently using it.
However, because of variable hoisting in JavaScript, the Class variable is actually defined at the beginning of the block. If you debug using Firebug or similar, you will see that Class is undefined, even though it's defined outside the block.
Changing "old_class = Class" to "old_class = root.Class" fixes the issue.
I'm kind of new to GitHub, so I would fork and send you a patch, but this is an easy enough fix.
The text was updated successfully, but these errors were encountered:
I'm trying to use Prototype and Classy in the same project, and I ran into an issue with Classy's Class.$noConflict.
I looked into it, and essentially there's a bug in the "old_class = Class" line. Essentially, this assumes that since at this point Class hasn't been defined by Classy, "Class" refers to whatever object is currently using it.
However, because of variable hoisting in JavaScript, the Class variable is actually defined at the beginning of the block. If you debug using Firebug or similar, you will see that Class is undefined, even though it's defined outside the block.
Changing "old_class = Class" to "old_class = root.Class" fixes the issue.
I'm kind of new to GitHub, so I would fork and send you a patch, but this is an easy enough fix.
The text was updated successfully, but these errors were encountered: