Selaa lähdekoodia

Fix TypeError in emoji insert function (#257)

In Chrome, text nodes are not "real" nodes, so they don't have a
`tagName` property.
Danilo Bargen 8 vuotta sitten
vanhempi
commit
9720257bd0
1 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. 4 2
      src/directives/compose_area.ts

+ 4 - 2
src/directives/compose_area.ts

@@ -437,8 +437,10 @@ export default [
 
                     // In Chrome in right-to-left mode, our content editable
                     // area may contain a DIV element.
-                    const nestedDiv = composeDiv[0].childNodes.length === 1
-                        && composeDiv[0].childNodes[0].tagName.toLowerCase() === 'div';
+                    const childNodes = composeDiv[0].childNodes;
+                    const nestedDiv = childNodes.length === 1
+                        && childNodes[0].tagName !== undefined
+                        && childNodes[0].tagName.toLowerCase() === 'div';
                     let contentElement;
                     if (nestedDiv === true) {
                         contentElement = composeDiv[0].childNodes[0];