8
0
Просмотр исходного кода

Other: Remove if from _normalizeModelAttributeConfig().

Maciej Gołaszewski 7 лет назад
Родитель
Сommit
847a69e3ad
1 измененных файлов с 2 добавлено и 6 удалено
  1. 2 6
      packages/ckeditor5-engine/src/conversion/upcast-converters.js

+ 2 - 6
packages/ckeditor5-engine/src/conversion/upcast-converters.js

@@ -424,17 +424,13 @@ function _normalizeViewAttributeKeyValueConfig( config ) {
 // `config.model` is an `Object` with `key` and `value` properties.
 //
 // @param {Object} config Conversion config.
-// @param {String} viewAttributeKeyToCopy Key of the  converted view attribute. If it is set, model attribute value
+// @param {String} viewAttributeKeyToCopy Key of the converted view attribute. If it is set, model attribute value
 // will be equal to view attribute value.
 function _normalizeModelAttributeConfig( config, viewAttributeKeyToCopy = null ) {
 	const defaultModelValue = viewAttributeKeyToCopy === null ? true : viewElement => viewElement.getAttribute( viewAttributeKeyToCopy );
 
 	const key = typeof config.model != 'object' ? config.model : config.model.key;
-	let value = typeof config.model != 'object' ? defaultModelValue : config.model.value;
-
-	if ( typeof value == 'undefined' ) {
-		value = defaultModelValue;
-	}
+	const value = typeof config.model != 'object' || typeof config.model.value == 'undefined' ? defaultModelValue : config.model.value;
 
 	config.model = { key, value };
 }