Skip to content

Commit 1334323

Browse files
committed
use native DOM instead of jQuery
1 parent e6e3c6b commit 1334323

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

app/components/crate-readme.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,12 @@ import Component from '@ember/component';
22

33
export default Component.extend({
44
rendered: '',
5+
56
didRender() {
67
this._super(...arguments);
7-
this.$('pre > code').each(function() {
8-
window.Prism.highlightElement(this);
9-
});
10-
this.scrollToFragment();
11-
},
128

13-
scrollToFragment() {
14-
if (location.hash) {
15-
let anchor_id = location.hash.substr(1);
16-
document.getElementById(anchor_id).scrollIntoView();
17-
}
9+
this.element.querySelectorAll('pre > code').forEach(function(node) {
10+
window.Prism.highlightElement(node);
11+
});
1812
},
1913
});

0 commit comments

Comments
 (0)