Simplify besGetBlockParent()
This commit is contained in:
parent
b034d5dd56
commit
218bac6ece
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user