PageSourceSearch

https://www.easybell.de/_assets/e809f40fc7cdd705d4ba2ef1866bb130/JavaScript/webcomponents-loader.js?1790155368

js easybell.de collected 2026-09-24 09:47:41 UTC 4,445 bytes, 143 lines download raw bytes

vendor: 4,445 bytes, lines 1-143
1/**
2 * @license
3 * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 * Code distributed by Google as part of the polymer project is also
8 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 */
10
11(function() {
12  'use strict';
13
14  var polyfillsLoaded = false;
15  var whenLoadedFns = [];
16  var allowUpgrades = false;
17  var flushFn;
18
19  function fireEvent() {
20    window.WebComponents.ready = true;
21    document.dispatchEvent(new CustomEvent('WebComponentsReady', { bubbles: true }));
22  }
23
24  function batchCustomElements() {
25    if (window.customElements && customElements.polyfillWrapFlushCallback) {
26      customElements.polyfillWrapFlushCallback(function (flushCallback) {
27        flushFn = flushCallback;
28        if (allowUpgrades) {
29          flushFn();
30        }
31      });
32    }
33  }
34
35  function asyncReady() {
36    batchCustomElements();
37    ready();
38  }
39
40  function ready() {
41    if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
42      HTMLTemplateElement.bootstrap(window.document);
43    }
44    polyfillsLoaded = true;
45    runWhenLoadedFns().then(fireEvent);
46  }
47
48  function runWhenLoadedFns() {
49    allowUpgrades = false;
50    var fnsMap = whenLoadedFns.map(function(fn) {
51      return fn instanceof Function ? fn() : fn;
52    });
53    whenLoadedFns = [];
54    return Promise.all(fnsMap).then(function() {
55      allowUpgrades = true;
56      flushFn && flushFn();
57    }).catch(function(err) {
58      console.error(err);
59    });
60  }
61
62  window.WebComponents = window.WebComponents || {};
63  window.WebComponents.ready = window.WebComponents.ready || false;
64  window.WebComponents.waitFor = window.WebComponents.waitFor || function(waitFn) {
65    if (!waitFn) {
66      return;
67    }
68    whenLoadedFns.push(waitFn);
69    if (polyfillsLoaded) {
70      runWhenLoadedFns();
71    }
72  };
73  window.WebComponents._batchCustomElements = batchCustomElements;
74
75  var name = 'webcomponents-loader.js';
76  var polyfills = [];
77  if (!('attachShadow' in Element.prototype && 'getRootNode' in Element.prototype) ||
78    (window.ShadyDOM && window.ShadyDOM.force)) {
79    polyfills.push('sd');
80  }
81  if (!window.customElements || window.customElements.forcePolyfill) {
82    polyfills.push('ce');
83  }
84
85  var needsTemplate = (function() {
86    var t = document.createElement('template');
87    if (!('content' in t)) {
88      return true;
89    }
90    if (!(t.content.cloneNode() instanceof DocumentFragment)) {
91      return true;
92    }
93    var t2 = document.createElement('template');
94    t2.content.appendChild(document.createElement('div'));
95    t.content.appendChild(t2);
96    var clone = t.cloneNode(true);
97    return (clone.content.childNodes.length === 0 ||
98        clone.content.firstChild.content.childNodes.length === 0);
99  })();
100
101  if (!window.Promise || !Array.from || !window.URL || !window.Symbol || needsTemplate) {
102    polyfills = ['sd-ce-pf'];
103  }
104
105  if (polyfills.length) {
106    var url;
107    var polyfillFile = 'bundles/webcomponents-' + polyfills.join('-') + '.js';
108
109    if (window.WebComponents.root) {
110      url = window.WebComponents.root + polyfillFile;
111    } else {
112      var script = document.querySelector('script[src*="' + name +'"]');
113      url = script.src.replace(name, polyfillFile);
114    }
115
116    var newScript = document.createElement('script');
117    newScript.src = url;
118    if (document.readyState === 'loading') {
119      newScript.setAttribute('onload', 'window.WebComponents._batchCustomElements()');
120      document.write(newScript.outerHTML);
121      document.addEventListener('DOMContentLoaded', ready);
122    } else {
123      newScript.addEventListener('load', function () {
124        asyncReady();
125      });
126      newScript.addEventListener('error', function () {
127        throw new Error('Could not load polyfill bundle' + url);
128      });
129      document.head.appendChild(newScript);
130    }
131  } else {
132    if (document.readyState === 'complete') {
133      polyfillsLoaded = true;
134      fireEvent();
135    } else {
136      window.addEventListener('load', ready);
137      window.addEventListener('DOMContentLoaded', function() {
138        window.removeEventListener('load', ready);
139        ready();
140      })
141    }
142  }
143})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.