diff --git a/src/lib/template/dom-bind.html b/src/lib/template/dom-bind.html
index c9561c9105..a7cdf4bccd 100644
--- a/src/lib/template/dom-bind.html
+++ b/src/lib/template/dom-bind.html
@@ -108,8 +108,16 @@
},
_insertChildren: function() {
- var parentDom = Polymer.dom(Polymer.dom(this).parentNode);
- parentDom.insertBefore(this.root, this);
+ var refNode;
+ var parentNode = Polymer.dom(this).parentNode;
+ // Affordance for 2.x hybrid mode
+ if (parentNode.localName == this.is) {
+ refNode = parentNode;
+ parentNode = Polymer.dom(parentNode).parentNode;
+ } else {
+ refNode = this;
+ }
+ Polymer.dom(parentNode).insertBefore(this.root, refNode);
},
_removeChildren: function() {
diff --git a/src/lib/template/dom-if.html b/src/lib/template/dom-if.html
index dc018ba579..8952e8be5a 100644
--- a/src/lib/template/dom-if.html
+++ b/src/lib/template/dom-if.html
@@ -134,11 +134,18 @@
var parentNode = Polymer.dom(this).parentNode;
// Guard against element being detached while render was queued
if (parentNode) {
- var parent = Polymer.dom(parentNode);
+ var refNode;
+ // Affordance for 2.x hybrid mode
+ if (parentNode.localName == this.is) {
+ refNode = parentNode;
+ parentNode = Polymer.dom(parentNode).parentNode;
+ } else {
+ refNode = this;
+ }
if (!this._instance) {
this._instance = this.stamp();
var root = this._instance.root;
- parent.insertBefore(root, this);
+ Polymer.dom(parentNode).insertBefore(root, refNode);
} else {
var c$ = this._instance._children;
if (c$ && c$.length) {
@@ -146,7 +153,7 @@
var lastChild = Polymer.dom(this).previousSibling;
if (lastChild !== c$[c$.length-1]) {
for (var i=0, n; (i
@@ -42,6 +42,13 @@
+
+
+
+
+
+
+
diff --git a/test/unit/dom-if.html b/test/unit/dom-if.html
index 39dfcfbf14..3666bde095 100644
--- a/test/unit/dom-if.html
+++ b/test/unit/dom-if.html
@@ -71,8 +71,33 @@
+
+
+
+ [[prop]]
+
+
+