css.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { type Element, type AnyNode } from 'domhandler';
  2. import type { Cheerio } from '../cheerio.js';
  3. /**
  4. * Get the value of a style property for the first element in the set of matched
  5. * elements.
  6. *
  7. * @category CSS
  8. * @param names - Optionally the names of the properties of interest.
  9. * @returns A map of all of the style properties.
  10. * @see {@link https://api.jquery.com/css/}
  11. */
  12. export declare function css<T extends AnyNode>(this: Cheerio<T>, names?: string[]): Record<string, string> | undefined;
  13. /**
  14. * Get the value of a style property for the first element in the set of matched
  15. * elements.
  16. *
  17. * @category CSS
  18. * @param name - The name of the property.
  19. * @returns The property value for the given name.
  20. * @see {@link https://api.jquery.com/css/}
  21. */
  22. export declare function css<T extends AnyNode>(this: Cheerio<T>, name: string): string | undefined;
  23. /**
  24. * Set one CSS property for every matched element.
  25. *
  26. * @category CSS
  27. * @param prop - The name of the property.
  28. * @param val - The new value.
  29. * @returns The instance itself.
  30. * @see {@link https://api.jquery.com/css/}
  31. */
  32. export declare function css<T extends AnyNode>(this: Cheerio<T>, prop: string, val: string | ((this: Element, i: number, style: string) => string | undefined)): Cheerio<T>;
  33. /**
  34. * Set multiple CSS properties for every matched element.
  35. *
  36. * @category CSS
  37. * @param map - A map of property names and values.
  38. * @returns The instance itself.
  39. * @see {@link https://api.jquery.com/css/}
  40. */
  41. export declare function css<T extends AnyNode>(this: Cheerio<T>, map: Record<string, string>): Cheerio<T>;
  42. //# sourceMappingURL=css.d.ts.map