Added populateMultiOption ingredient type

This commit is contained in:
n1474335 2019-02-08 00:59:56 +00:00 committed by s2224834
parent 87e956fe7d
commit 53226c1050
5 changed files with 92 additions and 76 deletions

View file

@ -205,6 +205,7 @@ class RecipeWaiter {
* @fires Manager#statechange
*/
ingChange(e) {
if (e && e.target && e.target.classList.contains("no-state-change")) return;
window.dispatchEvent(this.manager.statechange);
}
@ -392,6 +393,15 @@ class RecipeWaiter {
this.buildRecipeOperation(item);
document.getElementById("rec-list").appendChild(item);
// Trigger populateOption events
const populateOptions = item.querySelectorAll(".populate-option");
const evt = new Event("change", {bubbles: true});
if (populateOptions.length) {
for (const el of populateOptions) {
el.dispatchEvent(evt);
}
}
item.dispatchEvent(this.manager.operationadd);
return item;
}