refactor element.js