Stolen from: https://github.com/yahoo/locator-handlebars/blob/master/lib/plugin.js#L35