-
Notifications
You must be signed in to change notification settings - Fork 6
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
Update for insertBefore API change as per RFC287 #7
Conversation
3e5cb7c
to
d79504e
Compare
@simonihmig - Have you considered using a helper instead of a component? I think it has the right semantics... I made a demo Code Sandbox with some basic tests here. import { helper } from "@ember/component/helper";
export default helper(function clearElement([element] /*, hash*/) {
while (element.firstChild) {
element.removeChild(element.firstChild);
}
return element;
}); |
Yes, indeed I thought a while about it, but chose to use a component as I was not so sure if a helper would be the right abstraction here. Specifically, as it has no rendering related lifecycle hooks, I was not sure if it was safe to assume when it will run related to
Ah, that looks really nice! What I specifically like here, being related to what I said above, is that by calling the helper as the target argument for Will refactor my implementation later, thanks a bunch! 🙏 |
No problem! Was fun to hack on 😃. |
Right, the thing about my implementation in the demo is that the private |
* enforces `insertBefore=null` as only allowed value * Adds implementation for default replace semantics *This is a breaking change!*
d79504e
to
9aeec71
Compare
@rwjblue updated the PR with your helper approach. Ready for another review, if you have the time! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
insertBefore=null
as only allowed valueThis is a breaking change!
Closes #5
To Do:
-in-element-replace
component from the build for Ember versions with publicin-element
support