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

fixes to the return types of several Node helper extension methods #121

Merged
merged 4 commits into from
Dec 7, 2023

Conversation

devoncarew
Copy link
Member

  • fixes to the return types of several Node helper extension methods

When trying to port DartPad to package:web, I noticed that the Node.clone() extension method had a return type of void, which made it hard to use. This PR updates clone and append to have the same signatures as they have in dart:html.

As an aside, when using code completion for a Node element, I see completions for both append and appendChild, and clone and cloneNode. Two are from extension methods and two are generated. It's not clear to me as a user which methods I should be using, what the differences are, or why there are multiple options. Perhaps we should plan to deprecate the extension methods which are just there to ease porting from dart:html? Where there are trivially the same generated methods available, and the extension methods don't add any usability improvements?


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@srujzs
Copy link
Contributor

srujzs commented Dec 7, 2023

Perhaps we should plan to deprecate the extension methods which are just there to ease porting from dart:html? Where there are trivially the same generated methods available, and the extension methods don't add any usability improvements?

cc @sigmundch

I agree! I think while this might make migration slightly easier, it'll complicate how users use these types. These members are simple enough as well that we can remove them. If you want to remove them in this PR, that's fine by me.

lib/src/helpers/extensions.dart Outdated Show resolved Hide resolved
@devoncarew
Copy link
Member Author

If you want to remove them in this PR, that's fine by me.

For this PR, I just deprecated them; that'll let us remove them in a future major release.

@srujzs
Copy link
Contributor

srujzs commented Dec 7, 2023

Sounds good, thanks Devon!

@devoncarew devoncarew merged commit acf0beb into main Dec 7, 2023
11 checks passed
@devoncarew devoncarew deleted the NodeGlue_fixes branch December 7, 2023 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants