aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/anki-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-10-07 21:23:42 -0400
committerGitHub <noreply@github.com>2020-10-07 21:23:42 -0400
commit05e51a950e3fb7da3f9a252a742c068a9daad6b2 (patch)
tree0649a711633648c379adb79ca4b8344d8da001d7 /ext/bg/js/settings/anki-controller.js
parentcb1902eaddeb092bf1e3d78f9e601109bd32202c (diff)
Settings templates refactor (#897)
* Add template instantiation API to SettingsController * Use SettingsController.instantiateTemplate
Diffstat (limited to 'ext/bg/js/settings/anki-controller.js')
-rw-r--r--ext/bg/js/settings/anki-controller.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/ext/bg/js/settings/anki-controller.js b/ext/bg/js/settings/anki-controller.js
index 526ddfb2..373e4d43 100644
--- a/ext/bg/js/settings/anki-controller.js
+++ b/ext/bg/js/settings/anki-controller.js
@@ -90,10 +90,9 @@ class AnkiController {
}
getFieldMarkersHtml(markers) {
- const template = document.querySelector('#anki-field-marker-template').content;
const fragment = document.createDocumentFragment();
for (const marker of markers) {
- const markerNode = document.importNode(template, true).firstChild;
+ const markerNode = this._settingsController.instantiateTemplate('anki-field-marker');
markerNode.querySelector('.marker-link').textContent = marker;
fragment.appendChild(markerNode);
}
@@ -221,8 +220,7 @@ class AnkiController {
}
_createFieldTemplate(name, value, markers) {
- const template = document.querySelector('#anki-field-template').content;
- const content = document.importNode(template, true).firstChild;
+ const content = this._settingsController.instantiateTemplate('anki-field');
content.querySelector('.anki-field-name').textContent = name;