PageSourceSearch

https://www.stlouisfed.org/-/media/base-themes/components-theme/scripts/details-polyfill.js

js stlouisfed.org collected 2026-10-01 07:02:14 UTC 6,628 bytes, 115 lines download raw bytes

1/*
2Details Element Polyfill 2.0.0
3Copyright © 2017 Javan Makhmali
4 */
5(function () { }).call(this),
6    function () {
7    if (document.querySelector('body').getAttribute('class') && document.querySelector('body').getAttribute('class').indexOf('on-page-editor') > -1) {
8            return;
9        }
10        var t, e, n, r, u, o, i, a, s, l, c, d;
11        l = {
12            element: function () {
13                var t, e, n, r, u;
14                return e = document.createElement("details"), "open" in e ? (e.innerHTML = "<summary>a</summary>b", e.setAttribute("style", "position: absolute; left: -9999px"), r = null != (u = document.body) ? u : document.documentElement, r.appendChild(e), t = e.offsetHeight, e.open = !0, n = e.offsetHeight, r.removeChild(e), t !== n) : !1
15            }(),
16            toggleEvent: function () {
17                var t;
18                return t = document.createElement("details"), "ontoggle" in t
19            }()
20        }, l.element && l.toggleEvent || (i = function () {
21            return document.head.insertAdjacentHTML("afterbegin", '<style>@charset"UTF-8";details:not([open])>*:not(summary){display:none;}details>summary{display:block;}details>summary::before{content:"\u25ba";padding-right:0.3rem;font-size:0.6rem;cursor:default;}details[open]>summary::before{content:"\u25bc";}</style>')
22        }, o = function () {
23            var t, e, n, r, u;
24            return t = document.createElement("details").constructor.prototype, r = t.setAttribute, n = t.removeAttribute, u = null != (e = Object.getOwnPropertyDescriptor(t, "open")) ? e.set : void 0, Object.defineProperties(t, {
25                open: {
26                    set: function (t) {
27                        return "DETAILS" === this.tagName ? (t ? this.setAttribute("open", "") : this.removeAttribute("open"), t) : null != u ? u.call(this, t) : void 0
28                    }
29                },
30                setAttribute: {
31                    value: function (t, e) {
32                        return d(this, function (n) {
33                            return function () {
34                                return r.call(n, t, e)
35                            }
36                        }(this))
37                    }
38                },
39                removeAttribute: {
40                    value: function (t) {
41                        return d(this, function (e) {
42                            return function () {
43                                return n.call(e, t)
44                            }
45                        }(this))
46                    }
47                }
48            })
49        }, a = function () {
50            return r(function (t) {
51                var e;
52                return e = t.querySelector("summary"), t.hasAttribute("open") ? (t.removeAttribute("open"), e.setAttribute("aria-expanded", !1)) : (t.setAttribute("open", ""), e.setAttribute("aria-expanded", !0))
53            })
54        }, u = function () {
55            var e, n, r, u, o;
56            for (u = document.querySelectorAll("summary"), e = 0, n = u.length; n > e; e++) o = u[e], t(o);
57            return "undefined" != typeof MutationObserver && null !== MutationObserver ? (r = new MutationObserver(function (e) {
58                var n, r, u, i, a;
59                for (i = [], r = 0, u = e.length; u > r; r++) n = e[r].addedNodes, i.push(function () {
60                    var e, r, u;
61                    for (u = [], e = 0, r = n.length; r > e; e++) a = n[e], "DETAILS" === a.tagName && (o = a.querySelector("summary")) ? u.push(t(o, a)) : u.push(void 0);
62                    return u
63                }());
64                return i
65            }), r.observe(document.documentElement, {
66                subtree: !0,
67                childList: !0
68            })) : document.addEventListener("DOMNodeInserted", function (e) {
69                return "SUMMARY" === e.target.tagName ? t(e.target) : void 0
70            })
71        }, t = function (t, e) {
72            return null == e && (e = n(t, "DETAILS")), t.setAttribute("aria-expanded", e.hasAttribute("open")), t.hasAttribute("tabindex") || t.setAttribute("tabindex", "0"), t.hasAttribute("role") ? void 0 : t.setAttribute("role", "button")
73        }, s = function () {
74            var t;
75            return "undefined" != typeof MutationObserver && null !== MutationObserver ? (t = new MutationObserver(function (t) {
76                var e, n, r, u, o, i;
77                for (o = [], n = 0, r = t.length; r > n; n++) u = t[n], i = u.target, e = u.attributeName, "DETAILS" === i.tagName && "open" === e ? o.push(c(i)) : o.push(void 0);
78                return o
79            }), t.observe(document.documentElement, {
80                attributes: !0,
81                subtree: !0
82            })) : r(function (t) {
83                var e;
84                return e = t.getAttribute("open"), setTimeout(function () {
85                    return t.getAttribute("open") !== e ? c(t) : void 0
86                }, 1)
87            })
88        }, e = function (t) {
89            return !(t.defaultPrevented || t.altKey || t.ctrlKey || t.metaKey || t.shiftKey || t.target.isContentEditable)
90        }, r = function (t) {
91            return addEventListener("click", function (r) {
92                var u, o;
93                return e(r) && r.which <= 1 && (u = n(r.target, "SUMMARY")) && "DETAILS" === (null != (o = u.parentElement) ? o.tagName : void 0) ? t(u.parentElement) : void 0
94            }, !1), addEventListener("keydown", function (r) {
95                var u, o, i;
96                return e(r) && (13 === (o = r.keyCode) || 32 === o) && (u = n(r.target, "SUMMARY")) && "DETAILS" === (null != (i = u.parentElement) ? i.tagName : void 0) ? (t(u.parentElement), r.preventDefault()) : void 0
97            }, !1)
98        }, n = function () {
99            return "function" == typeof Element.prototype.closest ? function (t, e) {
100                return t.closest(e)
101            } : function (t, e) {
102                for (; t;) {
103                    if (t.tagName === e) return t;
104                    t = t.parentElement
105                }
106            }
107        }(), c = function (t) {
108            var e;
109            return e = document.createEvent("Events"), e.initEvent("toggle", !0, !1), t.dispatchEvent(e)
110        }, d = function (t, e) {
111            var n, r;
112            return n = t.getAttribute("open"), r = e(), t.getAttribute("open") !== n && c(t), r
113        }, l.element || (i(), o(), a(), u()), l.element && !l.toggleEvent && s())
114    }.call(this),
115    function () { }.call(this);

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.