Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery parser finds custom Array.prototype methods #18

Open
victor-homyakov opened this issue Jul 20, 2012 · 0 comments
Open

jQuery parser finds custom Array.prototype methods #18

victor-homyakov opened this issue Jul 20, 2012 · 0 comments

Comments

@victor-homyakov
Copy link
Contributor

jQuery parser in jQueryGeneric() has for ... in loop on array of event handlers. When oEvents is Array (at least in jQuery 1.6.4) and some custom methods are added to Array.prototype (e.g. shuffle etc.), they all are enumerated in this loop and added as handlers for this particular event:

                for ( j in oEvents ) {
                    var aNodes = [];
                    ...
                        aNodes.push( eventAttachedNode ); // aNodes.push("keydown");
                        ...
                        if ( typeof oEvents[j].origHandler != 'undefined' ) { // typeof oEvents.shuffle.origHandler === 'undefined'
                            func = oEvents[j].origHandler.toString();
                        }
                        else if ( typeof oEvents[j].handler != 'undefined' ) { // typeof oEvents.shuffle.handler === 'undefined'
                            func = oEvents[j].handler.toString();
                        }
                        else {
                            func = oEvents[j].toString(); // func = Array.prototype.shuffle.toString();
                        }
                        ...

If oEvents is Array in all jQuery versions then better will be usual for loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant