|
@@ -1,4 +1,4 @@
|
|
-import { addScopeToNode, refreshScope } from '../scope'
|
|
|
|
|
|
+import { addScopeToNode } from '../scope'
|
|
import { evaluateLater } from '../evaluator'
|
|
import { evaluateLater } from '../evaluator'
|
|
import { directive } from '../directives'
|
|
import { directive } from '../directives'
|
|
import { reactive } from '../reactivity'
|
|
import { reactive } from '../reactivity'
|
|
@@ -168,7 +168,7 @@ function loop(el, iteratorNames, evaluateItems, evaluateKey) {
|
|
marker.remove()
|
|
marker.remove()
|
|
})
|
|
})
|
|
|
|
|
|
- refreshScope(elForSpot, scopes[keys.indexOf(keyForSpot)])
|
|
|
|
|
|
+ elForSpot._x_refreshXForScope(scopes[keys.indexOf(keyForSpot)])
|
|
}
|
|
}
|
|
|
|
|
|
// We can now create and add new elements.
|
|
// We can now create and add new elements.
|
|
@@ -185,7 +185,15 @@ function loop(el, iteratorNames, evaluateItems, evaluateKey) {
|
|
|
|
|
|
let clone = document.importNode(templateEl.content, true).firstElementChild
|
|
let clone = document.importNode(templateEl.content, true).firstElementChild
|
|
|
|
|
|
- addScopeToNode(clone, reactive(scope), templateEl)
|
|
|
|
|
|
+ let reactiveScope = reactive(scope)
|
|
|
|
+
|
|
|
|
+ addScopeToNode(clone, reactiveScope, templateEl)
|
|
|
|
+
|
|
|
|
+ clone._x_refreshXForScope = (newScope) => {
|
|
|
|
+ Object.entries(newScope).forEach(([key, value]) => {
|
|
|
|
+ reactiveScope[key] = value
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
|
|
mutateDom(() => {
|
|
mutateDom(() => {
|
|
lastEl.after(clone)
|
|
lastEl.after(clone)
|
|
@@ -204,7 +212,7 @@ function loop(el, iteratorNames, evaluateItems, evaluateKey) {
|
|
// data it depends on in case the data has changed in an
|
|
// data it depends on in case the data has changed in an
|
|
// "unobservable" way.
|
|
// "unobservable" way.
|
|
for (let i = 0; i < sames.length; i++) {
|
|
for (let i = 0; i < sames.length; i++) {
|
|
- refreshScope(lookup[sames[i]], scopes[keys.indexOf(sames[i])])
|
|
|
|
|
|
+ lookup[sames[i]]._x_refreshXForScope(scopes[keys.indexOf(sames[i])])
|
|
}
|
|
}
|
|
|
|
|
|
// Now we'll log the keys (and the order they're in) for comparing
|
|
// Now we'll log the keys (and the order they're in) for comparing
|