diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-05-29 19:44:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-29 19:44:53 -0400 |
commit | 37f0396f1cf4f74833d9a4a364f503f4a7c3e34a (patch) | |
tree | 53f91dd03d592fbef83a776f8ee5e3d84cf254b0 /ext | |
parent | 9d40955fc822f4cea141ecb9abf4a838ffe90eb9 (diff) |
DOM binder fixes (#564)
* Fix incorrect updateValue function
* Add source
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bg/js/settings/dom-settings-binder.js | 5 | ||||
-rw-r--r-- | ext/mixed/js/dom-data-binder.js | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/ext/bg/js/settings/dom-settings-binder.js b/ext/bg/js/settings/dom-settings-binder.js index 0441ec29..4b63859f 100644 --- a/ext/bg/js/settings/dom-settings-binder.js +++ b/ext/bg/js/settings/dom-settings-binder.js @@ -22,8 +22,9 @@ */ class DOMSettingsBinder { - constructor({getOptionsContext, transforms=null}) { + constructor({getOptionsContext, source=null, transforms=null}) { this._getOptionsContext = getOptionsContext; + this._source = source; this._defaultScope = 'profile'; this._dataBinder = new DOMDataBinder({ selector: '[data-setting]', @@ -97,7 +98,7 @@ class DOMSettingsBinder { } settingsTargets.push(target); } - return this._transformResults(await api.modifySettings(settingsTargets), targets); + return this._transformResults(await api.modifySettings(settingsTargets, this._source), targets); } _transform(value, transform, metadata, element) { diff --git a/ext/mixed/js/dom-data-binder.js b/ext/mixed/js/dom-data-binder.js index 05a84240..d46e8087 100644 --- a/ext/mixed/js/dom-data-binder.js +++ b/ext/mixed/js/dom-data-binder.js @@ -108,8 +108,8 @@ class DOMDataBinder { if (addedNodes.length !== 0 || addedNodes.length !== 0) { const observer = this._elementMap.get(target); - if (typeof observer !== 'undefined') { - observer.updateValue(); + if (typeof observer !== 'undefined' && observer.hasValue) { + this._setElementValue(observer.element, observer.value); } } } |