- check_i = 1
- txts.push n.text.substr 0, i
- txts.push n.text.substr i, 1
- txts.push n.text.substr i + 1
- for txt, txt_i in txts
- el = n.el.ownerDocument.createTextNode txt
- if txt_i is check_i
- span = n.el.ownerDocument.createElement 'span'
- span.appendChild el
- el = span
- els.push el
- parent.insertBefore el, n.el
- parent.removeChild n.el
- bounds = get_el_bounds els[check_i]
- parent.insertBefore n.el, els[0]
- for el in els
- parent.removeChild el
- ret = x: bounds.x, y: bounds.y, h: bounds.h
+ rect = rect[0]
+ else
+ return x: 0, y: 0, w: 0, h: 0 # TODO return null, fix callers
+ ret = {
+ x: rect.left
+ y: rect.top
+ w: rect.width ? (rect.right - rect.left)
+ h: rect.height ? (rect.top - rect.bottom)
+ }