mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
We can simplify the checks given that there's fewer node types now. This does make the error messages from Range a little worse, but it's weird that Range is doing its own error checking anyway. I also took this as an opportunity to add a bunch of DOM tests. R=ojan@chromium.org Review URL: https://codereview.chromium.org/732203004
20 lines
477 B
Plaintext
20 lines
477 B
Plaintext
<script>
|
|
function childNodeCount(parent) {
|
|
var count = 0;
|
|
for (var node = parent.firstChild; node; node = node.nextSibling)
|
|
++count;
|
|
return count;
|
|
}
|
|
|
|
function childElementCount(parent) {
|
|
var count = 0;
|
|
for (var element = parent.firstElementChild; element; element = element.nextElementSibling)
|
|
++count;
|
|
return count;
|
|
}
|
|
|
|
module.exports = {
|
|
childNodeCount: childNodeCount,
|
|
childElementCount: childElementCount,
|
|
};
|
|
</script> |