Skip to content

Commit

Permalink
use guidFor to get edembedded component id
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Whitton committed Apr 14, 2017
1 parent fbe6f5a commit c6e2707
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/lib/alien-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ export function removeAlienListeners() {
// destination. This runs in the django-page model's separateScripts method as well
// as in the django-page component's didReceiveAttrs hook if an Alien DOM is present.
export function embeddedComponentSetup(root = document) {
Array.from(root.querySelectorAll('[data-ember-component]')).forEach(function (el, i) {
Array.from(root.querySelectorAll('[data-ember-component]')).forEach(function (el) {
// embedded ember components require an ID that is in sync with the
// django-page document
el.id = el.id || `ember-component-${i}`;
el.id = el.id || Ember.guidFor(el);
el.setAttribute('data-text-content', el.textContent.trim());
el.textContent = '';
});
Expand Down

0 comments on commit c6e2707

Please sign in to comment.