{"action":"created","comment":{"url":"https://api.github.com/repos/jquery/jquery/pulls/comments/22399481","id":22399481,"diff_hunk":"@@ -682,4 +682,28 @@ testIframeWithCallback( \"enumerate data attrs on body (#14894)\", \"data/dataAttrs\n \texpect(1);\n \n \tequal(result, \"ok\", \"enumeration of data- attrs on body\" );\n+});\n+\n+test(\".data should update as-is if added without camel casing (PR 1.x-master #1905)\", function() {\n+\texpect(5);\n+\tvar div = jQuery(\"<div></div>\").prependTo(\"body\");\n+\tdiv.data({\n+\t\t\"data-test-1\": \"data1\",\n+\t\t\"data-test-2\": \"data2\"\n+\t});\n+\tequal( div.data()[\"data-test-1\"], \"data1\", \"Verifing data update succesful with object\" );\n+\t\n+\t//the purpose of the below test is to remove this patch once we stop using $.extend to create data \n+\t//when using object notation. This is expected to fail if jQuery decides to camelCase always.\n+\tequal( div.data()[\"dataTest1\"], undefined, \"Verifying it is not camel cased when adding as object\" );\n+\t\n+\t//update data-test-1\n+\tdiv.data(\"data-test-1\", \"data1_updated\");\n+\tequal( div.data()[\"data-test-1\"], \"data1_updated\", \"Verifying .update() updating the right data\" );\n+\t\n+\t//remove data-test-1 and data-test-2\n+\tdiv.removeData([\"data-test-1\", \"data-test-2\"]);\n+\tequal( div.data()[\"data-test-1\"], undefined, \"Verifying remove of data-test-1 deleting the right data\" );\n+\tequal( div.data()[\"data-test-2\"], undefined, \"Verifying remove of data-test-2 deleting the right data\" );","path":"test/unit/data.js","position":26,"original_position":26,"commit_id":"a5fb04edc2522c73f140af868958810baf87cbdc","original_commit_id":"a5fb04edc2522c73f140af868958810baf87cbdc","user":{"login":"mzgol","id":1758366,"avatar_url":"https://avatars.githubusercontent.com/u/1758366?v=3","gravatar_id":"","url":"https://api.github.com/users/mzgol","html_url":"https://github.com/mzgol","followers_url":"https://api.github.com/users/mzgol/followers","following_url":"https://api.github.com/users/mzgol/following{/other_user}","gists_url":"https://api.github.com/users/mzgol/gists{/gist_id}","starred_url":"https://api.github.com/users/mzgol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mzgol/subscriptions","organizations_url":"https://api.github.com/users/mzgol/orgs","repos_url":"https://api.github.com/users/mzgol/repos","events_url":"https://api.github.com/users/mzgol/events{/privacy}","received_events_url":"https://api.github.com/users/mzgol/received_events","type":"User","site_admin":false},"body":"There should be spaces everywhere after the opening bracket and before the closing one if there are any parameters passed, e.g. here `div.data()[ \"data-test-2\" ]` etc.","created_at":"2015-01-01T12:57:07Z","updated_at":"2015-01-01T12:57:07Z","html_url":"https://github.com/jquery/jquery/pull/1905#discussion_r22399481","pull_request_url":"https://api.github.com/repos/jquery/jquery/pulls/1905","_links":{"self":{"href":"https://api.github.com/repos/jquery/jquery/pulls/comments/22399481"},"html":{"href":"https://github.com/jquery/jquery/pull/1905#discussion_r22399481"},"pull_request":{"href":"https://api.github.com/repos/jquery/jquery/pulls/1905"}}},"pull_request":{"url":"https://api.github.com/repos/jquery/jquery/pulls/1905","id":25590118,"html_url":"https://github.com/jquery/jquery/pull/1905","diff_url":"https://github.com/jquery/jquery/pull/1905.diff","patch_url":"https://github.com/jquery/jquery/pull/1905.patch","issue_url":"https://api.github.com/repos/jquery/jquery/issues/1905","number":1905,"state":"open","locked":false,"title":"Data: Fix to .data update if key was added as-is","user":{"login":"meetselva","id":1577203,"avatar_url":"https://avatars.githubusercontent.com/u/1577203?v=3","gravatar_id":"","url":"https://api.github.com/users/meetselva","html_url":"https://github.com/meetselva","followers_url":"https://api.github.com/users/meetselva/followers","following_url":"https://api.github.com/users/meetselva/following{/other_user}","gists_url":"https://api.github.com/users/meetselva/gists{/gist_id}","starred_url":"https://api.github.com/users/meetselva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetselva/subscriptions","organizations_url":"https://api.github.com/users/meetselva/orgs","repos_url":"https://api.github.com/users/meetselva/repos","events_url":"https://api.github.com/users/meetselva/events{/privacy}","received_events_url":"https://api.github.com/users/meetselva/received_events","type":"User","site_admin":false},"body":"When adding data using object argument, the keys are not camel cased as internally it uses `.extend` to create data cache. This fails when trying to update the value currently as the update is always camel cased. \r\n\r\nTest Scenario: Creating a data using [object argument](http://api.jquery.com/data/#data-obj) with keys in object has dash(es).\r\n\r\n````\r\n//creates a data for the element with keys data-test-1 and data-test-2 \r\n$('#data-test').data({'data-test-1': 1, 'data-test-2': 2}); \r\n//logs 1\r\nconsole.log($('#data-test').data('data-test-1'));\r\n//creates a new data dataTest1 and updates the value 4\r\n$('#data-test').data('data-test-1', 4);\r\n//still logs 1 as the update didn't actually update the value\r\nconsole.log($('#data-test').data('data-test-1'));\r\n````\r\n\r\nTest Case: http://jsfiddle.net/c0k0owkq/\r\n\r\n![jq](https://cloud.githubusercontent.com/assets/1577203/5320813/6fdb0344-7c83-11e4-992c-0a04b93e0834.png)\r\n\r\nThe fix is to either use a different method instead of `.extend` to add data from an object or check if the key exist as-is when updating. The later was an easy change.","created_at":"2014-12-05T18:33:10Z","updated_at":"2015-01-01T12:57:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"206811093f25988e1f09412b717c9020774ebb8f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jquery/jquery/pulls/1905/commits","review_comments_url":"https://api.github.com/repos/jquery/jquery/pulls/1905/comments","review_comment_url":"https://api.github.com/repos/jquery/jquery/pulls/comments/{number}","comments_url":"https://api.github.com/repos/jquery/jquery/issues/1905/comments","statuses_url":"https://api.github.com/repos/jquery/jquery/statuses/a5fb04edc2522c73f140af868958810baf87cbdc","head":{"label":"meetselva:1.x-master","ref":"1.x-master","sha":"a5fb04edc2522c73f140af868958810baf87cbdc","user":{"login":"meetselva","id":1577203,"avatar_url":"https://avatars.githubusercontent.com/u/1577203?v=3","gravatar_id":"","url":"https://api.github.com/users/meetselva","html_url":"https://github.com/meetselva","followers_url":"https://api.github.com/users/meetselva/followers","following_url":"https://api.github.com/users/meetselva/following{/other_user}","gists_url":"https://api.github.com/users/meetselva/gists{/gist_id}","starred_url":"https://api.github.com/users/meetselva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetselva/subscriptions","organizations_url":"https://api.github.com/users/meetselva/orgs","repos_url":"https://api.github.com/users/meetselva/repos","events_url":"https://api.github.com/users/meetselva/events{/privacy}","received_events_url":"https://api.github.com/users/meetselva/received_events","type":"User","site_admin":false},"repo":{"id":27602055,"name":"jquery","full_name":"meetselva/jquery","owner":{"login":"meetselva","id":1577203,"avatar_url":"https://avatars.githubusercontent.com/u/1577203?v=3","gravatar_id":"","url":"https://api.github.com/users/meetselva","html_url":"https://github.com/meetselva","followers_url":"https://api.github.com/users/meetselva/followers","following_url":"https://api.github.com/users/meetselva/following{/other_user}","gists_url":"https://api.github.com/users/meetselva/gists{/gist_id}","starred_url":"https://api.github.com/users/meetselva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetselva/subscriptions","organizations_url":"https://api.github.com/users/meetselva/orgs","repos_url":"https://api.github.com/users/meetselva/repos","events_url":"https://api.github.com/users/meetselva/events{/privacy}","received_events_url":"https://api.github.com/users/meetselva/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/meetselva/jquery","description":"jQuery JavaScript Library","fork":true,"url":"https://api.github.com/repos/meetselva/jquery","forks_url":"https://api.github.com/repos/meetselva/jquery/forks","keys_url":"https://api.github.com/repos/meetselva/jquery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meetselva/jquery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meetselva/jquery/teams","hooks_url":"https://api.github.com/repos/meetselva/jquery/hooks","issue_events_url":"https://api.github.com/repos/meetselva/jquery/issues/events{/number}","events_url":"https://api.github.com/repos/meetselva/jquery/events","assignees_url":"https://api.github.com/repos/meetselva/jquery/assignees{/user}","branches_url":"https://api.github.com/repos/meetselva/jquery/branches{/branch}","tags_url":"https://api.github.com/repos/meetselva/jquery/tags","blobs_url":"https://api.github.com/repos/meetselva/jquery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meetselva/jquery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meetselva/jquery/git/refs{/sha}","trees_url":"https://api.github.com/repos/meetselva/jquery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meetselva/jquery/statuses/{sha}","languages_url":"https://api.github.com/repos/meetselva/jquery/languages","stargazers_url":"https://api.github.com/repos/meetselva/jquery/stargazers","contributors_url":"https://api.github.com/repos/meetselva/jquery/contributors","subscribers_url":"https://api.github.com/repos/meetselva/jquery/subscribers","subscription_url":"https://api.github.com/repos/meetselva/jquery/subscription","commits_url":"https://api.github.com/repos/meetselva/jquery/commits{/sha}","git_commits_url":"https://api.github.com/repos/meetselva/jquery/git/commits{/sha}","comments_url":"https://api.github.com/repos/meetselva/jquery/comments{/number}","issue_comment_url":"https://api.github.com/repos/meetselva/jquery/issues/comments/{number}","contents_url":"https://api.github.com/repos/meetselva/jquery/contents/{+path}","compare_url":"https://api.github.com/repos/meetselva/jquery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meetselva/jquery/merges","archive_url":"https://api.github.com/repos/meetselva/jquery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meetselva/jquery/downloads","issues_url":"https://api.github.com/repos/meetselva/jquery/issues{/number}","pulls_url":"https://api.github.com/repos/meetselva/jquery/pulls{/number}","milestones_url":"https://api.github.com/repos/meetselva/jquery/milestones{/number}","notifications_url":"https://api.github.com/repos/meetselva/jquery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meetselva/jquery/labels{/name}","releases_url":"https://api.github.com/repos/meetselva/jquery/releases{/id}","created_at":"2014-12-05T17:22:23Z","updated_at":"2014-12-11T05:50:17Z","pushed_at":"2014-12-11T05:50:16Z","git_url":"git://github.com/meetselva/jquery.git","ssh_url":"git@github.com:meetselva/jquery.git","clone_url":"https://github.com/meetselva/jquery.git","svn_url":"https://github.com/meetselva/jquery","homepage":"http://jquery.com/","size":21172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"1.x-master"}},"base":{"label":"jquery:1.x-master","ref":"1.x-master","sha":"73c1ceaf4280bd0318679c1ad832181f3f449814","user":{"login":"jquery","id":70142,"avatar_url":"https://avatars.githubusercontent.com/u/70142?v=3","gravatar_id":"","url":"https://api.github.com/users/jquery","html_url":"https://github.com/jquery","followers_url":"https://api.github.com/users/jquery/followers","following_url":"https://api.github.com/users/jquery/following{/other_user}","gists_url":"https://api.github.com/users/jquery/gists{/gist_id}","starred_url":"https://api.github.com/users/jquery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jquery/subscriptions","organizations_url":"https://api.github.com/users/jquery/orgs","repos_url":"https://api.github.com/users/jquery/repos","events_url":"https://api.github.com/users/jquery/events{/privacy}","received_events_url":"https://api.github.com/users/jquery/received_events","type":"Organization","site_admin":false},"repo":{"id":167174,"name":"jquery","full_name":"jquery/jquery","owner":{"login":"jquery","id":70142,"avatar_url":"https://avatars.githubusercontent.com/u/70142?v=3","gravatar_id":"","url":"https://api.github.com/users/jquery","html_url":"https://github.com/jquery","followers_url":"https://api.github.com/users/jquery/followers","following_url":"https://api.github.com/users/jquery/following{/other_user}","gists_url":"https://api.github.com/users/jquery/gists{/gist_id}","starred_url":"https://api.github.com/users/jquery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jquery/subscriptions","organizations_url":"https://api.github.com/users/jquery/orgs","repos_url":"https://api.github.com/users/jquery/repos","events_url":"https://api.github.com/users/jquery/events{/privacy}","received_events_url":"https://api.github.com/users/jquery/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jquery/jquery","description":"jQuery JavaScript Library","fork":false,"url":"https://api.github.com/repos/jquery/jquery","forks_url":"https://api.github.com/repos/jquery/jquery/forks","keys_url":"https://api.github.com/repos/jquery/jquery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jquery/jquery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jquery/jquery/teams","hooks_url":"https://api.github.com/repos/jquery/jquery/hooks","issue_events_url":"https://api.github.com/repos/jquery/jquery/issues/events{/number}","events_url":"https://api.github.com/repos/jquery/jquery/events","assignees_url":"https://api.github.com/repos/jquery/jquery/assignees{/user}","branches_url":"https://api.github.com/repos/jquery/jquery/branches{/branch}","tags_url":"https://api.github.com/repos/jquery/jquery/tags","blobs_url":"https://api.github.com/repos/jquery/jquery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jquery/jquery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jquery/jquery/git/refs{/sha}","trees_url":"https://api.github.com/repos/jquery/jquery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jquery/jquery/statuses/{sha}","languages_url":"https://api.github.com/repos/jquery/jquery/languages","stargazers_url":"https://api.github.com/repos/jquery/jquery/stargazers","contributors_url":"https://api.github.com/repos/jquery/jquery/contributors","subscribers_url":"https://api.github.com/repos/jquery/jquery/subscribers","subscription_url":"https://api.github.com/repos/jquery/jquery/subscription","commits_url":"https://api.github.com/repos/jquery/jquery/commits{/sha}","git_commits_url":"https://api.github.com/repos/jquery/jquery/git/commits{/sha}","comments_url":"https://api.github.com/repos/jquery/jquery/comments{/number}","issue_comment_url":"https://api.github.com/repos/jquery/jquery/issues/comments/{number}","contents_url":"https://api.github.com/repos/jquery/jquery/contents/{+path}","compare_url":"https://api.github.com/repos/jquery/jquery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jquery/jquery/merges","archive_url":"https://api.github.com/repos/jquery/jquery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jquery/jquery/downloads","issues_url":"https://api.github.com/repos/jquery/jquery/issues{/number}","pulls_url":"https://api.github.com/repos/jquery/jquery/pulls{/number}","milestones_url":"https://api.github.com/repos/jquery/jquery/milestones{/number}","notifications_url":"https://api.github.com/repos/jquery/jquery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jquery/jquery/labels{/name}","releases_url":"https://api.github.com/repos/jquery/jquery/releases{/id}","created_at":"2009-04-03T15:20:14Z","updated_at":"2015-01-01T09:48:14Z","pushed_at":"2014-12-31T14:44:36Z","git_url":"git://github.com/jquery/jquery.git","ssh_url":"git@github.com:jquery/jquery.git","clone_url":"https://github.com/jquery/jquery.git","svn_url":"https://github.com/jquery/jquery","homepage":"http://jquery.com/","size":36215,"stargazers_count":32966,"watchers_count":32966,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":7753,"mirror_url":null,"open_issues_count":99,"forks":7753,"open_issues":99,"watchers":32966,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jquery/jquery/pulls/1905"},"html":{"href":"https://github.com/jquery/jquery/pull/1905"},"issue":{"href":"https://api.github.com/repos/jquery/jquery/issues/1905"},"comments":{"href":"https://api.github.com/repos/jquery/jquery/issues/1905/comments"},"review_comments":{"href":"https://api.github.com/repos/jquery/jquery/pulls/1905/comments"},"review_comment":{"href":"https://api.github.com/repos/jquery/jquery/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/jquery/jquery/pulls/1905/commits"},"statuses":{"href":"https://api.github.com/repos/jquery/jquery/statuses/a5fb04edc2522c73f140af868958810baf87cbdc"}}}}