| 2152 | | if(s && s.isCollapsed && s.anchorNode && s.anchorNode.nodeType == 3) |
| 2153 | | { |
| 2154 | | if(s.anchorOffset == s.anchorNode.length) |
| 2155 | | { |
| 2156 | | if(HTMLArea.isBlockElement(s.anchorNode.parentNode)) |
| 2157 | | { |
| 2158 | | if(s.anchorNode.data != '\xA0' && !s.anchorNode.nextSibling) |
| 2159 | | { |
| 2160 | | s.anchorNode.parentNode.insertBefore(this._doc.createTextNode('\xA0'), s.anchorNode.nextSibling); |
| 2161 | | } |
| 2162 | | } |
| 2163 | | else |
| 2164 | | { |
| 2165 | | if(!s.anchorNode.parentNode.nextSibling) |
| 2166 | | { |
| 2167 | | s.anchorNode.parentNode.parentNode.insertBefore(this._doc.createTextNode('\xA0'), s.anchorNode.parentNode.nextSibling); |
| 2168 | | } |
| 2169 | | } |
| | 2154 | // If the last character in the last text node of the parent tag |
| | 2155 | if(s && s.isCollapsed && s.anchorNode |
| | 2156 | && s.anchorNode.parentNode.tagName.toLowerCase() != 'body' |
| | 2157 | && s.anchorNode.nodeType == 3 && s.anchorOffset == s.anchorNode.length |
| | 2158 | && ! |
| | 2159 | ( s.anchorNode.parentNode.nextSibling |
| | 2160 | && s.anchorNode.parentNode.nextSibling.nodeType == 3 |
| | 2161 | ) |
| | 2162 | ) |
| | 2163 | { |
| | 2164 | // Insert hair-width-space after the close tag if there isn't another text node on the other side |
| | 2165 | // It could also work with zero-width-space (\u200B) but I don't like it so much. |
| | 2166 | // Perhaps this won't work well in various character sets and we should use plain space (20)? |
| | 2167 | try |
| | 2168 | { |
| | 2169 | s.anchorNode.parentNode.parentNode.insertBefore |
| | 2170 | (this._doc.createTextNode('\u200A'), s.anchorNode.parentNode.nextSibling); |
| | 2171 | } |
| | 2172 | catch(e) |
| | 2173 | { |
| | 2174 | // Disregard |