| 4125 | return activeElement; |
| 4126 | } |
| 4127 | function closest(element, selector) { |
| 4128 | if (element.closest) { |
| 4129 | return element.closest(selector); |
| 4130 | } else if (element.matches || element.msMatchesSelector || element.webkitMatchesSelector) { |
| 4131 | var el = element; |
| 4132 | if (!document.documentElement.contains(el)) |
| 4133 | return null; |
| 4134 | do { |
| 4135 | var method = el.matches || el.msMatchesSelector || el.webkitMatchesSelector; |
| 4136 | if (method.call(el, selector)) |
| 4137 | return el; |
| 4138 | el = el.parentElement || el.parentNode; |
| 4139 | } while (el !== null && el.nodeType === 1); |
| 4140 | return null; |
| 4141 | } else { |
| 4142 | console.error("Your browser is not supported"); |
| 4143 | return null; |
| 4144 | } |
| 4145 | } |
| 4146 | function getRootNode(element) { |
| 4147 | if (!element) { |
| 4148 | return document.body; |