Skip to content

Instantly share code, notes, and snippets.

@davidbgk
Created July 7, 2015 12:42
Show Gist options
  • Save davidbgk/bb5a15de111194443aee to your computer and use it in GitHub Desktop.
Save davidbgk/bb5a15de111194443aee to your computer and use it in GitHub Desktop.
Current experimentations
<!doctype html>
<html lang=en>
<meta charset=utf-8>
<title>Current JS</title>
<style>
:root { --fontSize: 3rem; }
a { font-size: var(--fontSize); }
</style>
<a href=http://example.org>Link to example</a>
<a href=http://httpbin.org>Link to HTTPbin</a>
<script>
'use strict'
window.$ = document.querySelectorAll.bind(document)
;(elements => {
Array.from(elements).forEach(link => {
link.addEventListener('click', e => {
e.preventDefault()
console.log(`${link.text} clicked!`)
})
})
})($('a'))
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment