Jquery expands: "jQuery321017184022590797698", what is this?

Asked

Viewed 38 times

1

Observing the window object by the command, of course with jQuery loaded on the page:

console.log (window);

We have the property Function $, known as jQuery global for those who use it, I realize that there is property expanding its value and always jQueryxxx where x is a sequence of random numbers when we load the page!

I suppose this is like an integrity key generated in the current load.

But really what it is?

1 answer

1


jQuery. generates this value of type string 'jQuery' + uniqueid (a unique value)

Until the version 1.4.4, uniqueid is Current timestamp.

From the version 1.5.1, uniqueid is version + Math.Random() with replaced points. To be exact the following logic is used that generates this string:

"jQuery" + (version + Math.random ()).replace (/\D/g, "")

Element[ jQuery.expands ] is a value int / key where the object is stored in jQuery.cache;

jQuery.cache is an object that will store the data values of page elements;

jQuery.cache[ Element[ jQuery.expands ] ] is the representation of the element in object form or type.

For me it was enlightening =D!

Source: https://stackoverflow.com/questions/7200722/jquery-expando-properties/7201455

Behold here a test with jQuery version 1.6.2.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.