IE11 does not expose `DocumentFragment.children`
authorAlexander Ebert <ebert@woltlab.com>
Wed, 7 Feb 2018 14:34:49 +0000 (15:34 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 7 Feb 2018 14:34:49 +0000 (15:34 +0100)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabDropdown.js

index b471e674df5e95531f04356512087f0802c2c472..009bae4e0187ed65738bfe8b85cfeb3924b12c5b 100644 (file)
@@ -31,7 +31,15 @@ $.Redactor.prototype.WoltLabDropdown = function() {
                                        }
                                }
                                
-                               if (fragment.children.length > 0) {
+                               var hasItems = false;
+                               for (var i = 0, length = fragment.childNodes.length; i < length; i++) {
+                                       if (fragment.childNodes[i].nodeType === Node.ELEMENT_NODE) {
+                                               hasItems = true;
+                                               break;
+                                       }
+                               }
+                               
+                               if (hasItems) {
                                        $dropdown[0].rel = name;
                                        $dropdown[0].appendChild(fragment);
                                }