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 24096 - Clarify element.dataset delete algorithm
Summary: Clarify element.dataset delete algorithm
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-14 08:53 UTC by sof
Modified: 2014-01-03 22:37 UTC (History)
2 users (show)

See Also:


Attachments

Description sof 2013-12-14 08:53:55 UTC
Assuming element.setAttribute("data--n", "o") has been performed on an element, element.dataset will report [ ("N", "o") ] in its key-value list result.

Per "The algorithm for deleting names",

 http://www.whatwg.org/specs/web-apps/current-work/#embedding-custom-non-visible-data-with-the-data-*-attributes

'delete element.dataset["N"]'  will remove the "data--n" property.

But so will 'delete element.dataset["-n"]'.

It seems slightly odd to admit this second form also. Trident (IE11) implements this, others don't, ignoring the deletion.

Should the delete steps have an extra step that corresponds to step 3 from the "setting" algorithm (but is non-throwing)? Or stay as-is as the current behaviour is intentional?

If the latter, perhaps a note can be added to clarify that "deletion" does allow untranslated minus-lowercase pairs to pass through verbatim?
Comment 1 contributor 2013-12-16 23:01:27 UTC
Checked in as WHATWG revision r8359.
Check-in comment: Clarify that the delete dataset[foo] algorithm doesn't get invoked for values of 'foo' that don't exist.
http://html5.org/tools/web-apps-tracker?from=8358&to=8359
Comment 2 Ian 'Hixie' Hickson 2013-12-16 23:02:13 UTC
If I'm not mistaken, what's going on here is that IE11 has a WebIDL bug, and that the deleter algorithm in HTML won't get invoked unless the property name exists.
Comment 3 sof 2013-12-17 07:16:45 UTC
That looks accurate, the "named property visibility algorithm" (a predicate) needs to pass before the deleter is applied.

Thanks for the clarification, could the note be made a bit a stronger? ("can get" => "will only be".)
Comment 4 contributor 2014-01-03 22:37:50 UTC
Checked in as WHATWG revision r8371.
Check-in comment: Clarification regarding 'The algorithm for deleting names' for dataset.
http://html5.org/tools/web-apps-tracker?from=8370&to=8371