Bug Tracker

Ticket #6073 (closed bug: wontfix)

Opened 5 years ago

Last modified 5 years ago

$.data doesn't work on object's

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

Description

Slimbox ( http://code.google.com/p/slimbox/source/browse/trunk/js/slimbox2.js#140) relies on $.data to store the old display state of an object tag. But this one doesn't work (I'm using Firefox/3.5.6 on Linux).

Actual result


>>> $.data($("object")[0], "foo", "bar");
>>> $.data($("object")[0], "foo")

Expected result


>>> $.data($("object")[0], "foo", "bar");
"bar"
>>> $.data($("object")[0], "foo")
"bar"

If needed, I can contribute to writing some tests even though they shouldn't be hard to do.

Cheers,

Change History

comment:1 Changed 5 years ago by john

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

That's correct - we no longer store data on object, applet, or embed elements. When you attach expandos directly to those elements you're interacting directly with the internal plugin (such as Java or Flash). We found that a number of critical problems occurred by allowing this (the plugins couldn't understand why a new property was getting added and would throw an uncatchable exception).

In this specific case you're just attaching a boolean property (it's either 'hidden' or 'visible') so perhaps it would be better to use a class? Then you can just use addClass/hasClass to determine the right course of action.

Note: See TracTickets for help on using tickets.