-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
282 bytes: Use JS to dynamically create elements, retain layout & placeholders #8
base: master
Are you sure you want to change the base?
Conversation
I would actually stick to i.srcdoc=h.value+'<style>'+c.value+'</style><script>'+j.value+'</script>' for better compatibility and the same size, and document.body.innerHTML+='hcj'.replace(/./g,'<textarea id=$&></textarea>')+'<hr width=100%><iframe id=i>' would be actually smaller than the es6 version. Also, |
@explodingcamera the default size actually isn't 1em. 1em = 16px/root font size. At least for me, my browsers render 11px as the default, so 1em is substantially bigger and relatively close to 18px like the original version. |
@explodingcamera the ES6 implementation for Nice catch for the |
Credit goes to @explodingcamera
<style>
[id]{display:flex;flex-flow:wrap;font-size:1em;flex:1}
</style>
<body
oninput="i.srcdoc=h[v='value']+`<style>${c[v]}</style><script>${j[v]}</script>`"
onload="b.innerHTML='hcj'.replace(/./g,'<textarea id=$&></textarea>')+'<hr width=100%><iframe id=i>'"
id=b>
=> with minimal white space: 262 bytes |
i have try to fix 'placeholder', but it was impossible... |
Updated with placeholders and old styling (minus font-size) |
New size: 282 bytes
Tested in: Chrome, Firefox
Demo: https://aarondancer.github.io/TinyEditor/