You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NodeList.filter returns a NodeList, but it doesn't behave like a normal NodeList. If you mutate this list, the node is not added to the document. Also, no error is reported. Contrast with .elements, which returns a frozen list. http://api.dartlang.org/docs/continuous/dart_html/NodeList.html
one of these solutions would be better:
declare return type as List<Node>, and return mutable list. Essentially like it does now, but the type better aligns with user expectations.
return immutable NodeList, like Element.elements does
main() {
// Yeah, you could do this other ways, like with a query :)
var nodes = document.body.nodes;
// This won't be added and won't produce an error
nodes.filter((n) => true).add(new DivElement()..text = ' this no worky!');
nodes.add(new DivElement()..text = ' but this does!');
}
</script>
<script type="text/javascript">navigator.webkitStartDart();</script>
</body>
</html>
The text was updated successfully, but these errors were encountered:
Currently Node.nodes.filter and getRange match the behavior elsewhere, I'm following up with having filter (and Map.getKeys and map.getValues) return Iterable rather than Collection.
NodeList.filter returns a NodeList, but it doesn't behave like a normal NodeList. If you mutate this list, the node is not added to the document. Also, no error is reported. Contrast with .elements, which returns a frozen list.
http://api.dartlang.org/docs/continuous/dart_html/NodeList.html
one of these solutions would be better:
here's a way to reproduce this:
<!doctype html>
<html>
<head></head>
<body>
<div class="awesome">Hello there</div>
<script type="application/dart">
import('dart:html');
main() {
// Yeah, you could do this other ways, like with a query :)
var nodes = document.body.nodes;
// This won't be added and won't produce an error
nodes.filter((n) => true).add(new DivElement()..text = ' this no worky!');
nodes.add(new DivElement()..text = ' but this does!');
}
</script>
<script type="text/javascript">navigator.webkitStartDart();</script>
</body>
</html>
The text was updated successfully, but these errors were encountered: