Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Have load export a function #1869

Merged
merged 11 commits into from
May 17, 2021
Merged

refactor: Have load export a function #1869

merged 11 commits into from
May 17, 2021

Conversation

fb55
Copy link
Member

@fb55 fb55 commented May 14, 2021

This removes quite a few currently necessary hacks.

BREAKING CHANGES

Low potential for breakages:

  • Removed the internal _originalRoot property. Some methods, such as appendTo, can now have their roots overwritten by passing the root property to CheerioAPI.
  • The default export now has a surrounding Document, without any contents.

fb55 and others added 11 commits May 7, 2021 16:58
No need to have this in the main class
We are calling the constructor, which will always retain the original root.
We maintain compatibility for now by exporting a sensible default.
Separates Cheerio and CheerioAPI as different concepts.

We no longer have to fight the type system to allow us to call the constructor without `new`.
Co-Authored-By: 5saviahv <49443574+5saviahv@users.noreply.github.com>
@fb55 fb55 changed the title Have load export a function instead of the constructor refactor: Have load export a function May 17, 2021
@fb55 fb55 merged commit c370f4e into main May 17, 2021
@fb55 fb55 deleted the feat/fn branch May 17, 2021 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant