Stop using HTMLElement.dataset to access custom data attributes on Safari. Sometimes, valid "data-*" attributes on an element are undefined when accessed through the element's dataset property:
Stop using HTMLElement.dataset to access custom data attributes on Safari.
Sometimes, valid "data-*" attributes on an element are undefined when accessed through the element's dataset property:

<div data-foo="bar">
goog.dom.dataset.has(element, 'foo');  // false
element.dataset['foo'];  // undefined
element.getAttribute('data-foo');  // 'bar'. get/hasAttribute seems to always work.

The dataset map is even returning different values when accessed multiple times within the same function, even though the dataset/element isn't being modified.
The bug is tricky to reproduce, and seems to be affected by "unrelated" HTML/JS changes on the page.

This bug is breaking web search page rendering, and likely other uses of Closure.

WebKit bug with reports of the same behavior: https://bugs.webkit.org/show_bug.cgi?id=161454

RELNOTES: Stop using HTMLElement.dataset in Safari, because sometimes accessing a value incorrectly returns "undefined".

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=141113798

google/closure-library,google/closure-library,teppeis/closure-library,redforks/closure-library,platinumpixs/google-closure-library,lucidsoftware/closure-library,teppeis/closure-library,google/closure-library,platinumpixs/google-closure-library,google/closure-library,platinumpixs/google-closure-library,teppeis/closure-library,redforks/closure-library,ikabirov/closure-library,ikabirov/closure-library,platinumpixs/google-closure-library,teppeis/closure-library,google/closure-library,lucidsoftware/closure-library,redforks/closure-library,lucidsoftware/closure-library,lucidsoftware/closure-library,ikabirov/closure-library,redforks/closure-library,ikabirov/closure-library