aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/profile-conditions-ui.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/profile-conditions-ui.js
parentcb1902eaddeb092bf1e3d78f9e601109bd32202c (diff)
Settings templates refactor (#897)
* Add template instantiation API to SettingsController * Use SettingsController.instantiateTemplate
Diffstat (limited to 'ext/bg/js/settings/profile-conditions-ui.js')
-rw-r--r--ext/bg/js/settings/profile-conditions-ui.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/ext/bg/js/settings/profile-conditions-ui.js b/ext/bg/js/settings/profile-conditions-ui.js
index 419c35b3..9438a0ec 100644
--- a/ext/bg/js/settings/profile-conditions-ui.js
+++ b/ext/bg/js/settings/profile-conditions-ui.js
@@ -110,10 +110,8 @@ class ProfileConditionsUI {
this._addConditionGroupButton = null;
}
- instantiateTemplate(templateSelector) {
- const template = document.querySelector(templateSelector);
- const content = document.importNode(template.content, true);
- return content.firstChild;
+ instantiateTemplate(names) {
+ return this._settingsController.instantiateTemplate(names);
}
getDescriptorTypes() {
@@ -303,7 +301,7 @@ class ProfileConditionGroupUI {
}
prepare(conditionGroup) {
- this._node = this._parent.instantiateTemplate('#condition-group-template');
+ this._node = this._parent.instantiateTemplate('condition-group');
this._conditionContainer = this._node.querySelector('.condition-list');
this._addConditionButton = this._node.querySelector('.condition-add');
@@ -434,7 +432,7 @@ class ProfileConditionUI {
prepare(condition) {
const {type, operator, value} = condition;
- this._node = this._parent.parent.instantiateTemplate('#condition-template');
+ this._node = this._parent.parent.instantiateTemplate('condition');
this._typeInput = this._node.querySelector('.condition-type');
this._typeOptionContainer = this._typeInput.querySelector('optgroup');
this._operatorInput = this._node.querySelector('.condition-operator');