Commit Graph

61 Commits

Author SHA1 Message Date
Colin Snover
f5d4bf8920 Update jQuery.hasData to always return a boolean, with unit tests. 2010-12-22 14:54:37 -06:00
Colin Snover
faefbb1ad0 Fix #7717 and #7165. Thanks to dmethvin and iliakan for their help fixing these issues. 2010-12-19 15:33:53 -06:00
Colin Snover
11e52bdaea Only try to get data attributes for a jQuery-wrapped object if it is actually an Element node. Fixes #7524. 2010-12-03 01:19:39 -06:00
John Resig
fb48ae8e6c Make sure that when multiple variables are being declared that assignments are each done on their own line. 2010-11-09 11:09:07 -05:00
jeresig
0174518a49 Only need to declare the data once. 2010-10-21 23:18:47 -04:00
John Resig
8a5df39045 Make sure that .data() (no args) returns a list of all the data- properties as well. Also make sure that accessing a data- property via .data() doesn't cause it to change again at a later time (it should be static). Fixes #7222, #7223. 2010-10-17 11:42:53 -04:00
rwldrn
a2aefbf3b1 Fixes acceptData defining in the global scope. 2010-10-05 10:32:57 -04:00
Dave Reed
cb811c04b0 Using data() on JavaScript objects sets fields directly on the object. Note that events are now a property of a function (to avoid JSON serialization - and only in the case of JavaScript objects, not DOM nodes). Fixes #6807. 2010-09-29 06:46:25 -07:00
jeresig
0be7f4eb4f Make sure that opacity is being reset properly on a show animation. Additionally expose jQuery.isNaN from the data module. 2010-09-27 11:51:01 -04:00
jeresig
76db8a9822 Allow data to be bound to Flash objects (but still stopping short of attaching to applets. Fixes #6121. 2010-09-24 16:24:07 -04:00
jeresig
0b4b3ee8a5 Make .data(Object) extend the existing data object. Fixes #6692. 2010-09-22 11:52:32 -04:00
Jacob Wright
626624a19a Fix bug when accessing .data() on an empty set. Return null rather than throwing exception. 2010-09-22 11:38:37 -04:00
jeresig
9dc6e0c572 Applied the RegExp issues reported by Jeff Robinson here: http://jmrware.com/articles/2010/jqueryregex/jQueryRegexes.html Additionally broke out all remaining inline RegExp. Fixes #7062. 2010-09-22 09:16:28 -04:00
jeresig
9ad7c21e70 Make sure the data- number has at least one number in it before passing to isNaN. Thanks to @cms in 8ebb9b22df for a heads-up. 2010-09-22 07:34:31 -04:00
jeresig
3a0a352883 Escape RegExp braces to sooth JSLint's temper. 2010-09-21 08:53:34 -04:00
jeresig
8ebb9b22df Switch to using isNaN instead of RegExp for data-. 2010-09-21 08:31:55 -04:00
jeresig
e0b24306a8 Handle some additional data- number edge cases. 2010-09-21 08:30:12 -04:00
jeresig
1f8a5e4bbc Make sure that the data- import also supports arrays. 2010-09-21 08:20:31 -04:00
John Resig
e7c2d3b45b Added in support for basic JSON object parsing of data- attributes. 2010-09-21 00:51:45 -04:00
John Resig
ae9df1412c Make sure that undefined is returned for not found data- attributes, not null. 2010-09-21 00:44:47 -04:00
John Resig
d5d4e4df65 Tweaked the data number RegExp some to handle some other edge cases. 2010-09-21 00:38:26 -04:00
jeresig
4a46f3d7fb Fixing the problem with data-* based numbers as mention by @jasonwebster in 20673d7. 2010-09-20 20:08:57 -04:00
John Resig
20673d7e58 Pull data-* attributes into .data(). Original code by Andrée Hasson and Paul Irish. Fixes #6921. 2010-09-20 17:47:41 -04:00
jeresig
bca5765502 Make sure that jQuery works even when the individual modules are loaded separately AND jQuery.noConflict(true) is used. Fixes #7011. 2010-09-08 13:54:33 -04:00
John Resig
c4b4df4691 Make sure that .data() events don't bubble, per the discussion in 2e10af143b. Fixes #6832. 2010-07-27 13:45:32 -04:00
Dave Reed
2084e01780 Fix for issues discussed in 9faab0b74f. Goes towards fixing #6808. 2010-07-23 11:25:31 -04:00
InfinitiesLoop
266facc08a Ticket 6808. Updated per code review comments by jeresig 2010-07-23 03:52:02 +08:00
InfinitiesLoop
9faab0b74f Ticket #6808. Changes data() so on plain objects, it uses a function to contain the cache ID to avoid it being JSON serialized. 2010-07-23 03:52:01 +08:00
InfinitiesLoop
2e10af143b Ticket #6804. Adds a changeData event. 2010-07-20 10:12:40 +08:00
John Resig
1533bf7c77 Expose jQuery.uuid (use with caution) and make sure the expando property is used in the events module. 2010-04-24 14:16:27 -07:00
jeresig
8effe3a7de Made it so that you no longer need to build jQuery in order to run the test suite (but you'll still need a checkout of QUnit and Sizzle, at least). 2010-03-23 12:12:16 -04:00
jeresig
a49e6b6313 Attach data directly to plain objects, no reason to use the central jQuery.cache. Fixes #6189. 2010-02-27 09:49:58 -05:00
jeresig
9e06903a99 Make sure that undefined is always returned for undefined data properties. Fixes #6166. 2010-02-26 12:35:04 -05:00
jeresig
a6f3757d50 Found a better detect for deleting an expando, added back in removeAttribute as it does work in IE. 2010-02-13 06:57:58 -05:00
jeresig
9195107dbb Clean up expando removal code - only try to delete the expando from an element if it's possible. 2010-02-13 06:32:20 -05:00
jeresig
98c7248518 Further optimize the empty/remove/cleanData logic. 2010-01-28 15:25:52 -05:00
jeresig
eed69eccc5 Make sure that jQuery.data( elem ) always returns a data object, fixes #5971. Improve the performance of .bind() and .unbind(), fixes #5972. 2010-01-28 14:12:44 -05:00
jeresig
61e37d4149 Made a number of spacing changes to bring the code more-inline with the jQuery Core Style Guideline. 2009-12-21 19:58:13 -05:00
John Resig
f6a0bf6816 Added support for .data(Object), overwriting the existing data object. Fixes #4284. 2009-12-09 13:16:18 -08:00
John Resig
ed93204e10 This is why you don't do commits when you're tired. Fixing bugs from 5980292856. 2009-12-07 07:48:15 -08:00
John Resig
5980292856 Make sure that expando properties aren't set on embed, applet, or object elements. An uncatchable exception is thrown and we must avoid it. Fixes #1675 and #2349. 2009-12-06 20:00:31 -08:00
John Resig
ebad701751 Split the queue code out from data.js into a dedicated queue.js file (also split tests accordingly). 2009-12-06 17:19:33 -05:00
jeresig
bbd933cbfe Added in the .delay() method for delaying the execution of queued functions and animations. 2009-12-04 12:06:47 -05:00
Karl Swedberg
255068da33 added missing semicolons 2009-11-28 04:09:14 +08:00
Karl Swedberg
ddb86f8d5b added curly braces around all if/else statements 2009-11-28 04:09:14 +08:00
Mark Gibson
ef819c91b9 Fixing endlines. 2009-11-25 12:09:53 -05:00
John Resig
67d445a703 A follow-up to [6578] (which stopped adding expandos to elements that didn't have data). That broke jQuery.unique() (so we're now using the unique from Sizzle). Using Sizzle's unique (which also sorts in document order) changed how add, andSelf, parents, nextAll, prevAll, and siblings work. after and before were changed to not use .add() (in order to guarantee their position in the jQuery set). Also, jQuery.data(elem) was updated to return that element's data object (instead of its ID).
$("<div/>").after("<span/>")
=> [ div, span ]
(calling after on a disconnected DOM node adds the nodes to the end of the jQuery set)

$("<div/>").before("<span/>")
=> [ span, div ]
(calling before on a disconnected DOM node adds the nodes to the beginning of the jQuery set)

$("div").add("span")
=> [ div, span, span, div, span ]
(results now come out in document order)

$("div").find("code").andSelf();
=> [ div, code, code ]
(results now come out in document order)

Same goes for .parents(), .nextAll(), .prevAll(), and .siblings().

Exception: .parents() will still return the results in reverse document order.

jQuery.data(elem)
=> { object of data }
(no longer returns the unique ID assigned to the node)
2009-09-25 17:55:20 +00:00
Brandon Aaron
97e134fe80 data should not add expando unless actually adding data 2009-09-15 21:14:08 +00:00
Yehuda Katz
c4f144eeff avoid creating a new data cache if we don't need one. Also, short-circuit the case where $.data is used to get the cache id 2009-09-15 07:59:53 +00:00
Ariel Flesler
19cd84cf32 jquery data: adding missing semicolons 2009-09-15 01:02:18 +00:00