1

In Magento 2, if I use my Javascript debugger's console, I notice there's a global object with a jQuery prefix defined.

> jQuery111001331609229091555
Object {events: Object}
events: Object
handle: ( e )
toJSON: ()
__proto__: Object

What is this object? Where does it come from?

1 Answer 1

3

It used by jQuery itself. Looks like for internal in library use.

You should not worry about such object.

But you should worry about using global window and instance of window.jQuery. Prefer way is to use jQuery via RequireJs:

require(['jquery'], function ($) { ... });

or

var $ = require('jquery');
1
  • 1
    Good information, but I didn't ask about using jQuery and RequireJS, or ask where in jQuery's codebase the expando property is defined. I want to know what this second JS object added to the global namespace is, and why it's there, and why it's only sometimes there. Commented Feb 9, 2016 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.