@samitouri / QOS-React-2 / commits / d4adaee4eb

use ie8 feature detect instead of try catch

凌恒 committed Apr 1, 2015 at 21:46 UTC d4adaee4eba49922e771db352a75181a9415a76a
1 file changed +4 -3
src/browser/ui/dom/DOMChildrenOperations.js
+4 -3
@@ -33,13 +33,14 @@ function insertChildAt(parentNode, childNode, index) {
33 // browsers so we must replace it with `null`.
34
35 // fix render order error in safari
36 - try {
36 + if (!(document.all && !document.addEventListener)) {
37 parentNode.insertBefore(
38 childNode,
39 parentNode.childNodes.item(index) || null
40 );
41 - } catch (e) {
42 - //IE8 can't use `item` when childNodes is empty.
41 + } else {
42 + //IE8 can't use `item` when childNodes is empty or dynamic insert.
43 + //But read is well after insert.
44 parentNode.insertBefore(
45 childNode,
46 parentNode.childNodes[index] || null