forms.d.ts 872 B

12345678910111213141516171819202122232425262728293031
  1. import type { Node } from 'domhandler';
  2. import type { Cheerio } from '../cheerio';
  3. /**
  4. * Encode a set of form elements as a string for submission.
  5. *
  6. * @category Forms
  7. * @returns The serialized form.
  8. * @see {@link https://api.jquery.com/serialize/}
  9. */
  10. export declare function serialize<T extends Node>(this: Cheerio<T>): string;
  11. interface SerializedField {
  12. name: string;
  13. value: string;
  14. }
  15. /**
  16. * Encode a set of form elements as an array of names and values.
  17. *
  18. * @category Forms
  19. * @example
  20. *
  21. * ```js
  22. * $('<form><input name="foo" value="bar" /></form>').serializeArray();
  23. * //=> [ { name: 'foo', value: 'bar' } ]
  24. * ```
  25. *
  26. * @returns The serialized form.
  27. * @see {@link https://api.jquery.com/serializeArray/}
  28. */
  29. export declare function serializeArray<T extends Node>(this: Cheerio<T>): SerializedField[];
  30. export {};
  31. //# sourceMappingURL=forms.d.ts.map