浏览代码

Updated docs for view utils parse() method.

Szymon Kupś 9 年之前
父节点
当前提交
c08cdf6e79
共有 1 个文件被更改,包括 11 次插入5 次删除
  1. 11 5
      packages/ckeditor5-engine/tests/_utils/view.js

+ 11 - 5
packages/ckeditor5-engine/tests/_utils/view.js

@@ -199,11 +199,6 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
 
 /**
  * Parses HTML-like string and returns view tree nodes.
- *
- * Empty string will be converted to empty {@link engine.view.DocumentFragment DocumentFragment}.
- *
- *		parse( '' ); // Returns instance of DocumentFragment.
- *
  * Simple string will be converted to {@link engine.view.Text Text} node:
  *
  *		parse( 'foobar' ); // Returns instance of Text.
@@ -240,6 +235,17 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
  *
  *		const { root, selection } = parse( `{foo}bar{baz}`, { lastRangeBackward: true } );
  *
+ * Other examples and edge cases:
+ *
+ *		// Returns empty DocumentFragment.
+ *		parse( '' );
+ *
+ *		// Returns empty DocumentFragment and collapsed selection.
+ *		const { root, selection } = parse( '[]' );
+ *
+ *		// Returns Element and selection that is placed inside of DocumentFragment containing that element.
+ *		const { root, selection } = parse( '[<a></a>]' );
+ *
  * @param {String} data HTML-like string to be parsed.
  * @param {Object} options
  * @param {Array.<Number>} [options.order] Array with order of parsed ranges added to returned