diff --git a/src/wrappers/Node.js b/src/wrappers/Node.js index 9633c59..1aa4819 100644 --- a/src/wrappers/Node.js +++ b/src/wrappers/Node.js @@ -373,7 +373,7 @@ }, hasChildNodes: function() { - return this.firstChild === null; + return this.firstChild !== null; }, /** @type {Node} */ diff --git a/test/js/Node.js b/test/js/Node.js index cd7a5d3..95cdfc6 100644 --- a/test/js/Node.js +++ b/test/js/Node.js @@ -186,4 +186,16 @@ suite('Node', function() { expectStructure(host2, {}); }); + + test('hasChildNodes without a shadow root', function() { + var div = document.createElement('div'); + + assert.isFalse(div.hasChildNodes(), 'should be false with no children'); + + div.innerHTML = ''; + assert.isTrue(div.hasChildNodes(), 'should be true with a single child'); + + div.innerHTML = '