add toString implementation, improve element.js