Skip to content

Commit

Permalink
Only need to declare the data once.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Oct 22, 2010
1 parent 4fcfee4 commit 0174518
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/data.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ jQuery.extend({


jQuery.fn.extend({ jQuery.fn.extend({
data: function( key, value ) { data: function( key, value ) {
if ( typeof key === "undefined" ) { var data = null;
var data = null;


if ( typeof key === "undefined" ) {
if ( this.length ) { if ( this.length ) {
var attr = this[0].attributes, name; var attr = this[0].attributes, name;
data = jQuery.data( this[0] ); data = jQuery.data( this[0] );
Expand All @@ -163,7 +163,7 @@ jQuery.fn.extend({
parts[1] = parts[1] ? "." + parts[1] : ""; parts[1] = parts[1] ? "." + parts[1] : "";


if ( value === undefined ) { 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 // Try to fetch any internally stored data first
if ( data === undefined && this.length ) { if ( data === undefined && this.length ) {
Expand Down

1 comment on commit 0174518

@jitter
Copy link
Contributor

@jitter jitter commented on 0174518 Oct 22, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#7239 can be closed now (?)

Please sign in to comment.