这两个调用之间有性能差异吗?
get getId() {
delete this.getId;
return (this.getId = document.getElementById('tempId'));
}
get getId() {
return document.getElementById('tempId');
}
用法是
if (this.getId) {
this.getId.appendChild(<something>);
} else {
var self = this;
document.addEventListener('DOMContentLoaded', function() {
self.getId.appendChild(<something>);
});
}