This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 8924 - Custom attribute names in dataset
Summary: Custom attribute names in dataset
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://dev.w3.org/html5/spec/Overview...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-10 09:27 UTC by Csaba Marton
Modified: 2010-10-04 14:45 UTC (History)
5 users (show)

See Also:


Attachments

Description Csaba Marton 2010-02-10 09:27:55 UTC
The spec says that custom data must be a lowecase attribute in no namespace. It suggests to use names like "data-doquery-range" and "data-jjo-range" and defines an easy JavaScript accessor for data- attributes (node.dataset.x, node.dataset.y, etc.).

I see inconvenient to access the "data-doquery-range" attribute, because of the hyphen (node.dataset['doquery-range']). It would be better to convert the lowercase data names to Camel case, like the conversion of CSS selectors to JavaScript data members.

Using this conversion the dataset would easily access the "data-doquery-range" by using node.dataset.doqueryRange.

This change would imply the modification of the following algorithms:

* The algorithm for getting the list of name-value pairs
* The algorithm for setting names to certain values
* The algorithm for deleting names

My proposal might also have other impacts, but I see no real reason for not applying these conversions for custom attributes and making programmer's life easier.

Regards,
Csaba
Comment 1 Ian 'Hixie' Hickson 2010-02-14 12:01:18 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter's comments.
Comment 2 Anne 2010-02-14 12:01:36 UTC
Per http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#document-response-entity-body XMLHttpRequest returns the empty string for cookie but only for non same-origin documents. It should always return the empty string however because we also disallow access to Cookie headers. And setting should just be ignored.

I would prefer it if HTML5 could define this so all .cookie information is self-contained.
Comment 3 contributor 2010-02-14 12:01:52 UTC
Checked in as WHATWG revision r4737.
Check-in comment: Make dataset camelCase hyphenated names.
http://html5.org/tools/web-apps-tracker?from=4736&to=4737
Comment 4 Anne 2010-02-14 12:03:18 UTC
My comment was meant for bug 8822. Sorry!