let domId = document.getElementById.bind(document); let domNew = document.createElement.bind(document); function init() { let contactPeriod = document.getElementById('contact-period'); contactPeriod.addEventListener('click', displayLogin); } function displayLogin() { let contact = document.getElementById('contact'); let width = contact.offsetWidth; let height = contact.offsetHeight; console.log(`conact ${width}x${height}`); contact.style.width = `${width}px`; contact.style.height = `${height}px`; while (contact.firstChild) { contact.removeChild(contact.firstChild); } makeLogin(contact); } function makeLogin(parent) { const template = domId('logintemplate'); const clone = document.importNode(template.content, true); parent.appendChild(clone); } window.addEventListener('DOMContentLoaded', init)