Skip to main content

Bug Tracker

Side navigation

#14799 closed bug (notabug)

Opened February 14, 2014 11:26PM UTC

Closed February 15, 2014 12:04AM UTC

Last modified February 15, 2014 12:28AM UTC

Data with hyphenated keys, set via plain object, becomes inaccessible via hyphenated key

Reported by: rwaldron Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.11.0-rc1
Keywords: Cc:
Blocked by: Blocking:
Description

test(".data should not miss data-* w/ hyphenated property names #14047", function() {

  expect(2);

  var div = jQuery("<div>");

  div.data({ "foo-bar": 1 });
  div.data( "foo-bar", 2 );

  equal( div.data( "foo-bar" ), 2, "data with property 'foo-bar' was correctly found");
  equal( div.data( "fooBar" ), 2, "data with property 'fooBar' was correctly found");
});

This test fails the first assertion.

Attachments (0)
Change History (2)

Changed February 15, 2014 12:04AM UTC by rwaldron comment:1

resolution: → notabug
status: newclosed

Intentional behaviour.

Changed February 15, 2014 12:28AM UTC by rwaldron comment:2

This can be fixed if jQuery updates both hyphenated and camel case keys

https://github.com/jquery/jquery/pull/1515