Implemented .data() to get the entire data object. Closes #4284

This commit is contained in:
Yehuda Katz 2009-07-16 07:32:25 +00:00
parent 8e54b167cf
commit d36d224cc5
2 changed files with 12 additions and 0 deletions

View file

@ -23,6 +23,8 @@ jQuery.extend({
if ( data !== undefined )
jQuery.cache[ id ][ name ] = data;
if(name === true) return jQuery.cache[ id ]
// Return the named cache data, or the ID for the element
return name ?
jQuery.cache[ id ][ name ] :
@ -98,6 +100,8 @@ jQuery.extend({
jQuery.fn.extend({
data: function( key, value ){
if(typeof key === "undefined" && this.length) return jQuery.data(this[0], true);
var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";