GoogleChromeLabs / tasklets

177 stars 17 forks source link

Polyfill: URL resolution seems overcomplicated #16

Closed domenic closed 7 years ago

domenic commented 7 years ago

I might be missing something, but I am pretty sure

  const scriptURL = new URL(document.currentScript.src);
  const parts = scriptURL.pathname.split('/');
  parts.pop();
  scriptURL.pathname = `${parts.join('/')}/tasklet-worker-scope.js`;
  scriptURL.search = '';

can become

const scriptURL = new URL("tasklet-work-scope.js", document.currentScript.src);