Browse Source

Removed unnecessary node presence checks from Template#apply and Template#revert.

Aleksander Nowodzinski 8 years ago
parent
commit
1963343bb4
2 changed files with 0 additions and 34 deletions
  1. 0 18
      packages/ckeditor5-ui/src/template.js
  2. 0 16
      packages/ckeditor5-ui/tests/template.js

+ 0 - 18
packages/ckeditor5-ui/src/template.js

@@ -168,15 +168,6 @@ export default class Template {
 	 * @param {Node} node Root node for the template to apply.
 	 */
 	apply( node ) {
-		if ( !node ) {
-			/**
-			 * No DOM Node specified.
-			 *
-			 * @error ui-template-wrong-syntax
-			 */
-			throw new CKEditorError( 'ui-template-wrong-node: No DOM Node specified.' );
-		}
-
 		this._revertData = getEmptyRevertData();
 
 		this._renderNode( {
@@ -195,15 +186,6 @@ export default class Template {
 	 * that {@link module:ui/template~Template#apply} has used.
 	 */
 	revert( node ) {
-		if ( !node ) {
-			/**
-			 * No DOM Node specified.
-			 *
-			 * @error ui-template-wrong-syntax
-			 */
-			throw new CKEditorError( 'ui-template-wrong-node: No DOM Node specified.' );
-		}
-
 		if ( !this._revertData ) {
 			/**
 			 * Attempting reverting a template which has not been applied yet.

+ 0 - 16
packages/ckeditor5-ui/tests/template.js

@@ -649,14 +649,6 @@ describe( 'Template', () => {
 			} ).to.throw( CKEditorError, /ui-template-wrong-syntax/ );
 		} );
 
-		it( 'throws when no HTMLElement passed', () => {
-			expect( () => {
-				new Template( {
-					tag: 'p'
-				} ).apply();
-			} ).to.throw( CKEditorError, /ui-template-wrong-node/ );
-		} );
-
 		it( 'accepts empty template definition', () => {
 			new Template( {} ).apply( el );
 			new Template( {} ).apply( text );
@@ -1035,14 +1027,6 @@ describe( 'Template', () => {
 			bind = Template.bind( observable, domEmitter );
 		} );
 
-		it( 'throws when no HTMLElement passed', () => {
-			expect( () => {
-				new Template( {
-					tag: 'p'
-				} ).revert();
-			} ).to.throw( CKEditorError, /ui-template-wrong-node/ );
-		} );
-
 		it( 'should throw if template is not applied', () => {
 			const tpl = new Template( {
 				tag: 'div'