Skip to content

Instantly share code, notes, and snippets.

@kllaudyo
Last active November 5, 2018 15:33
Show Gist options
  • Save kllaudyo/8473a04754be287bf22c51cc0f263b0c to your computer and use it in GitHub Desktop.
Save kllaudyo/8473a04754be287bf22c51cc0f263b0c to your computer and use it in GitHub Desktop.
const
byId = id =>
document.getElementById(id)
,
byName = (name, parent=document) =>
parent.getElementsByName(name)
,
byTag = (tag, parent=document) =>
parent.getElementsByTagName(tag)
,
bySelector = (selector, parent=document) =>
parent.querySelector(selector)
,
byAll = (selector, parent=document) =>
parent.querySelectorAll(selector)
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment