mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
Merge pull request #3560 from mariodu/mariodu
fix render order error in safari. Fixes #3560.
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user