Use Standard JS for JS code

This commit is contained in:
Bat 2018-09-01 21:42:53 +01:00
parent 93cb70455d
commit 4d4a58361b

View File

@ -1,14 +1,9 @@
function autosize(){ function autosize () {
const el = this; const el = this
el.style.height = 'auto'; el.style.height = 'auto'
el.style.height = (el.scrollHeight ) + 'px'; el.style.height = `${el.scrollHeight}px`
} }
const articleContent = document.querySelector('#content'); const articleContent = document.querySelector('#content')
let offset = 0; autosize.bind(articleContent)()
let style = window.getComputedStyle(articleContent, null); articleContent.addEventListener('keyup', autosize)
offset += parseInt(style['paddingTop']) + parseInt(style['paddingBottom']);
autosize.bind(articleContent)();
articleContent.addEventListener('keyup', autosize);