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

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.