Simplify besGetBlockParent()
This commit is contained in:
parent
b034d5dd56
commit
218bac6ece
@ -186,18 +186,8 @@ function besIsBlockElement(el)
|
|||||||
// Returns first block parent element
|
// Returns first block parent element
|
||||||
function besGetBlockParent(el, edit)
|
function besGetBlockParent(el, edit)
|
||||||
{
|
{
|
||||||
while (el && el !== edit) {
|
for (; el && el !== edit; el = el.parentNode) {
|
||||||
switch (el.nodeType) {
|
if (el.nodeType === Node.ELEMENT_NODE && besIsBlockElement(el)) return el
|
||||||
case Node.TEXT_NODE:
|
|
||||||
el = el.parentNode
|
|
||||||
break
|
|
||||||
|
|
||||||
case Node.ELEMENT_NODE:
|
|
||||||
if (besIsBlockElement(el)) {
|
|
||||||
return el
|
|
||||||
}
|
|
||||||
el = el.parentNode
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return el
|
return el
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user