Skip to main content

Bug Tracker

Side navigation

#6121 closed bug (fixed)

Opened February 18, 2010 05:23PM UTC

Closed September 24, 2010 08:24PM UTC

data function no longer works with OBJECT elements

Reported by: stephenp Owned by:
Priority: undecided Milestone: 1.4.3
Component: data Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

In 1.4, setting data on an OBJECT tag (like a Flash element), doesn't do a thing due to the addition of a "noData" object in the library. It worked fine in 1.3.x.

This is a breaking change and I'm not sure why it's necessary. This busted two of my plugins.

Attachments (2)
  • 6121patch.js (1.3 KB) - added by stephenp March 24, 2010 04:04PM UTC.
  • jquery-1.4.2-potter.js (220.6 KB) - added by stephenp March 24, 2010 03:59PM UTC.

    jQuery with patch applied

Change History (5)

Changed February 18, 2010 09:33PM UTC by john comment:1

component: unfileddata
resolution: → wontfix
status: newclosed

Yep, that's intentional. We can't reliably bind data to object elements without the potential for un-catchable exceptions from occurring. The problem is that when we attach our expando to the object element it's going directly in to the internal plugin - frequently (as is the case with java applets) an uncatchable exception will be thrown that we can't work around. It is a huge bummer but having applications crash was a bigger bummer.

Changed March 24, 2010 04:10PM UTC by stephenp comment:2

resolution: wontfix
status: closedreopened

I have created a simple patch that restores data() support for Flash objects, while forbidding support for other applets. It also offers more flexibility than the current noData approach, which would allow someone to easily add data() support for, say, Silverlight outside of the framework.

Flash object tags always have the same classid attribute. So it's reasonably safe to hard code it. However, if this is something the team isn't cool with, I recommend keeping my patch and just changing noDataElems to

noDataElems: {

"embed": true,

"object": true,

"applet": true


Then plugins can simply override that value and add custom functions to give data() support for their desired elements.

Changed March 24, 2010 04:16PM UTC by stephenp comment:3

My proposed noData function can be further compacted into:

noData: function(elem) {

var isBanned = jQuery.noDataElems[elem.nodeName.toLowerCase()];

return !isBanned ? false : (jQuery.isFunction(isBanned) ? isBanned(elem) : true);


It's your call on that one.

Changed June 18, 2010 01:24AM UTC by dmethvin comment:4

Also, should we perhaps throw an error by default for this case? If the patch was adopted the developer could override the throw and go back to silent fail.

Changed September 24, 2010 08:24PM UTC by john comment:5

priority: → undecided
resolution: → fixed
status: reopenedclosed