{"action":"created","issue":{"url":"https://api.github.com/repos/woocommerce/woocommerce/issues/11944","repository_url":"https://api.github.com/repos/woocommerce/woocommerce","labels_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/11944/labels{/name}","comments_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/11944/comments","events_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/11944/events","html_url":"https://github.com/woocommerce/woocommerce/pull/11944","id":177749682,"number":11944,"title":"[2.6] Variations script errors when 'empty' option is omitted","user":{"login":"franticpsyx","id":1783726,"avatar_url":"https://avatars.githubusercontent.com/u/1783726?v=3","gravatar_id":"","url":"https://api.github.com/users/franticpsyx","html_url":"https://github.com/franticpsyx","followers_url":"https://api.github.com/users/franticpsyx/followers","following_url":"https://api.github.com/users/franticpsyx/following{/other_user}","gists_url":"https://api.github.com/users/franticpsyx/gists{/gist_id}","starred_url":"https://api.github.com/users/franticpsyx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franticpsyx/subscriptions","organizations_url":"https://api.github.com/users/franticpsyx/orgs","repos_url":"https://api.github.com/users/franticpsyx/repos","events_url":"https://api.github.com/users/franticpsyx/events{/privacy}","received_events_url":"https://api.github.com/users/franticpsyx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/woocommerce/woocommerce/labels/[Status]%20Needs%20Review","name":"[Status] Needs Review","color":"a46497"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-19T10:23:10Z","updated_at":"2016-09-29T22:40:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/woocommerce/woocommerce/pulls/11944","html_url":"https://github.com/woocommerce/woocommerce/pull/11944","diff_url":"https://github.com/woocommerce/woocommerce/pull/11944.diff","patch_url":"https://github.com/woocommerce/woocommerce/pull/11944.patch"},"body":"### Issue Description\r\n\r\nWhen the `show_option_none` param passed to `wc_dropdown_variation_attribute_options` is set to `false`, the function will correctly prevent the empty-value option from being added to the `select` element.\r\n\r\nHowever the variations script itself is not able to handle this situation, since options are manipulated always assuming the presence of an empty-value option.\r\n\r\n### Proposed Fix\r\n\r\nThe proposed fix sets a `show_option_none` data attribute on the `select` element, which can be used by the script to determine how options should be handled. I thought this is safer/faster than the possible alternative of checking the value of the first option everytime the event handler function runs (data attribute values are only parsed from the DOM once and are then accessed in memory, as far as I recall)."},"comment":{"url":"https://api.github.com/repos/woocommerce/woocommerce/issues/comments/250612689","html_url":"https://github.com/woocommerce/woocommerce/pull/11944#issuecomment-250612689","issue_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/11944","id":250612689,"user":{"login":"justinshreve","id":689165,"avatar_url":"https://avatars.githubusercontent.com/u/689165?v=3","gravatar_id":"","url":"https://api.github.com/users/justinshreve","html_url":"https://github.com/justinshreve","followers_url":"https://api.github.com/users/justinshreve/followers","following_url":"https://api.github.com/users/justinshreve/following{/other_user}","gists_url":"https://api.github.com/users/justinshreve/gists{/gist_id}","starred_url":"https://api.github.com/users/justinshreve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinshreve/subscriptions","organizations_url":"https://api.github.com/users/justinshreve/orgs","repos_url":"https://api.github.com/users/justinshreve/repos","events_url":"https://api.github.com/users/justinshreve/events{/privacy}","received_events_url":"https://api.github.com/users/justinshreve/received_events","type":"User","site_admin":false},"created_at":"2016-09-29T22:40:21Z","updated_at":"2016-09-29T22:40:21Z","body":"@franticpsyx  Code LGTM -- thanks! Can you minify the JS on your branch using grunt? Then I can merge w/o doing a separate commit to do it."}}
{"actor":{"display_login":"justinshreve"}}