Handle commentnodes correctly for textContent and innerHTML

Fixes #2104
This commit is contained in:
Daniel Freedman
2015-07-17 12:28:03 -07:00
parent 3dc50fc303
commit 6d56d2bd94
3 changed files with 894 additions and 865 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -184,4 +184,9 @@
<script>Polymer({
is: 'x-clonate'
});</script>
</dom-module>
</dom-module>
<dom-module id="x-commented">
<template><span>[</span><!--comment--><content></content></span><span>]</span></content></template>
<script>Polymer({is: 'x-commented'});</script>
</dom-module>

View File

@@ -630,6 +630,18 @@ suite('Polymer.dom accessors', function() {
Polymer.dom.flush();
assert.equal(testElement._composedChildren[1].textContent, 'Hello World', 'text content setter incorrect');
}
testElement = document.createElement('x-commented');
assert.equal(Polymer.dom(testElement.root).textContent, '[]', 'text content getter with comment incorrect');
var textNode = document.createTextNode('foo');
assert.equal(Polymer.dom(textNode).textContent, 'foo', 'text content getter on textnode incorrect');
Polymer.dom(textNode).textContent = 'bar';
assert.equal(textNode.textContent, 'bar', 'text content setter on textnode incorrect');
var commentNode = document.createComment('foo');
assert.equal(Polymer.dom(commentNode).textContent, 'foo', 'text content getter on commentnode incorrect');
Polymer.dom(commentNode).textContent = 'bar';
assert.equal(commentNode.textContent, 'bar', 'text content setter on commentnode incorrect');
});
test('Polymer.dom innerHTML', function() {