A helper function which lets you create HTML DOM Element Objects where tagtype, ID and classes are set through basic CSS selector syntax. Pass an object with any arbitrary key value pairs as a second argument and this will set the element's other attributes. If a tagtype isn't defined a div is created.
createElement = (selectorName, attributes) ->
identifiers = selectorName.match /(?=^[a-z|A-Z]|\.|#).+?(?=\.|#|$)/g
identifiers =
tag : if (ref = identifiers[0]).charAt(0) not in [".", "#"] then ref else "div"
id : if (ref = identifiers.filter((str) => str.charAt(0) is "#")[0]) then ref.substring 1