Opened 9 years ago
Last modified 9 years ago
#14501 confirmed Bug
[Blink] Range.enlarge behaves different with empty blocks.
Reported by: | kkrzton | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Core : Selection | Version: | |
Keywords: | Cc: | Marek Lewandowski |
Description
While using range.enlarge( CKEDITOR.ENLARGE_ELEMENT ) on selection like <p><b>[abc]</b><span class="foo"></span></p>
, in Blink enlarging stops on empty span
element while in other browsers (FF, IE, Edge) span
is omitted so range fully enlarges to p
element.
Steps to reproduce
- Open editor demo/sample.
- Set html to
<p><b>abc</b><span class="foo"></span></p>
(using dev console to make sure editor doesn't remove empty tags). - Select
abc
. - Run code:
var range = CKEDITOR.instances.editor.getSelection().getRanges()[0]; // preview range here range.enlarge( CKEDITOR.ENLARGE_ELEMENT ); //preview range here
In Blink after enlarging:
- startContainer: body
- startOffset: 0
- endContainer: p (p has 2 child nodes)
- endOffset: 1
In other browsers:
- startContainer: body
- startOffset: 0
- endContainer: body (body has 1 child node)
- endOffset: 1
Expected result
Resulted range after using range.enlarge is same in all browsers.
Actual result
Resulted range after using range.enlarge is different in Blink browsers.
Not sure what should be expected behavior, if it should be same as in Blink or same as in FF/IE for all browsers.
Other details (browser, OS, CKEditor version, installed plugins)
Tested in CKEditor 4.5.7.