This repository has been archived on 2023-08-29. You can view files and clone it, but cannot push or open issues/pull-requests.
yutent
/
anot.js
Archived
1
0
Fork 0
anot.js/src/24-:text.js

17 lines
417 B
JavaScript

Anot.directive('text', {
update: function(val) {
var elem = this.element
val = val == null ? '' : val //不在页面上显示undefined null
if (elem.nodeType === 3) {
//绑定在文本节点上
try {
//IE对游离于DOM树外的节点赋值会报错
elem.data = val
} catch (e) {}
} else {
//绑定在特性节点上
elem.textContent = val
}
}
})
Anot 是Anot not only templateEngine的缩写。 它是一款迷你,易用、高性能的前端MVVM框架, fork于avalon。进行了大量的重构,精简部分冗余的API, 同时针对组件拓展进行了优化。
JavaScript 100%