- # does this node have whitespace that would be collapsed by white-space: normal?
- # note: this checks direct text children, and does _not_ recurse into child tags
- # tag is a node with type:"tag"
- # FIXME use new textrun api
- has_collapsable_space: (tag) ->
- for n in tag.children
- if n.type is 'text'
- for i in [0...n.text.length]
- code = n.text.charCodeAt i
- if code isnt 32 and is_space_code code
- # tab, return
- return true
- # check for double spaces that don't surround insert location
- continue if i is 0
- if n.text.substr(i - 1, 2) is ' '
- return true
- if n.text.length > 0
- if is_space_code n.text.charCodeAt 0
- return true
- if is_space_code n.text.charCodeAt n.text.length - 1
- return true
- return false