mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Handle commentnodes correctly for textContent and innerHTML
Fixes #2104
This commit is contained in:
1740
src/lib/dom-api.html
1740
src/lib/dom-api.html
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user