UNPKG

590 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.shadowFnFactory = void 0;
7
8const shadowFnFactory = function (elementSelector, qsAll) {
9 const strFn = `
10 (function() {
11 // element has a shadowRoot property
12 if (this.shadowRoot) {
13 return this.shadowRoot.querySelector${qsAll ? 'All' : ''}('${elementSelector}')
14 }
15 // fall back to querying the element directly if not
16 return this.querySelector${qsAll ? 'All' : ''}('${elementSelector}')
17 })`;
18 return eval(strFn);
19};
20
21exports.shadowFnFactory = shadowFnFactory;
\No newline at end of file