Sha256: 073572d9f0e15d24752d61c66fd4faadb12b2a674721523d73c21f49791ebeda

Contents?: true

Size: 389 Bytes

Versions: 19

Compression:

Stored size: 389 Bytes

Contents

async function fetchHTML(url, selector) {
  const response = await fetch(url || window.document.location);
  const html = await response.text();
  const doc = new DOMParser().parseFromString(html, "text/html");
  return {
    ok: response.ok,
    fragment: selector ? doc.querySelector(selector).outerHTML : null,
    title: doc.title,
    response,
    doc,
  };
}

export { fetchHTML };

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
lookbook-2.3.0 assets/js/helpers/request.js
lookbook-2.2.2 assets/js/helpers/request.js
lookbook-2.2.1 assets/js/helpers/request.js
lookbook-2.2.0 assets/js/helpers/request.js
lookbook-2.1.1 assets/js/helpers/request.js
lookbook-2.1.0 assets/js/helpers/request.js
lookbook-2.0.5 assets/js/helpers/request.js
lookbook-2.0.4 assets/js/helpers/request.js
lookbook-2.0.3 assets/js/helpers/request.js
lookbook-2.0.2 assets/js/helpers/request.js
lookbook-2.0.1 assets/js/helpers/request.js
lookbook-2.0.0 assets/js/helpers/request.js
lookbook-2.0.0.rc.3 assets/js/helpers/request.js
lookbook-2.0.0.rc.2 assets/js/helpers/request.js
lookbook-2.0.0.rc.1 assets/js/helpers/request.js
lookbook-2.0.0.beta.9 assets/js/helpers/request.js
lookbook-2.0.0.beta.8 assets/js/helpers/request.js
lookbook-2.0.0.beta.7 assets/js/helpers/request.js
lookbook-2.0.0.beta.5 app/assets/lookbook/js/helpers/request.js