Skip to main content

Bug Tracker

Side navigation

#12270 closed enhancement (duplicate)

Opened August 12, 2012 12:43PM UTC

Closed August 12, 2012 06:00PM UTC

Unify .data() with HTML5 data attribute.

Reported by: mstefanow@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

[[Image(http://i273.photobucket.com/albums/jj226/stefek99/ScreenShot2012-08-12at133742.png)]]

http://api.jquery.com/data/#data-html5

"As of jQuery 1.4.3 HTML 5 data- attributes will be automatically pulled in to jQuery's data object. '

How about other way round? Enabling .data("value", "param") to be available outside of jQuery?

See the top comments by Ryan Kinal:

"It would be awesome if it were the element instead, but that is not the case."

Attachments (0)
Change History (3)

Changed August 12, 2012 12:59PM UTC by scottgonzalez comment:1

Why not just set the data- attribute if that's what you want? Attributes can only store strings, while .data() can store any type of value.

Changed August 12, 2012 01:25PM UTC by anonymous comment:2

Replying to [comment:1 scott.gonzalez]:

Why not just set the data- attribute if that's what you want? Attributes can only store strings, while .data() can store any type of value.

Just saying that for string-only values jQuery can serve two way compatibility.

Posted as an "enhancement" for a discussion.

Changed August 12, 2012 06:00PM UTC by rwaldron comment:3

resolution: → duplicate
status: newclosed

Reading is cheap, writing is not. data() precedes "data-*" and has semantics of its own to consider. Also this is probably a duplicate, but I can't find the original.