All files utils.js

93.75% Statements 15/16
33.33% Branches 2/6
100% Functions 5/5
93.33% Lines 14/15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35  1x 1x 4x 4x 3x 3x       3x     1x       2x 20x   2x       1x 10x   1x              
function findParentDomHasZ(target) {
	const list = [];
	while (target !== null) {
		target = target.parentElement;
		if (target === null) break;
		try {
			if (target.computedStyleMap().has('z-index')) {
				list.push(target);
			}
		} catch (e) {
			list.push(target);
		}
	}
	return list
}
 
function addFixClass(list = [], className) {
	list.forEach(v => {
		v.className = `${v.className} ${className}`;
	});
	return list;
}
 
function removeFixClass(list = [], className) {
	list.forEach(v => {
		v.className = v.className.replace(className, '')
	});
	return list
}
 
export {
	findParentDomHasZ,
	addFixClass,
	removeFixClass
}