I receive "Uncaught DOMException: Failed to set the 'child-count' property on 'DOMStringMap': 'child-count' is not a valid property name." when the following code is executed:
elem.dataset['child-count'] = "test";
dataset properties are camel-cased:
elem.dataset.childCount. They are implicitly transformed to hyphenated attribute names (
data-child-count in your case).