css.d.ts 1.6 KB

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