Bug Tracker

Modify

Ticket #6418 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

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

Change History

Changed 3 years ago by abessa7

General Code

comment:1 Changed 3 years ago by abessa7

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

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

comment:2 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.