Skip to content

Commit

Permalink
Fixes #3730 and inspired by (#3585)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Orvell committed Jun 22, 2016
1 parent b78e5af commit ab431ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/dom-tree-api.html
Expand Up @@ -215,7 +215,7 @@
node.__dom.previousSibling.__dom.nextSibling = node;
}
// update node <-> ref_node
node.__dom.nextSibling = ref_node;
node.__dom.nextSibling = ref_node || null;
if (node.__dom.nextSibling) {
node.__dom.nextSibling.__dom.previousSibling = node;
}
Expand Down
4 changes: 4 additions & 0 deletions test/unit/polymer-dom.js
Expand Up @@ -704,11 +704,13 @@ suite('Polymer.dom accessors', function() {
var after = document.createElement('div');
Polymer.dom(noDistribute).insertBefore(before, child);
Polymer.dom(noDistribute).appendChild(after);
Polymer.dom.flush();
assert.equal(Polymer.dom(noDistribute).firstChild, before, 'firstChild incorrect');
assert.equal(Polymer.dom(noDistribute).lastChild, after, 'lastChild incorrect');
assert.equal(Polymer.dom(before).nextSibling, child, 'nextSibling incorrect');
assert.equal(Polymer.dom(child).nextSibling, after, 'nextSibling incorrect');
assert.equal(Polymer.dom(after).previousSibling, child, 'previousSibling incorrect');
assert.equal(Polymer.dom(after).nextSibling, null, 'nextSibling incorrect');
assert.equal(Polymer.dom(child).previousSibling, before, 'previousSibling incorrect');
});

Expand All @@ -719,11 +721,13 @@ suite('Polymer.dom accessors', function() {
var after = document.createElement('div');
Polymer.dom(distribute).insertBefore(before, child);
Polymer.dom(distribute).appendChild(after);
Polymer.dom.flush();
assert.equal(Polymer.dom(distribute).firstChild, before, 'firstChild incorrect');
assert.equal(Polymer.dom(distribute).lastChild, after, 'lastChild incorrect');
assert.equal(Polymer.dom(before).nextSibling, child, 'nextSibling incorrect');
assert.equal(Polymer.dom(child).nextSibling, after, 'nextSibling incorrect');
assert.equal(Polymer.dom(after).previousSibling, child, 'previousSibling incorrect');
assert.equal(Polymer.dom(after).nextSibling, null, 'nextSibling incorrect');
assert.equal(Polymer.dom(child).previousSibling, before, 'previousSibling incorrect');
});

Expand Down

0 comments on commit ab431ed

Please sign in to comment.