【发布时间】:2013-09-26 11:58:23
【问题描述】:
我修改了一个 Dart 聚合物示例来测试 MutationObserver。这是行不通的!有什么建议吗?
这是 HTML 代码:
<body>
<ul>
<template id="tmpl" repeat>
<li>{{}}</li>
</template>
</ul>
</body>
这是飞镖代码:
MutationObserver observer = new MutationObserver(_onMutation);
observer.observe(query('#tmpl'), childList: true, subtree: true);
List timestamps = toObservable([]);
query('#tmpl').model = timestamps;
new Timer.periodic(const Duration(seconds: 1), (_) {
timestamps.add(new DateTime.now());
});
_onMutation(List<MutationRecord> mutations, MutationObserver observer) {
print('hello test MutationObserver'); **//there is not any print!!!!!!!!!!!**
}
知道为什么它不起作用吗?
[注意:网页显示正常,问题出在MutationObserver]
谢谢!
【问题讨论】:
标签: dom dart dart-webui