mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
use ie8 feature detect instead of try catch
This commit is contained in:
@@ -33,13 +33,14 @@ function insertChildAt(parentNode, childNode, index) {
|
||||
// browsers so we must replace it with `null`.
|
||||
|
||||
// fix render order error in safari
|
||||
try {
|
||||
if (!(document.all && !document.addEventListener)) {
|
||||
parentNode.insertBefore(
|
||||
childNode,
|
||||
parentNode.childNodes.item(index) || null
|
||||
);
|
||||
} catch (e) {
|
||||
//IE8 can't use `item` when childNodes is empty.
|
||||
} else {
|
||||
//IE8 can't use `item` when childNodes is empty or dynamic insert.
|
||||
//But read is well after insert.
|
||||
parentNode.insertBefore(
|
||||
childNode,
|
||||
parentNode.childNodes[index] || null
|
||||
|
||||
Reference in New Issue
Block a user