Skip to content

Commit

Permalink
Merge pull request #17489 from ckeditor/ck/17488
Browse files Browse the repository at this point in the history
Fix (engine): List markers should be visible after changing the list type from multi-level to numbered. Closes #17488.
  • Loading branch information
niegowski authored Nov 19, 2024
2 parents 31ed45a + 94a2e14 commit e1e85cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/ckeditor5-engine/src/view/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ export default class Renderer extends /* #__PURE__ */ ObservableMixin() {
// Note: It is important to first remove DOM attributes and then set new ones, because some view attributes may be renamed
// as they are set on DOM (due to unsafe attributes handling). If we set the view attribute first, and then remove
// non-existing DOM attributes, then we would remove the attribute that we just set.
for ( const domAttr of ( domElement as DomElement ).attributes ) {
//
// Note: The domElement.attributes is a live collection, so we need to convert it to an array to avoid issues.
for ( const domAttr of Array.from( ( domElement as DomElement ).attributes ) ) {
const key = domAttr.name;

// All other attributes not present in the DOM should be removed.
Expand Down
13 changes: 13 additions & 0 deletions packages/ckeditor5-engine/tests/view/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ describe( 'Renderer', () => {
expect( renderer.markedAttributes.size ).to.equal( 0 );
} );

it( 'should remove all attributes', () => {
domRoot.setAttribute( 'style', 'border:1px solid red' );
domRoot.setAttribute( 'class', 'bar' );

renderer.markToSync( 'attributes', viewRoot );
renderer.render();

expect( domRoot.getAttribute( 'class' ) ).to.be.not.ok;
expect( domRoot.getAttribute( 'style' ) ).to.be.not.ok;

expect( renderer.markedAttributes.size ).to.equal( 0 );
} );

it( 'should add children', () => {
viewRoot._appendChild( new ViewText( viewDocument, 'foo' ) );

Expand Down

0 comments on commit e1e85cb

Please sign in to comment.