mercredi 1 février 2017

Set Attribute on SimpleDom element in Ember Fastboot

I want to set route class names on the body tag like described in this blog post: http://ift.tt/2jDxcex

But this time in Fastboot mode.

For this I started to write a fastboot initializer.

export function initialize(owner) {
  const document = owner.lookup('service:-document');

  // working fine
  const text = document.createTextNode('Hello World');
  document.body.appendChild(text);

  // not working (?)
  document.body.setAttribute('class', 'app');
}

export default {
  name: 'route-classes-fastboot',
  initialize
};

Adding a text node to the body tag is working fine. However adding any attribute does not seem to work.

Any idea how to solve this?




Aucun commentaire:

Enregistrer un commentaire