diff --git a/online-editor.js b/online-editor.js index 908aa72..d5813fe 100644 --- a/online-editor.js +++ b/online-editor.js @@ -186,18 +186,8 @@ function besIsBlockElement(el) // Returns first block parent element function besGetBlockParent(el, edit) { - while (el && el !== edit) { - switch (el.nodeType) { - case Node.TEXT_NODE: - el = el.parentNode - break - - case Node.ELEMENT_NODE: - if (besIsBlockElement(el)) { - return el - } - el = el.parentNode - } + for (; el && el !== edit; el = el.parentNode) { + if (el.nodeType === Node.ELEMENT_NODE && besIsBlockElement(el)) return el } return el }