From https://github.com/nathanford/data-href/blob/master/data-href.js