Merge pull request #3560 from mariodu/mariodu

fix render order error in safari.  Fixes #3560.
This commit is contained in:
Jim
2015-04-01 17:40:09 -07:00
+8 -1
View File
@@ -31,9 +31,16 @@ function insertChildAt(parentNode, childNode, index) {
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
// fix render order error in safari
// IE8 will throw error when index out of list size.
var beforeChild = index >= parentNode.childNodes.length ?
null :
parentNode.childNodes.item(index);
parentNode.insertBefore(
childNode,
parentNode.childNodes[index] || null
beforeChild
);
}