Skip to content

Commit a4a1d8f

Browse files
authored
Merge pull request #27 from cibernox/make-it-work-without-jquery
Make it work without jQuery
2 parents 69ff852 + 5cc77b1 commit a4a1d8f

2 files changed

Lines changed: 23 additions & 10 deletions

File tree

  • app-lt-2-10/instance-initializers
  • app/instance-initializers

app-lt-2-10/instance-initializers/head.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
import Ember from 'ember';
21
import ENV from '../config/environment';
32

43
export function initialize(instance) {
54
if (ENV['ember-cli-head'] && ENV['ember-cli-head']['suppressBrowserRender']) { return true; }
65

76
// clear fast booted head (if any)
8-
Ember.$('meta[name="ember-cli-head-start"]')
9-
.nextUntil('meta[name="ember-cli-head-end"] ~')
10-
.addBack()
11-
.remove();
7+
let startMeta = document.querySelector('meta[name="ember-cli-head-start"]')
8+
let endMeta = document.querySelector('meta[name="ember-cli-head-end"]')
9+
if (startMeta && startMeta) {
10+
let el = startMeta.nextSibling
11+
while(el && el !== endMeta) {
12+
document.head.removeChild(el);
13+
el = startMeta.nextSibling;
14+
}
15+
document.head.removeChild(startMeta);
16+
document.head.removeChild(endMeta);
17+
}
18+
1219
const container = instance.lookup ? instance : instance.container;
1320
// const renderer = container.lookup('renderer:-dom');
1421
const component = container.lookup('component:head-layout');

app/instance-initializers/head.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
import Ember from 'ember';
21
import ENV from '../config/environment';
32

43
export function initialize(owner) {
54
if (ENV['ember-cli-head'] && ENV['ember-cli-head']['suppressBrowserRender']) { return true; }
65

76
// clear fast booted head (if any)
8-
Ember.$('meta[name="ember-cli-head-start"]')
9-
.nextUntil('meta[name="ember-cli-head-end"] ~')
10-
.addBack()
11-
.remove();
7+
let startMeta = document.querySelector('meta[name="ember-cli-head-start"]')
8+
let endMeta = document.querySelector('meta[name="ember-cli-head-end"]')
9+
if (startMeta && endMeta) {
10+
let el = startMeta.nextSibling
11+
while(el && el !== endMeta) {
12+
document.head.removeChild(el);
13+
el = startMeta.nextSibling;
14+
}
15+
document.head.removeChild(startMeta);
16+
document.head.removeChild(endMeta);
17+
}
1218

1319
const component = owner.lookup('component:head-layout');
1420
component.appendTo(document.head);

0 commit comments

Comments
 (0)