      parent = node.parent()
      cost = 0
 
-     if parent?
+     while parent?
       cost += @getNodeBreakCost parent
-      while parent?
-       pos = (@getOffsetTop node.elem, @elems.main) -
-             (@getOffsetTop parent.elem, @elems.main)
-       cost += @_parentPositionCost pos
-       parent = parent.parent()
-     else
-      if node.type isnt 'article'
-       throw new Error 'Node without a parent'
+      pos = (@getOffsetTop node.elem, @elems.main) -
+            (@getOffsetTop parent.elem, @elems.main)
+      cost += @_parentPositionCost pos
+      parent = parent.parent()
 
      return cost
 

    4: 75
    5: 108
    6: 155


   PARENT_POSITION_COST = 500

 (Base, TYPES) ->

   PREFIX = 'wallapatta_'
   BLOCK_LEVEL = 10

   INF = 1e10

