@@ -294,30 +294,23 @@ export default class Renderer {
294294 * @param {Node } domElement The DOM element representing the given view element.
295295 */
296296 _updateElementMappings ( viewElement , domElement ) {
297- // Because we replace new view element mapping with the existing one, the corresponding DOM element
298- // will not be rerendered. The new view element may have different attributes than the previous one.
299- // Since its corresponding DOM element will not be rerendered, new attributes will not be added
300- // to the DOM, so we need to mark it here to make sure its attributes gets updated.
301- // Such situations may happen if only new view element was added to `this.markedAttributes`
302- // or none of the elements were added (relying on 'this._updateChildren()' which by rerendering the element
303- // also rerenders its attributes). See #1427 for more detailed case study.
304- const newViewChild = this . domConverter . mapDomToView ( domElement ) ;
305-
306- // It may also happen that 'newViewChild' mapping is not present since its parent mapping
307- // was already removed (the 'domConverter.unbindDomElement()' method also unbinds children
308- // mappings) so we also check for '!newViewChild'.
309- // Also check if new element ('newViewChild') was marked to have its attributes rerenderd,
310- // if so, marked reused view element too (#1560).
311- if ( ! newViewChild || newViewChild && ! newViewChild . isSimilar ( viewElement ) || this . markedAttributes . has ( newViewChild ) ) {
312- this . markedAttributes . add ( viewElement ) ;
313- }
314-
315297 // Remap 'DomConverter' bindings.
316298 this . domConverter . unbindDomElement ( domElement ) ;
317299 this . domConverter . bindElements ( domElement , viewElement ) ;
318300
319301 // View element may have children which needs to be updated, but are not marked, mark them to update.
320302 this . markedChildren . add ( viewElement ) ;
303+
304+ // Because we replace new view element mapping with the existing one, the corresponding DOM element
305+ // will not be rerendered. The new view element may have different attributes than the previous one.
306+ // Since its corresponding DOM element will not be rerendered, new attributes will not be added
307+ // to the DOM, so we need to mark it here to make sure its attributes gets updated. See #1427 for more
308+ // detailed case study.
309+ // Also there are cases where replaced element is removed from the view structure and then has
310+ // its attributes changed or removed. In such cases the element will not be present in `markedAttributes`
311+ // and also may be the same (`element.isSimilar()`) as the reused element not having its attributes updated.
312+ // To prevent such situations we always mark reused element to have its attributes rerenderd (#1560).
313+ this . markedAttributes . add ( viewElement ) ;
321314 }
322315
323316 /**
0 commit comments