I modified one the Dart polymer example to test MutationObserver. It does not work! Any suggestion?
This is the HTML code:
<body>
<ul>
<template id="tmpl" repeat>
<li>{{}}</li>
</template>
</ul>
</body>
This is Dart code:
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!!!!!!!!!!!**
}
Any idea about why it would not work?
[Note: The webpage display is fine, problem is just about the MutationObserver]
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…