Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Move logic in custom element initialization #744

Merged
merged 5 commits into from
Nov 7, 2017

Conversation

maier49
Copy link
Contributor

@maier49 maier49 commented Nov 3, 2017

Type: feature

The following has been addressed in the PR:

  • There is a related issue
  • All code matches the style guide
  • Unit or Functional tests are included in the PR

Description:
If I'm understanding the code correctly, the widget won't render until it's attached to the projector. That happens here, in the callback that gets called when the custom element is attached to the DOM. So until that point we don't need to worry about a MutationObserver, because we can just capture the state of the element when it's attached and set the appropriate children at that time. This has the added benefit of letting things like replaceChild and insertBefore work as expected, without a lot of additional logic.

If we want to be able to add children after the element is attached then we will probably need to track the elements we've seen and use a MutationObserver to detect new children and create widgets for them. That should probably be a separate PR though.

Resolves #531

Copy link
Member

@kitsonk kitsonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but as requested @matt-gadd should review as well.

@agubler
Copy link
Member

agubler commented Nov 6, 2017

Looks like the custom element functional tests are failing on CI.

@maier49 maier49 merged commit d5f224b into dojo:master Nov 7, 2017
@maier49 maier49 deleted the 531-add-children-to-custom-element branch November 7, 2017 16:08
@dylans dylans added this to the beta.4 milestone Jan 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants