// DOM helper functions

// private
function selectionToArray(selection) {
	const len = selection.length
	const result = []
	for (let i = 0; i < len; i += 1) {
		result.push(selection[i])
	}
	return result
}

// public
function select(selector) {
	document.querySelector(selector)
}

function selectAll(selector, parent = document) {
	selectionToArray(parent.querySelectorAll(selector))
}

function find(el, selector) {
	selectionToArray(el.querySelectorAll(selector))
}

function removeClass(el, className) {
	if (el.classList) el.classList.remove(className)
	else el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ')
}

function addClass(el, className) {
	if (el.classList) el.classList.add(className)
	else el.className = `${el.className} ${className}`
}

function hasClass(el, className) {
	if(el.classList) return el.classList.contains(className)
	return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className)
}

function jumpTo(el) {
	document.body.scrollTop ?
	document.body.scrollTop = el.offsetTop + 1 :
	document.documentElement.scrollTop = el.offsetTop + 1
}


export {
	select,
	selectAll,
	find,
	removeClass,
	addClass,
	hasClass,
	jumpTo,
}

@@ -237,24 +237,31 @@
 elector) %7B%0A%09
+return 
 document.que
@@ -281,16 +281,16 @@
 lector)%0A
-
 %7D%0A%0Afunct
@@ -331,24 +331,31 @@
 ocument) %7B%0A%09
+return 
 selectionToA
@@ -427,17 +427,24 @@
 ctor) %7B%0A
-
 %09
+return 
 selectio

fix dom