Explorar el Código

Merge branch 'master' into t/1515

Krzysztof Krztoń hace 7 años
padre
commit
f3b52b8871
Se han modificado 35 ficheros con 769 adiciones y 40 borrados
  1. 1 1
      packages/ckeditor5-engine/src/controller/datacontroller.js
  2. 1 1
      packages/ckeditor5-engine/src/conversion/conversion.js
  3. 1 1
      packages/ckeditor5-engine/src/model/documentfragment.js
  4. 1 1
      packages/ckeditor5-engine/src/model/element.js
  5. 1 1
      packages/ckeditor5-engine/src/model/operation/attributeoperation.js
  6. 1 1
      packages/ckeditor5-engine/src/model/operation/detachoperation.js
  7. 1 1
      packages/ckeditor5-engine/src/model/operation/insertoperation.js
  8. 1 1
      packages/ckeditor5-engine/src/model/operation/markeroperation.js
  9. 1 1
      packages/ckeditor5-engine/src/model/operation/mergeoperation.js
  10. 1 1
      packages/ckeditor5-engine/src/model/operation/moveoperation.js
  11. 1 1
      packages/ckeditor5-engine/src/model/operation/nooperation.js
  12. 1 1
      packages/ckeditor5-engine/src/model/operation/operation.js
  13. 1 1
      packages/ckeditor5-engine/src/model/operation/renameoperation.js
  14. 1 1
      packages/ckeditor5-engine/src/model/operation/rootattributeoperation.js
  15. 1 1
      packages/ckeditor5-engine/src/model/operation/splitoperation.js
  16. 1 1
      packages/ckeditor5-engine/src/model/operation/unwrapoperation.js
  17. 1 1
      packages/ckeditor5-engine/src/model/operation/wrapoperation.js
  18. 1 1
      packages/ckeditor5-engine/src/view/document.js
  19. 3 3
      packages/ckeditor5-engine/src/view/downcastwriter.js
  20. 1 1
      packages/ckeditor5-engine/src/view/editableelement.js
  21. 1 1
      packages/ckeditor5-engine/src/view/item.jsdoc
  22. 248 0
      packages/ckeditor5-engine/src/view/upcastwriter.js
  23. 2 2
      packages/ckeditor5-engine/tests/dev-utils/operationreplayer.js
  24. 2 2
      packages/ckeditor5-engine/tests/model/operation/attributeoperation.js
  25. 1 1
      packages/ckeditor5-engine/tests/model/operation/detachoperation.js
  26. 1 1
      packages/ckeditor5-engine/tests/model/operation/insertoperation.js
  27. 1 1
      packages/ckeditor5-engine/tests/model/operation/markeroperation.js
  28. 1 1
      packages/ckeditor5-engine/tests/model/operation/moveoperation.js
  29. 1 1
      packages/ckeditor5-engine/tests/model/operation/nooperation.js
  30. 2 2
      packages/ckeditor5-engine/tests/model/operation/operation.js
  31. 1 1
      packages/ckeditor5-engine/tests/model/operation/operationfactory.js
  32. 1 1
      packages/ckeditor5-engine/tests/model/operation/renameoperation.js
  33. 2 2
      packages/ckeditor5-engine/tests/model/operation/rootattributeoperation.js
  34. 2 2
      packages/ckeditor5-engine/tests/model/operation/wrapoperation.js
  35. 481 0
      packages/ckeditor5-engine/tests/view/upcastwriter.js

+ 1 - 1
packages/ckeditor5-engine/src/controller/datacontroller.js

@@ -253,7 +253,7 @@ export default class DataController {
 	/**
 	/**
 	 * Returns the result of the given {@link module:engine/view/element~Element view element} or
 	 * Returns the result of the given {@link module:engine/view/element~Element view element} or
 	 * {@link module:engine/view/documentfragment~DocumentFragment view document fragment} converted by the
 	 * {@link module:engine/view/documentfragment~DocumentFragment view document fragment} converted by the
-	 * {@link #upcastDispatcher view-to-model converters}, wrapped by {module:engine/model/documentfragment~DocumentFragment}.
+	 * {@link #upcastDispatcher view-to-model converters}, wrapped by {@link module:engine/model/documentfragment~DocumentFragment}.
 	 *
 	 *
 	 * When marker elements were converted during the conversion process, it will be set as a document fragment's
 	 * When marker elements were converted during the conversion process, it will be set as a document fragment's
 	 * {@link module:engine/model/documentfragment~DocumentFragment#markers static markers map}.
 	 * {@link module:engine/model/documentfragment~DocumentFragment#markers static markers map}.

+ 1 - 1
packages/ckeditor5-engine/src/conversion/conversion.js

@@ -59,7 +59,7 @@ import {
  * Model element to view element and vice versa.
  * Model element to view element and vice versa.
  * * {@link module:engine/conversion/conversion~Conversion#attributeToElement `attributeToElement()`} –
  * * {@link module:engine/conversion/conversion~Conversion#attributeToElement `attributeToElement()`} –
  * Model attribute to view element and vice versa.
  * Model attribute to view element and vice versa.
- * * {@link module:engine/conversion/conversion~Conversion#attributeToElement `attributeToElement()`} –
+ * * {@link module:engine/conversion/conversion~Conversion#attributeToAttribute `attributeToAttribute()`} –
  * Model attribute to view element and vice versa.
  * Model attribute to view element and vice versa.
  */
  */
 export default class Conversion {
 export default class Conversion {

+ 1 - 1
packages/ckeditor5-engine/src/model/documentfragment.js

@@ -76,7 +76,7 @@ export default class DocumentFragment {
 	}
 	}
 
 
 	/**
 	/**
-	 * Sum of {module:engine/model/node~Node#offsetSize offset sizes} of all of this document fragment's children.
+	 * Sum of {@link module:engine/model/node~Node#offsetSize offset sizes} of all of this document fragment's children.
 	 *
 	 *
 	 * @readonly
 	 * @readonly
 	 * @type {Number}
 	 * @type {Number}

+ 1 - 1
packages/ckeditor5-engine/src/model/element.js

@@ -69,7 +69,7 @@ export default class Element extends Node {
 	}
 	}
 
 
 	/**
 	/**
-	 * Sum of {module:engine/model/node~Node#offsetSize offset sizes} of all of this element's children.
+	 * Sum of {@link module:engine/model/node~Node#offsetSize offset sizes} of all of this element's children.
 	 *
 	 *
 	 * @readonly
 	 * @readonly
 	 * @type {Number}
 	 * @type {Number}

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/attributeoperation.js

@@ -179,7 +179,7 @@ export default class AttributeOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.AttributeOperation';
+		return 'AttributeOperation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/detachoperation.js

@@ -89,6 +89,6 @@ export default class DetachOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.DetachOperation';
+		return 'DetachOperation';
 	}
 	}
 }
 }

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/insertoperation.js

@@ -144,7 +144,7 @@ export default class InsertOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.InsertOperation';
+		return 'InsertOperation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/markeroperation.js

@@ -126,7 +126,7 @@ export default class MarkerOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.MarkerOperation';
+		return 'MarkerOperation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/mergeoperation.js

@@ -169,7 +169,7 @@ export default class MergeOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.MergeOperation';
+		return 'MergeOperation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/moveoperation.js

@@ -191,7 +191,7 @@ export default class MoveOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.MoveOperation';
+		return 'MoveOperation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/nooperation.js

@@ -49,6 +49,6 @@ export default class NoOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.NoOperation';
+		return 'NoOperation';
 	}
 	}
 }
 }

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/operation.js

@@ -112,7 +112,7 @@ export default class Operation {
 	 * @type {String}
 	 * @type {String}
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.Operation';
+		return 'Operation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/renameoperation.js

@@ -131,7 +131,7 @@ export default class RenameOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.RenameOperation';
+		return 'RenameOperation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/rootattributeoperation.js

@@ -177,7 +177,7 @@ export default class RootAttributeOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.RootAttributeOperation';
+		return 'RootAttributeOperation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/splitoperation.js

@@ -185,7 +185,7 @@ export default class SplitOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.SplitOperation';
+		return 'SplitOperation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/unwrapoperation.js

@@ -146,7 +146,7 @@ export default class UnwrapOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.UnwrapOperation';
+		return 'UnwrapOperation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/wrapoperation.js

@@ -186,7 +186,7 @@ export default class WrapOperation extends Operation {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	static get className() {
 	static get className() {
-		return 'engine.model.operation.WrapOperation';
+		return 'WrapOperation';
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
packages/ckeditor5-engine/src/view/document.js

@@ -32,7 +32,7 @@ export default class Document {
 		this.selection = new DocumentSelection();
 		this.selection = new DocumentSelection();
 
 
 		/**
 		/**
-		 * Roots of the view tree. Collection of the {module:engine/view/element~Element view elements}.
+		 * Roots of the view tree. Collection of the {@link module:engine/view/element~Element view elements}.
 		 *
 		 *
 		 * View roots are created as a result of binding between {@link module:engine/view/document~Document#roots} and
 		 * View roots are created as a result of binding between {@link module:engine/view/document~Document#roots} and
 		 * {@link module:engine/model/document~Document#roots} and this is handled by
 		 * {@link module:engine/model/document~Document#roots} and this is handled by

+ 3 - 3
packages/ckeditor5-engine/src/view/downcastwriter.js

@@ -789,7 +789,7 @@ export default class DowncastWriter {
      * and {@link module:engine/view/range~Range#end} positions are not placed inside same parent container.
      * and {@link module:engine/view/range~Range#end} positions are not placed inside same parent container.
      *
      *
      * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
      * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
-     * an instance of {module:engine/view/attributeelement~AttributeElement AttributeElement}.
+     * an instance of {@link module:engine/view/attributeelement~AttributeElement AttributeElement}.
      *
      *
      * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-nonselection-collapsed-range` when passed range
      * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-nonselection-collapsed-range` when passed range
      * is collapsed and different than view selection.
      * is collapsed and different than view selection.
@@ -1061,7 +1061,7 @@ export default class DowncastWriter {
 	 * This method will also merge newly added attribute element with its siblings whenever possible.
 	 * This method will also merge newly added attribute element with its siblings whenever possible.
 	 *
 	 *
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
-	 * an instance of {module:engine/view/attributeelement~AttributeElement AttributeElement}.
+	 * an instance of {@link module:engine/view/attributeelement~AttributeElement AttributeElement}.
 	 *
 	 *
 	 * @private
 	 * @private
 	 * @param {module:engine/view/range~Range} range
 	 * @param {module:engine/view/range~Range} range
@@ -1124,7 +1124,7 @@ export default class DowncastWriter {
 	 * This method will also merge newly added attribute element with its siblings whenever possible.
 	 * This method will also merge newly added attribute element with its siblings whenever possible.
 	 *
 	 *
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
-	 * an instance of {module:engine/view/attributeelement~AttributeElement AttributeElement}.
+	 * an instance of {@link module:engine/view/attributeelement~AttributeElement AttributeElement}.
 	 *
 	 *
 	 * @private
 	 * @private
 	 * @param {module:engine/view/position~Position} position
 	 * @param {module:engine/view/position~Position} position

+ 1 - 1
packages/ckeditor5-engine/src/view/editableelement.js

@@ -18,7 +18,7 @@ const documentSymbol = Symbol( 'document' );
  * Editable element which can be a {@link module:engine/view/rooteditableelement~RootEditableElement root}
  * Editable element which can be a {@link module:engine/view/rooteditableelement~RootEditableElement root}
  * or nested editable area in the editor.
  * or nested editable area in the editor.
  *
  *
- * Editable is automatically read-only when its {module:engine/view/document~Document Document} is read-only.
+ * Editable is automatically read-only when its {@link module:engine/view/document~Document Document} is read-only.
  *
  *
  * @extends module:engine/view/containerelement~ContainerElement
  * @extends module:engine/view/containerelement~ContainerElement
  * @mixes module:utils/observablemixin~ObservableMixin
  * @mixes module:utils/observablemixin~ObservableMixin

+ 1 - 1
packages/ckeditor5-engine/src/view/item.jsdoc

@@ -8,7 +8,7 @@
  */
  */
 
 
 /**
 /**
- * Item is a {@link module:engine/view/node~Node Node} or {module:engine/view/textproxy~TextProxy TextProxy}.
+ * Item is a {@link module:engine/view/node~Node Node} or {@link module:engine/view/textproxy~TextProxy TextProxy}.
  *
  *
  * @typedef {module:engine/view/node~Node|module:engine/view/textproxy~TextProxy} module:engine/view/item~Item
  * @typedef {module:engine/view/node~Node|module:engine/view/textproxy~TextProxy} module:engine/view/item~Item
  */
  */

+ 248 - 0
packages/ckeditor5-engine/src/view/upcastwriter.js

@@ -0,0 +1,248 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module module:engine/view/upcastwriter
+ */
+
+import Element from './element';
+import { isPlainObject } from 'lodash-es';
+
+/**
+ * View upcast writer class. Provides set of methods used to properly manipulate nodes attached to
+ * {@link module:engine/view/view~View view instance}. It should be only used to manipulate non-semantic view
+ * (view created from HTML string). For view which was downcasted from the {@link module:engine/model/model~Model model}
+ * see {@link module:engine/view/writer~Writer writer}.
+ */
+export default class UpcastWriter {
+	/**
+	 * Clones provided element.
+	 *
+	 * @see module:engine/view/element~Element#_clone
+	 * @param {module:engine/view/element~Element} element Element to be cloned.
+	 * @param {Boolean} [deep=false] If set to `true` clones element and all its children recursively. When set to `false`,
+	 * element will be cloned without any children.
+	 * @returns {module:engine/view/element~Element} Clone of this element.
+	 */
+	clone( element, deep = false ) {
+		return element._clone( deep );
+	}
+
+	/**
+	 * Appends a child node or a list of child nodes at the end of this node
+	 * and sets the parent of these nodes to this element.
+	 *
+	 * @see module:engine/view/element~Element#_appendChild
+	 * @param {module:engine/view/item~Item|Iterable.<module:engine/view/item~Item>} items Items to be inserted.
+	 * @param {module:engine/view/element~Element|module:engine/view/documentfragment~DocumentFragment} element Element
+	 * to which items will be appended.
+	 * @fires module:engine/view/node~Node#event:change
+	 * @returns {Number} Number of appended nodes.
+	 */
+	appendChild( items, element ) {
+		return element._appendChild( items );
+	}
+
+	/**
+	 * Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to
+	 * this element.
+	 *
+	 * @see module:engine/view/element~Element#_insertChild
+	 * @param {Number} index Offset at which nodes should be inserted.
+	 * @param {module:engine/view/item~Item|Iterable.<module:engine/view/item~Item>} items Items to be inserted.
+	 * @param {module:engine/view/element~Element|module:engine/view/documentfragment~DocumentFragment} element Element
+	 * to which items will be inserted.
+	 * @fires module:engine/view/node~Node#event:change
+	 * @returns {Number} Number of inserted nodes.
+	 */
+	insertChild( index, items, element ) {
+		return element._insertChild( index, items );
+	}
+
+	/**
+	 * Removes number of child nodes starting at the given index and set the parent of these nodes to `null`.
+	 *
+	 * @see module:engine/view/element~Element#_removeChildren
+	 * @param {Number} index Offset from which nodes will be removed.
+	 * @param {Number} howMany Number of nodes to remove.
+	 * @param {module:engine/view/element~Element|module:engine/view/documentfragment~DocumentFragment} element Element
+	 * which children will be removed.
+	 * @fires module:engine/view/node~Node#event:change
+	 * @returns {Array.<module:engine/view/node~Node>} The array containing removed nodes.
+	 */
+	removeChildren( index, howMany, element ) {
+		return element._removeChildren( index, howMany );
+	}
+
+	/**
+	 * Removes given element from the view structure. Will not have effect on detached elements.
+	 *
+	 * @param {module:engine/view/element~Element} element Element which will be removed.
+	 * @returns {Array.<module:engine/view/node~Node>} The array containing removed nodes.
+	 */
+	remove( element ) {
+		const parent = element.parent;
+
+		if ( parent ) {
+			return this.removeChildren( parent.getChildIndex( element ), 1, parent );
+		}
+
+		return [];
+	}
+
+	/**
+	 * Replaces given element with the new one in the view structure. Will not have effect on detached elements.
+	 *
+	 * @param {module:engine/view/element~Element} oldElement Element which will be replaced.
+	 * @param {module:engine/view/element~Element} newElement Element which will be inserted in the place of the old element.
+	 * @returns {Boolean} Whether old element was successfully replaced.
+	 */
+	replace( oldElement, newElement ) {
+		const parent = oldElement.parent;
+
+		if ( parent ) {
+			const index = parent.getChildIndex( oldElement );
+
+			this.removeChildren( index, 1, parent );
+			this.insertChild( index, newElement, parent );
+
+			return true;
+		}
+
+		return false;
+	}
+
+	/**
+	 * Renames element by creating a copy of a given element but with its name changed and then moving contents of the
+	 * old element to the new one.
+	 *
+	 * Since this function creates a new element and removes the given one, the new element is returned to keep reference.
+	 *
+	 * @param {String} newName New element name.
+	 * @param {module:engine/view/element~Element} element Element to be renamed.
+	 * @returns {module:engine/view/element~Element|null} New element or null if the old element
+	 * was not replaced (happens for detached elements).
+	 */
+	rename( newName, element ) {
+		const newElement = new Element( newName, element.getAttributes(), element.getChildren() );
+
+		return this.replace( element, newElement ) ? newElement : null;
+	}
+
+	/**
+	 * Adds or overwrites element's attribute with a specified key and value.
+	 *
+	 *		writer.setAttribute( linkElement, 'href', 'http://ckeditor.com' );
+	 *
+	 * @see module:engine/view/element~Element#_setAttribute
+	 * @param {String} key Attribute key.
+	 * @param {String} value Attribute value.
+	 * @param {module:engine/view/element~Element} element Element for which attribute will be set.
+	 */
+	setAttribute( key, value, element ) {
+		element._setAttribute( key, value );
+	}
+
+	/**
+	 * Removes attribute from the element.
+	 *
+	 *		writer.removeAttribute( linkElement, 'href' );
+	 *
+	 * @see module:engine/view/element~Element#_removeAttribute
+	 * @param {String} key Attribute key.
+	 * @param {module:engine/view/element~Element} element Element from which attribute will be removed.
+	 */
+	removeAttribute( key, element ) {
+		element._removeAttribute( key );
+	}
+
+	/**
+	 * Adds specified class to the element.
+	 *
+	 *		writer.addClass( linkElement, 'foo' );
+	 *		writer.addClass( linkElement, [ 'foo', 'bar' ] );
+	 *
+	 * @see module:engine/view/element~Element#_addClass
+	 * @param {Array.<String>|String} className Single class name or array of class names which will be added.
+	 * @param {module:engine/view/element~Element} element Element for which class will be added.
+	 */
+	addClass( className, element ) {
+		element._addClass( className );
+	}
+
+	/**
+	 * Removes specified class from the element.
+	 *
+	 *		writer.removeClass( linkElement, 'foo' );
+	 *		writer.removeClass( linkElement, [ 'foo', 'bar' ] );
+	 *
+	 * @see module:engine/view/element~Element#_removeClass
+	 * @param {Array.<String>|String} className Single class name or array of class names which will be removed.
+	 * @param {module:engine/view/element~Element} element Element from which class will be removed.
+	 */
+	removeClass( className, element ) {
+		element._removeClass( className );
+	}
+
+	/**
+	 * Adds style to the element.
+	 *
+	 *		writer.setStyle( element, 'color', 'red' );
+	 *		writer.setStyle( element, {
+	 *			color: 'red',
+	 *			position: 'fixed'
+	 *		} );
+	 *
+	 * @see module:engine/view/element~Element#_setStyle
+	 * @param {String|Object} property Property name or object with key - value pairs.
+	 * @param {String} [value] Value to set. This parameter is ignored if object is provided as the first parameter.
+	 * @param {module:engine/view/element~Element} element Element for which style will be added.
+	 */
+	setStyle( property, value, element ) {
+		if ( isPlainObject( property ) && element === undefined ) {
+			element = value;
+		}
+		element._setStyle( property, value );
+	}
+
+	/**
+	 * Removes specified style from the element.
+	 *
+	 *		writer.removeStyle( element, 'color' );  // Removes 'color' style.
+	 *		writer.removeStyle( element, [ 'color', 'border-top' ] ); // Removes both 'color' and 'border-top' styles.
+	 *
+	 * @see module:engine/view/element~Element#_removeStyle
+	 * @param {Array.<String>|String} property Style property name or names to be removed.
+	 * @param {module:engine/view/element~Element} element Element from which style will be removed.
+	 */
+	removeStyle( property, element ) {
+		element._removeStyle( property );
+	}
+
+	/**
+	 * Sets a custom property on element. Unlike attributes, custom properties are not rendered to the DOM,
+	 * so they can be used to add special data to elements.
+	 *
+	 * @see module:engine/view/element~Element#_setCustomProperty
+	 * @param {String|Symbol} key Custom property name/key.
+	 * @param {*} value Custom property value to be stored.
+	 * @param {module:engine/view/element~Element} element Element for which custom property will be set.
+	 */
+	setCustomProperty( key, value, element ) {
+		element._setCustomProperty( key, value );
+	}
+
+	/**
+	 * Removes a custom property stored under the given key.
+	 *
+	 * @see module:engine/view/element~Element#_removeCustomProperty
+	 * @param {String|Symbol} key Name/key of the custom property to be removed.
+	 * @param {module:engine/view/element~Element} element Element from which the custom property will be removed.
+	 * @returns {Boolean} Returns true if property was removed.
+	 */
+	removeCustomProperty( key, element ) {
+		return element._removeCustomProperty( key );
+	}
+}

+ 2 - 2
packages/ckeditor5-engine/tests/dev-utils/operationreplayer.js

@@ -175,7 +175,7 @@ function getFirstOperation() {
 				data: 'The great world of open Web standards'
 				data: 'The great world of open Web standards'
 			} ]
 			} ]
 		} ],
 		} ],
-		__className: 'engine.model.operation.InsertOperation'
+		__className: 'InsertOperation'
 	};
 	};
 }
 }
 
 
@@ -192,6 +192,6 @@ function getSecondOperation() {
 				data: 'The great world of open Web standards'
 				data: 'The great world of open Web standards'
 			} ]
 			} ]
 		} ],
 		} ],
-		__className: 'engine.model.operation.InsertOperation'
+		__className: 'InsertOperation'
 	};
 	};
 }
 }

+ 2 - 2
packages/ckeditor5-engine/tests/model/operation/attributeoperation.js

@@ -378,10 +378,10 @@ describe( 'AttributeOperation', () => {
 
 
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
-			expect( serialized.__className ).to.equal( 'engine.model.operation.AttributeOperation' );
+			expect( serialized.__className ).to.equal( 'AttributeOperation' );
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.AttributeOperation',
+				__className: 'AttributeOperation',
 				baseVersion: 0,
 				baseVersion: 0,
 				key: 'key',
 				key: 'key',
 				newValue: 'newValue',
 				newValue: 'newValue',

+ 1 - 1
packages/ckeditor5-engine/tests/model/operation/detachoperation.js

@@ -63,7 +63,7 @@ describe( 'DetachOperation', () => {
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.DetachOperation',
+				__className: 'DetachOperation',
 				baseVersion: null,
 				baseVersion: null,
 				sourcePosition: position.toJSON(),
 				sourcePosition: position.toJSON(),
 				howMany: 1
 				howMany: 1

+ 1 - 1
packages/ckeditor5-engine/tests/model/operation/insertoperation.js

@@ -225,7 +225,7 @@ describe( 'InsertOperation', () => {
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.InsertOperation',
+				__className: 'InsertOperation',
 				baseVersion: 0,
 				baseVersion: 0,
 				nodes: ( new NodeList( [ new Text( 'x' ) ] ) ).toJSON(),
 				nodes: ( new NodeList( [ new Text( 'x' ) ] ) ).toJSON(),
 				position: position.toJSON(),
 				position: position.toJSON(),

+ 1 - 1
packages/ckeditor5-engine/tests/model/operation/markeroperation.js

@@ -137,7 +137,7 @@ describe( 'MarkerOperation', () => {
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.MarkerOperation',
+				__className: 'MarkerOperation',
 				baseVersion: 0,
 				baseVersion: 0,
 				name: 'name',
 				name: 'name',
 				oldRange: null,
 				oldRange: null,

+ 1 - 1
packages/ckeditor5-engine/tests/model/operation/moveoperation.js

@@ -272,7 +272,7 @@ describe( 'MoveOperation', () => {
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.MoveOperation',
+				__className: 'MoveOperation',
 				baseVersion: 0,
 				baseVersion: 0,
 				howMany: 1,
 				howMany: 1,
 				sourcePosition: op.sourcePosition.toJSON(),
 				sourcePosition: op.sourcePosition.toJSON(),

+ 1 - 1
packages/ckeditor5-engine/tests/model/operation/nooperation.js

@@ -38,7 +38,7 @@ describe( 'NoOperation', () => {
 			const serialized = noop.toJSON();
 			const serialized = noop.toJSON();
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.NoOperation',
+				__className: 'NoOperation',
 				baseVersion: 0
 				baseVersion: 0
 			} );
 			} );
 		} );
 		} );

+ 2 - 2
packages/ckeditor5-engine/tests/model/operation/operation.js

@@ -34,7 +34,7 @@ describe( 'Operation', () => {
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.Operation',
+				__className: 'Operation',
 				baseVersion: 4
 				baseVersion: 4
 			} );
 			} );
 		} );
 		} );
@@ -47,7 +47,7 @@ describe( 'Operation', () => {
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.Operation',
+				__className: 'Operation',
 				baseVersion: 4
 				baseVersion: 4
 			} );
 			} );
 		} );
 		} );

+ 1 - 1
packages/ckeditor5-engine/tests/model/operation/operationfactory.js

@@ -16,7 +16,7 @@ describe( 'OperationFactory', () => {
 
 
 	it( 'should create operation from JSON', () => {
 	it( 'should create operation from JSON', () => {
 		const operation = OperationFactory.fromJSON( {
 		const operation = OperationFactory.fromJSON( {
-			__className: 'engine.model.operation.NoOperation',
+			__className: 'NoOperation',
 			baseVersion: 0
 			baseVersion: 0
 		}, model.doc );
 		}, model.doc );
 
 

+ 1 - 1
packages/ckeditor5-engine/tests/model/operation/renameoperation.js

@@ -108,7 +108,7 @@ describe( 'RenameOperation', () => {
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.RenameOperation',
+				__className: 'RenameOperation',
 				baseVersion: 0,
 				baseVersion: 0,
 				position: op.position.toJSON(),
 				position: op.position.toJSON(),
 				newName: 'newName',
 				newName: 'newName',

+ 2 - 2
packages/ckeditor5-engine/tests/model/operation/rootattributeoperation.js

@@ -269,9 +269,9 @@ describe( 'RootAttributeOperation', () => {
 
 
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
-			expect( serialized.__className ).to.equal( 'engine.model.operation.RootAttributeOperation' );
+			expect( serialized.__className ).to.equal( 'RootAttributeOperation' );
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.RootAttributeOperation',
+				__className: 'RootAttributeOperation',
 				baseVersion: 0,
 				baseVersion: 0,
 				key: 'key',
 				key: 'key',
 				newValue: 'newValue',
 				newValue: 'newValue',

+ 2 - 2
packages/ckeditor5-engine/tests/model/operation/wrapoperation.js

@@ -42,7 +42,7 @@ describe( 'WrapOperation', () => {
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.WrapOperation',
+				__className: 'WrapOperation',
 				baseVersion: 0,
 				baseVersion: 0,
 				position: op.position.toJSON(),
 				position: op.position.toJSON(),
 				graveyardPosition: op.graveyardPosition.toJSON(),
 				graveyardPosition: op.graveyardPosition.toJSON(),
@@ -61,7 +61,7 @@ describe( 'WrapOperation', () => {
 			const serialized = op.toJSON();
 			const serialized = op.toJSON();
 
 
 			expect( serialized ).to.deep.equal( {
 			expect( serialized ).to.deep.equal( {
-				__className: 'engine.model.operation.WrapOperation',
+				__className: 'WrapOperation',
 				baseVersion: 0,
 				baseVersion: 0,
 				position: op.position.toJSON(),
 				position: op.position.toJSON(),
 				element: op.element.toJSON(),
 				element: op.element.toJSON(),

+ 481 - 0
packages/ckeditor5-engine/tests/view/upcastwriter.js

@@ -0,0 +1,481 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+import Element from '../../src/view/element';
+import UpcastWriter from '../../src/view/upcastwriter';
+import HtmlDataProcessor from '../../src/dataprocessor/htmldataprocessor';
+
+describe( 'UpcastWriter', () => {
+	let writer, view, dataprocessor;
+
+	before( () => {
+		writer = new UpcastWriter();
+		dataprocessor = new HtmlDataProcessor();
+	} );
+
+	beforeEach( () => {
+		const html = '' +
+			'<h1 style="color:blue;position:fixed;">Heading <strong>1</strong></h1>' +
+			'<p class="foo1 bar2" style="text-align:left;" data-attr="abc">Foo <i>Bar</i> <strong>Bold</strong></p>' +
+			'<p><u>Some underlined</u> text</p>' +
+			'<ul>' +
+			'<li class="single">Item 1</li>' +
+			'<li><span>Item <s>1</s></span></li>' +
+			'<li><h2>Item 1</h2></li>' +
+			'</ul>';
+
+		view = dataprocessor.toView( html );
+	} );
+
+	describe( 'clone', () => {
+		it( 'should clone simple element', () => {
+			const el = view.getChild( 0 );
+			const clone = writer.clone( el );
+
+			expect( clone ).to.not.equal( el );
+			expect( clone.isSimilar( el ) ).to.true;
+			expect( clone.childCount ).to.equal( 0 );
+		} );
+
+		it( 'should clone element with all attributes', () => {
+			const el = view.getChild( 1 );
+			const clone = writer.clone( el );
+
+			expect( clone ).to.not.equal( el );
+			expect( clone.isSimilar( el ) ).to.true;
+			expect( clone.childCount ).to.equal( 0 );
+		} );
+
+		it( 'should deep clone element', () => {
+			const el = view.getChild( 0 );
+			const clone = writer.clone( el, true );
+
+			expect( clone ).to.not.equal( el );
+			expect( clone.isSimilar( el ) ).to.true;
+			expect( clone.childCount ).to.equal( el.childCount );
+		} );
+	} );
+
+	describe( 'appendChild', () => {
+		it( 'should append inline child to paragraph', () => {
+			const el = view.getChild( 2 );
+			const newChild = new Element( 'span' );
+
+			const appended = writer.appendChild( newChild, el );
+
+			expect( appended ).to.equal( 1 );
+			expect( newChild.parent ).to.equal( el );
+			expect( el.childCount ).to.equal( 3 );
+		} );
+
+		it( 'should append block children to paragraph', () => {
+			const el = view.getChild( 2 );
+			const newChild1 = new Element( 'p' );
+			const newChild2 = new Element( 'h2' );
+
+			const appended = writer.appendChild( [ newChild1, newChild2 ], el );
+
+			expect( appended ).to.equal( 2 );
+			expect( newChild1.parent ).to.equal( el );
+			expect( newChild2.parent ).to.equal( el );
+			expect( el.childCount ).to.equal( 4 );
+		} );
+
+		it( 'should append list item to the list', () => {
+			const el = view.getChild( 3 );
+			const newChild = new Element( 'li' );
+
+			const appended = writer.appendChild( newChild, el );
+
+			expect( appended ).to.equal( 1 );
+			expect( newChild.parent ).to.equal( el );
+			expect( el.childCount ).to.equal( 4 );
+		} );
+
+		it( 'should append element to DocumentFragment element', () => {
+			const newChild = new Element( 'p' );
+
+			const appended = writer.appendChild( newChild, view );
+
+			expect( appended ).to.equal( 1 );
+			expect( newChild.parent ).to.equal( view );
+			expect( view.childCount ).to.equal( 5 );
+		} );
+	} );
+
+	describe( 'insertChild', () => {
+		it( 'should insert inline child into the paragraph on the first position', () => {
+			const el = view.getChild( 2 );
+			const newChild = new Element( 'span' );
+
+			const inserted = writer.insertChild( 0, newChild, el );
+
+			expect( inserted ).to.equal( 1 );
+			expect( newChild.parent ).to.equal( el );
+			expect( el.getChild( 0 ) ).to.equal( newChild );
+			expect( el.childCount ).to.equal( 3 );
+		} );
+
+		it( 'should insert block children into the paragraph on the last position', () => {
+			const el = view.getChild( 2 );
+			const newChild1 = new Element( 'blockquote' );
+			const newChild2 = new Element( 'h2' );
+
+			const inserted = writer.insertChild( 2, [ newChild1, newChild2 ], el );
+
+			expect( inserted ).to.equal( 2 );
+			expect( newChild1.parent ).to.equal( el );
+			expect( newChild2.parent ).to.equal( el );
+			expect( el.getChild( 2 ) ).to.equal( newChild1 );
+			expect( el.getChild( 3 ) ).to.equal( newChild2 );
+			expect( el.childCount ).to.equal( 4 );
+		} );
+
+		it( 'should insert list item into the list element', () => {
+			const el = view.getChild( 3 );
+			const newChild = new Element( 'li' );
+
+			const inserted = writer.insertChild( 1, newChild, el );
+
+			expect( inserted ).to.equal( 1 );
+			expect( newChild.parent ).to.equal( el );
+			expect( el.getChild( 1 ) ).to.equal( newChild );
+			expect( el.childCount ).to.equal( 4 );
+		} );
+
+		it( 'should insert element to DocumentFragment element', () => {
+			const newChild = new Element( 'p' );
+
+			const inserted = writer.insertChild( 4, newChild, view );
+
+			expect( inserted ).to.equal( 1 );
+			expect( newChild.parent ).to.equal( view );
+			expect( view.getChild( 4 ) ).to.equal( newChild );
+			expect( view.childCount ).to.equal( 5 );
+		} );
+	} );
+
+	describe( 'removeChildren', () => {
+		it( 'should remove child from the beginning of the paragraph', () => {
+			const el = view.getChild( 1 );
+			const toRemove = el.getChild( 0 );
+
+			const removed = writer.removeChildren( 0, 1, el );
+
+			expect( removed.length ).to.equal( 1 );
+			expect( removed[ 0 ] ).to.equal( toRemove );
+			expect( el.childCount ).to.equal( 3 );
+		} );
+
+		it( 'should remove two last list items from the list element', () => {
+			const el = view.getChild( 3 );
+			const toRemove1 = el.getChild( 1 );
+			const toRemove2 = el.getChild( 2 );
+
+			const removed = writer.removeChildren( 1, 2, el );
+
+			expect( removed.length ).to.equal( 2 );
+			expect( removed[ 0 ] ).to.equal( toRemove1 );
+			expect( removed[ 1 ] ).to.equal( toRemove2 );
+			expect( el.childCount ).to.equal( 1 );
+		} );
+
+		it( 'should remove child from DocumentFragment element', () => {
+			const toRemove = view.getChild( 2 );
+
+			const removed = writer.removeChildren( 2, 1, view );
+
+			expect( removed.length ).to.equal( 1 );
+			expect( removed[ 0 ] ).to.equal( toRemove );
+			expect( view.childCount ).to.equal( 3 );
+		} );
+	} );
+
+	describe( 'remove', () => {
+		it( 'should remove list item from the list element', () => {
+			const toRemove = view.getChild( 3 ).getChild( 1 );
+
+			const removed = writer.remove( toRemove );
+
+			expect( removed.length ).to.equal( 1 );
+			expect( removed[ 0 ] ).to.equal( toRemove );
+			expect( view.getChild( 3 ).childCount ).to.equal( 2 );
+		} );
+
+		it( 'should have no effect on detached elements', () => {
+			const newChild = new Element( 'h2' );
+
+			const removed = writer.remove( newChild );
+
+			expect( removed.length ).to.equal( 0 );
+			expect( view.childCount ).to.equal( 4 );
+		} );
+
+		it( 'should remove direct root (DocumentFragment) child', () => {
+			const toRemove = view.getChild( 3 );
+
+			const removed = writer.remove( toRemove );
+
+			expect( removed.length ).to.equal( 1 );
+			expect( removed[ 0 ] ).to.equal( toRemove );
+			expect( view.childCount ).to.equal( 3 );
+		} );
+	} );
+
+	describe( 'replace', () => {
+		it( 'should replace single element', () => {
+			const el = view.getChild( 0 ).getChild( 1 );
+			const newChild = new Element( 'span' );
+
+			const replacement = writer.replace( el, newChild );
+
+			expect( replacement ).to.true;
+			expect( view.getChild( 0 ).getChild( 1 ) ).to.equal( newChild );
+			expect( view.getChild( 0 ).childCount ).to.equal( 2 );
+		} );
+
+		it( 'should replace element with children', () => {
+			const el = view.getChild( 3 );
+			const newChild = new Element( 'ol' );
+
+			const replacement = writer.replace( el, newChild );
+
+			expect( replacement ).to.true;
+			expect( view.getChild( 3 ) ).to.equal( newChild );
+			expect( view.childCount ).to.equal( 4 );
+		} );
+
+		it( 'should have no effect on detached elements', () => {
+			const oldChild = new Element( 'h2' );
+			const newChild = new Element( 'h2' );
+
+			const replacement = writer.replace( oldChild, newChild );
+
+			expect( replacement ).to.false;
+			expect( view.childCount ).to.equal( 4 );
+		} );
+	} );
+
+	describe( 'rename', () => {
+		it( 'should rename simple element', () => {
+			const el = view.getChild( 0 ).getChild( 1 );
+
+			const renamed = writer.rename( 'i', el );
+
+			expect( renamed ).to.not.equal( el );
+			expect( renamed ).to.equal( view.getChild( 0 ).getChild( 1 ) );
+			expect( renamed.name ).to.equal( 'i' );
+			expect( view.getChild( 0 ).childCount ).to.equal( 2 );
+		} );
+
+		it( 'should rename direct root (DocumentFragment) child element', () => {
+			const el = view.getChild( 1 );
+
+			const renamed = writer.rename( 'h3', el );
+
+			expect( renamed ).to.not.equal( el );
+			expect( renamed ).to.equal( view.getChild( 1 ) );
+			expect( renamed.name ).to.equal( 'h3' );
+			expect( view.childCount ).to.equal( 4 );
+		} );
+
+		it( 'should have no effect on detached element', () => {
+			const el = new Element( 'h2' );
+
+			const renamed = writer.rename( 'h3', el );
+
+			expect( renamed ).to.null;
+			expect( view.childCount ).to.equal( 4 );
+		} );
+	} );
+
+	describe( 'setAttribute', () => {
+		it( 'should add new attribute', () => {
+			const el = view.getChild( 0 );
+
+			writer.setAttribute( 'testAttr', 'testVal', el );
+
+			expect( el.getAttribute( 'testAttr' ) ).to.equal( 'testVal' );
+		} );
+
+		it( 'should update existing attribute', () => {
+			const el = view.getChild( 1 );
+
+			writer.setAttribute( 'data-attr', 'foo', el );
+
+			expect( el.getAttribute( 'data-attr' ) ).to.equal( 'foo' );
+		} );
+	} );
+
+	describe( 'removeAttribute', () => {
+		it( 'should remove existing attribute', () => {
+			const el = view.getChild( 1 );
+
+			writer.removeAttribute( 'data-attr', el );
+
+			expect( el.hasAttribute( 'data-attr' ) ).to.false;
+		} );
+
+		it( 'should have no effect if attribute does not exists', () => {
+			const el = view.getChild( 0 );
+
+			writer.removeAttribute( 'non-existent', el );
+
+			expect( el.hasAttribute( 'non-existent' ) ).to.false;
+		} );
+	} );
+
+	describe( 'addClass', () => {
+		it( 'should add new classes if no classes', () => {
+			const el = view.getChild( 2 );
+
+			writer.addClass( [ 'foo', 'bar' ], el );
+
+			expect( el.hasClass( 'foo' ) ).to.true;
+			expect( el.hasClass( 'bar' ) ).to.true;
+			expect( Array.from( el.getClassNames() ).length ).to.equal( 2 );
+		} );
+
+		it( 'should add new class to existing classes', () => {
+			const el = view.getChild( 1 );
+
+			writer.addClass( 'newClass', el );
+
+			expect( el.hasClass( 'newClass' ) ).to.true;
+			expect( Array.from( el.getClassNames() ).length ).to.equal( 3 );
+		} );
+	} );
+
+	describe( 'removeClass', () => {
+		it( 'should remove existing class', () => {
+			const el = view.getChild( 3 ).getChild( 0 );
+
+			writer.removeClass( 'single', el );
+
+			expect( el.hasClass( 'single' ) ).to.false;
+			expect( Array.from( el.getClassNames() ).length ).to.equal( 0 );
+		} );
+
+		it( 'should remove existing class from many classes', () => {
+			const el = view.getChild( 1 );
+
+			writer.removeClass( 'foo1', el );
+
+			expect( el.hasClass( 'foo1' ) ).to.false;
+			expect( el.hasClass( 'bar2' ) ).to.true;
+			expect( Array.from( el.getClassNames() ).length ).to.equal( 1 );
+		} );
+
+		it( 'should have no effect if there are no classes', () => {
+			const el = view.getChild( 0 );
+
+			writer.removeClass( 'non-existent', el );
+
+			expect( el.hasClass( 'non-existent' ) ).to.false;
+			expect( Array.from( el.getClassNames() ).length ).to.equal( 0 );
+		} );
+	} );
+
+	describe( 'setStyle', () => {
+		it( 'should add new style', () => {
+			const el = view.getChild( 2 );
+
+			writer.setStyle( {
+				color: 'red',
+				position: 'fixed'
+			}, el );
+
+			expect( el.getStyle( 'color' ) ).to.equal( 'red' );
+			expect( el.getStyle( 'position' ) ).to.equal( 'fixed' );
+			expect( Array.from( el.getStyleNames() ).length ).to.equal( 2 );
+		} );
+
+		it( 'should update existing styles', () => {
+			const el = view.getChild( 1 );
+
+			writer.setStyle( 'text-align', 'center', el );
+
+			expect( el.getStyle( 'text-align' ) ).to.equal( 'center' );
+			expect( Array.from( el.getStyleNames() ).length ).to.equal( 1 );
+		} );
+	} );
+
+	describe( 'removeStyle', () => {
+		it( 'should remove existing style', () => {
+			const el = view.getChild( 0 );
+
+			writer.removeStyle( [ 'color', 'position' ], el );
+
+			expect( el.hasStyle( 'color' ) ).to.false;
+			expect( el.hasStyle( 'position' ) ).to.false;
+			expect( Array.from( el.getStyleNames() ).length ).to.equal( 0 );
+		} );
+
+		it( 'should remove value from existing styles', () => {
+			const el = view.getChild( 0 );
+
+			writer.removeStyle( 'position', el );
+
+			expect( el.hasStyle( 'color' ) ).to.true;
+			expect( el.hasStyle( 'position' ) ).to.false;
+			expect( Array.from( el.getStyleNames() ).length ).to.equal( 1 );
+		} );
+
+		it( 'should have no effect if styles does not exists', () => {
+			const el = view.getChild( 2 );
+
+			writer.removeStyle( [ 'color', 'position' ], el );
+
+			expect( el.hasStyle( 'color' ) ).to.false;
+			expect( el.hasStyle( 'position' ) ).to.false;
+			expect( Array.from( el.getStyleNames() ).length ).to.equal( 0 );
+		} );
+	} );
+
+	describe( 'setCustomProperty', () => {
+		it( 'should add or update custom property', () => {
+			const el = new Element( 'span' );
+
+			writer.setCustomProperty( 'prop1', 'foo', el );
+			writer.setCustomProperty( 'prop2', 'bar', el );
+
+			expect( el.getCustomProperty( 'prop1' ) ).to.equal( 'foo' );
+			expect( el.getCustomProperty( 'prop2' ) ).to.equal( 'bar' );
+			expect( Array.from( el.getCustomProperties() ).length ).to.equal( 2 );
+
+			const objectProperty = { foo: 'bar' };
+			writer.setCustomProperty( 'prop2', objectProperty, el );
+
+			expect( el.getCustomProperty( 'prop1' ) ).to.equal( 'foo' );
+			expect( el.getCustomProperty( 'prop2' ) ).to.equal( objectProperty );
+			expect( Array.from( el.getCustomProperties() ).length ).to.equal( 2 );
+		} );
+	} );
+
+	describe( 'removeCustomProperty', () => {
+		it( 'should remove existing custom property', () => {
+			const el = new Element( 'p' );
+
+			writer.setCustomProperty( 'prop1', 'foo', el );
+
+			expect( el.getCustomProperty( 'prop1' ) ).to.equal( 'foo' );
+			expect( Array.from( el.getCustomProperties() ).length ).to.equal( 1 );
+
+			writer.removeCustomProperty( 'prop1', el );
+
+			expect( el.getCustomProperty( 'prop1' ) ).to.undefined;
+			expect( Array.from( el.getCustomProperties() ).length ).to.equal( 0 );
+		} );
+
+		it( 'should have no effect if custom property does not exists', () => {
+			const el = new Element( 'h1' );
+
+			writer.removeCustomProperty( 'prop1', el );
+
+			expect( el.getCustomProperty( 'prop1' ) ).to.undefined;
+			expect( Array.from( el.getCustomProperties() ).length ).to.equal( 0 );
+		} );
+	} );
+} );