cleanup.js 579 B

12345678910111213141516171819
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /* global document */
  6. /**
  7. * Removes all the `.ck-body` elements available in the DOM.
  8. *
  9. * It is commonly used to cleanup after editors that test editor crashes.
  10. *
  11. * See https://github.com/ckeditor/ckeditor5/issues/6018 for more details.
  12. */
  13. export function removeEditorBodyOrphans() {
  14. for ( const bodyOrphan of document.querySelectorAll( '.ck-body-wrapper' ) ) {
  15. bodyOrphan.remove();
  16. }
  17. }