2

I recently asked a question related to jquery's datastore. How to get from an element all the data set using the data method?

I want to better understand the datastore to see if I can fix my problem (data integrity).

I understand the idea of a "numerical pointer to a global hashtable" http://james.padolsey.com/javascript/element-datastorage/

But looking at the jquery source, I'm confused :

    data: function( key, value ){
    var parts = key.split(".");
    parts[1] = parts[1] ? "." + parts[1] : "";

    if ( value === undefined ) {
        var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);

        if ( data === undefined && this.length )
            data = jQuery.data( this[0], key );

        return data === undefined && parts[1] ?
            this.data( parts[0] ) :
            data;
    } else
        return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
            jQuery.data( this, key, value );
        });
},

Why is it using triggerHandler/trigger ? Where can I "see" the data while developing ?

Olivier

Community
  • 1
  • 1
Olivvv
  • 1,140
  • 1
  • 13
  • 37

1 Answers1

2

partial answer : jQuery's data is to be found using jQuery.cache.

Olivvv
  • 1,140
  • 1
  • 13
  • 37