tinymce/tinymce — pull request #181 by redsweater (2013-03-26 17:05:23+00:00)
Title: Avoid applying inline styles to next sibling that is not visibly part of the selection

When refining the target selection for an inline format, and endContainer with zero offset should be backed away from more aggressively. Previously if the endContainer had more than one child its entire content would be sucked into the target range, causing formats to apply far beyond the visible selection as far as the user is concerned.

Note that a very practical way of reaching this error scenario is on Safari (and possibly other WebKit browsers, by triple-clicking many line-based nodes like a list-item, you end up selecting up to offset-0 of the next sibling element.