Opened 3 years ago

Last modified 3 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

  1. Open editor demo/sample.
  2. Set html to <p><b>abc</b><span class="foo"></span></p> (using dev console to make sure editor doesn't remove empty tags).
  3. Select abc.
  4. 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.

Change History (1)

comment:1 Changed 3 years ago by kkrzton

Status: newconfirmed
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy