From: jeresig Date: Fri, 22 Oct 2010 03:18:47 +0000 (-0400) Subject: Only need to declare the data once. X-Git-Tag: 1.4.4rc1~18 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0174518a49e86e3f479eaf916a68b64a1e662a4f;p=jquery.git Only need to declare the data once. --- diff --git a/src/data.js b/src/data.js index 31cdc121e..0407f73ff 100644 --- a/src/data.js +++ b/src/data.js @@ -134,9 +134,9 @@ jQuery.extend({ jQuery.fn.extend({ data: function( key, value ) { - if ( typeof key === "undefined" ) { - var data = null; + var data = null; + if ( typeof key === "undefined" ) { if ( this.length ) { var attr = this[0].attributes, name; data = jQuery.data( this[0] ); @@ -163,7 +163,7 @@ jQuery.fn.extend({ parts[1] = parts[1] ? "." + parts[1] : ""; if ( value === undefined ) { - var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); + data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); // Try to fetch any internally stored data first if ( data === undefined && this.length ) {