Skip to content
Browse files

Handle commentnodes correctly for textContent and innerHTML

Fixes #2104
  • Loading branch information...
1 parent 3dc50fc commit 6d56d2bd94a80dd3bb6eaf370dbb2ba5da2c0711 @azakus azakus committed
Showing with 894 additions and 865 deletions.
  1. +876 −864 src/lib/dom-api.html
  2. +6 −1 test/unit/polymer-dom-elements.html
  3. +12 −0 test/unit/polymer-dom.js
View
1,740 src/lib/dom-api.html
876 additions, 864 deletions not shown
View
7 test/unit/polymer-dom-elements.html
@@ -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
12 test/unit/polymer-dom.js
@@ -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() {

0 comments on commit 6d56d2b

Please sign in to comment.
Something went wrong with that request. Please try again.