Bug Tracker

Opened 10 years ago

Closed 10 years ago

#6418 closed bug (invalid)

Possible .data() bug when used on a custom plug-in

Reported by: abessa7 Owned by:
Priority: Milestone: 1.4.2
Component: data Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

I was createing a plug-in using the recommended plug-in construct:

(function($){

$.fn.PLUGIN = function() {

return this.each(function() { });

}

})(jQuery);

In the code I've attached, I have a line that binds data to the plugin:

$(this).data({ Column : Column, Row : Row });

When clicking on the element, I get the following error in IE:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64; Trident/4.0; GTB6.4; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) Timestamp: Sat, 10 Apr 2010 05:45:39 UTC

Message: 'undefined' is null or not an object Line: 55 Char: 143 Code: 0 URI: http://www.webmecompany.com/javascript/jquery-1.4.2.min.js

Can .data() be bound to a plugin's element, or must .data() be bound to an element inside the plugin's "master element"? Note: I no longer receive the error when I change the .data() line to:

$('uiImageSelector input').data({ Column : Column, Row : Row });

I hope this report helps and/or makes sense, feel free to email me with questions, andrewbessa@…

Andrew C Bessa

Attachments (1)

Code.txt (5.2 KB) - added by abessa7 10 years ago.
General Code

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by abessa7

Attachment: Code.txt added

General Code

comment:1 Changed 10 years ago by abessa7

I meant the changed code (at the end) to read:

$('.uiImageSelector input').data({ Column : Column, Row : Row });

comment:2 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

Can you reduce this to the simplest possible test case and reopen the ticket? Thanks.

Note: See TracTickets for help on using tickets.