Can anyone explain why the following returns an empty list:
var el = document.createElement('div');
el.dataset.mydata="hello";
document.body.appendChild(el);
document.querySelectorAll('div[data-mydata^=""]');
(If you're wondering why you'd ever do this, the actual code is using a variable as the attribute value in the querySelector. The function it is part of gets called recursively, on the first run the variable is empty.)