版博士V2.0程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

CSSStyleSheet.d.ts 1.7 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import CSSRule from './CSSRule';
  2. import MediaList from './MediaList';
  3. /**
  4. * CSS StyleSheet.
  5. *
  6. * Reference:
  7. * https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet.
  8. */
  9. export default class CSSStyleSheet {
  10. value: string;
  11. name: string;
  12. namespaceURI: string;
  13. readonly cssRules: CSSRule[];
  14. media: MediaList | string;
  15. title: string;
  16. alternate: boolean;
  17. disabled: boolean;
  18. private _currentText;
  19. /**
  20. * Constructor.
  21. *
  22. * @param [options] Options.
  23. * @param [options.media] Media.
  24. * @param [options.title] Title.
  25. * @param [options.alternate] Alternate.
  26. * @param [options.disabled] Disabled.
  27. */
  28. constructor(options?: {
  29. media?: MediaList | string;
  30. title?: string;
  31. alternate?: boolean;
  32. disabled?: boolean;
  33. });
  34. /**
  35. * Inserts a rule.
  36. *
  37. * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule
  38. * @param rule Rule.
  39. * @param [index] Index.
  40. * @returns The newly inserterted rule's index.
  41. */
  42. insertRule(rule: string, index?: number): number;
  43. /**
  44. * Removes a rule.
  45. *
  46. * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/deleteRule
  47. * @param index Index.
  48. */
  49. deleteRule(index: number): void;
  50. /**
  51. * Replaces all CSS rules.
  52. *
  53. * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/replace
  54. * @param text CSS text.
  55. * @returns Promise.
  56. */
  57. replace(text: string): Promise<void>;
  58. /**
  59. * Replaces all CSS rules.
  60. *
  61. * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/replaceSync
  62. * @param text CSS text.
  63. */
  64. replaceSync(text: string): void;
  65. }