decoration-style.ts 515 B

123456789101112131415161718192021
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. function createStyleElement(
  6. styleId: string,
  7. container: HTMLElement = document.head,
  8. ): HTMLStyleElement {
  9. const style = document.createElement('style');
  10. style.id = styleId;
  11. style.type = 'text/css';
  12. style.media = 'screen';
  13. style.appendChild(document.createTextNode('')); // trick for webkit
  14. container.appendChild(style);
  15. return style;
  16. }
  17. export const DecorationStyle = {
  18. createStyleElement,
  19. };