From eca539c324d872ff512a19b6603bdcd388281622 Mon Sep 17 00:00:00 2001 From: James Johnson Date: Fri, 25 Aug 2017 14:15:37 +1000 Subject: [PATCH] fix/1273: Fix child node length checks --- blocks/library/freeform/old-editor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blocks/library/freeform/old-editor.js b/blocks/library/freeform/old-editor.js index 64d6422922cab1..5d463c350677a8 100644 --- a/blocks/library/freeform/old-editor.js +++ b/blocks/library/freeform/old-editor.js @@ -12,12 +12,12 @@ function isTmceEmpty( editor ) { //


// avoid expensive checks for large documents const body = editor.getBody(); - if ( body.childNodes > 1 ) { + if ( body.childNodes.length > 1 ) { return false; - } else if ( body.childNodes === 0 ) { + } else if ( body.childNodes.length === 0 ) { return true; } - if ( body.childNodes[ 0 ].childNodes > 1 ) { + if ( body.childNodes[ 0 ].childNodes.length > 1 ) { return false; } return /^\n?$/.test( body.innerText || body.textContent );