A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/uiv-lib/uiv/commit/a376c88efad90ea2438f75925e18579cff8df395 below:

update DOM apis, drop IE support · uiv-lib/uiv@a376c88 · GitHub

@@ -34,26 +34,13 @@ export const PLACEMENTS = {

34 34

LEFT: 'left',

35 35

};

36 36 37 -

export function isIE11() {

38 -

/* istanbul ignore next */

39 -

return !!window.MSInputMethodContext && !!document.documentMode;

40 -

}

41 - 42 -

export function isIE10() {

43 -

return window.navigator.appVersion.indexOf('MSIE 10') !== -1;

44 -

}

45 - 46 37

export function getComputedStyle(el) {

47 38

return window.getComputedStyle(el);

48 39

}

49 40 50 41

export function getViewportSize() {

51 -

/* istanbul ignore next */

52 -

const width =

53 -

Math.max(document.documentElement.clientWidth, window.innerWidth) || 0;

54 -

/* istanbul ignore next */

55 -

const height =

56 -

Math.max(document.documentElement.clientHeight, window.innerHeight) || 0;

42 +

const width = window.innerWidth || 0;

43 +

const height = window.innerHeight || 0;

57 44

return { width, height };

58 45

}

59 46

@@ -95,12 +82,10 @@ export function getScrollbarWidth(recalculate = false) {

95 82

}

96 83 97 84

export function on(element, event, handler) {

98 -

/* istanbul ignore next */

99 85

element.addEventListener(event, handler);

100 86

}

101 87 102 88

export function off(element, event, handler) {

103 -

/* istanbul ignore next */

104 89

element.removeEventListener(event, handler);

105 90

}

106 91

@@ -116,44 +101,21 @@ export function addClass(el, className) {

116 101

if (!isElement(el)) {

117 102

return;

118 103

}

119 -

if (el.className) {

120 -

const classes = el.className.split(' ');

121 -

if (classes.indexOf(className) < 0) {

122 -

classes.push(className);

123 -

el.className = classes.join(' ');

124 -

}

125 -

} else {

126 -

el.className = className;

127 -

}

104 +

el.classList.add(className);

128 105

}

129 106 130 107

export function removeClass(el, className) {

131 108

if (!isElement(el)) {

132 109

return;

133 110

}

134 -

if (el.className) {

135 -

const classes = el.className.split(' ');

136 -

const newClasses = [];

137 -

for (let i = 0, l = classes.length; i < l; i++) {

138 -

if (classes[i] !== className) {

139 -

newClasses.push(classes[i]);

140 -

}

141 -

}

142 -

el.className = newClasses.join(' ');

143 -

}

111 +

el.classList.remove(className);

144 112

}

145 113 146 114

export function hasClass(el, className) {

147 115

if (!isElement(el)) {

148 116

return false;

149 117

}

150 -

const classes = el.className.split(' ');

151 -

for (let i = 0, l = classes.length; i < l; i++) {

152 -

if (classes[i] === className) {

153 -

return true;

154 -

}

155 -

}

156 -

return false;

118 +

return el.classList.contains(className);

157 119

}

158 120 159 121

export function setDropdownPosition(dropdown, trigger, options = {}) {

@@ -364,10 +326,9 @@ export function toggleBodyOverflow(enable) {

364 326

node.style.paddingRight = null;

365 327

});

366 328

} else {

367 -

const browsersWithFloatingScrollbar = isIE10() || isIE11();

368 329

const documentHasScrollbar =

369 330

hasScrollbar(document.documentElement) || hasScrollbar(document.body);

370 -

if (documentHasScrollbar && !browsersWithFloatingScrollbar) {

331 +

if (documentHasScrollbar) {

371 332

const scrollbarWidth = getScrollbarWidth();

372 333

body.style.paddingRight = `${scrollbarWidth}px`;

373 334

[...document.querySelectorAll(FIXED_CONTENT)].forEach((node) => {

@@ -379,16 +340,10 @@ export function toggleBodyOverflow(enable) {

379 340

}

380 341 381 342

export function getClosest(el, selector) {

382 -

let parent;

383 -

let _el = el;

384 -

while (_el) {

385 -

parent = _el.parentElement;

386 -

if (parent && parent.matches(selector)) {

387 -

return parent;

388 -

}

389 -

_el = parent;

343 +

if (!isElement(el)) {

344 +

return null;

390 345

}

391 -

return null;

346 +

return el.closest(selector);

392 347

}

393 348 394 349

export function getParents(el, selector, until = null) {


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4