From 0174518a49e86e3f479eaf916a68b64a1e662a4f Mon Sep 17 00:00:00 2001 From: jeresig Date: Thu, 21 Oct 2010 23:18:47 -0400 Subject: [PATCH] Only need to declare the data once. --- src/data.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 ) {