Skip to content

Instantly share code, notes, and snippets.

View bkardell's full-sized avatar

Brian Kardell bkardell

View GitHub Profile
let _str = (function(){
const tag = document.createElement('span')
return {
propToAttr: (string) {
tag.dataset[string] = true
return tag.attributes[0].name.split(/^data-/)[1]
},
attrToProp(string) {
tag.setAttribute(`data-${string}`, true)
return Object.entries(tag.dataset)[0][0]
<!doctype html>
<html>
<head>
<title>Hitch Demo</title>
<meta charset="utf-8">
<script src="https://hitchjs.com/dist/hitch-0.6.3.js"></script>
<style type="text/css" data-hitch-interpret>
@-hitch-requires https://www.hitchjs.com/use/bkardell.math/1;
.car:-math-lessthan(data-price, 200000){