Skip to content

Instantly share code, notes, and snippets.

View elvingm's full-sized avatar

Elvin G. Marmol elvingm

View GitHub Profile
@elvingm
elvingm / html_element_selector.js
Last active August 29, 2015 14:13
Javascript Selection Engine without using querySelector or querySelectorAll
var $ = function (selector) {
var splitSelector = selector.split(/(?=\.)|(?=#)/);
/* elemAttributes object provided for:
1) DOM NodeName - only grabbing the first matched
2) List of classes
3) List of ID's - only grabbing the first matched
pushes result in corresponding array in elemAttr object
elName & classList use an array to capture all values provided