Skip to content

Class.$noConflict doesn't work #7

@SeyelentEco

Description

@SeyelentEco

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions