git ssb

1+

Matt McKegg / mutant



Commit 6ee7078af0bc52f378b9ee757501631e80091970

html-element: handle bind condition where items were added to an element manually

Matt McKegg committed on 6/28/2017, 7:25:37 AM
Parent: 0f95e238e7d990af64891bac02844a39e4c0cac1

Files changed

html-element.jschanged
html-element.jsView
@@ -122,9 +122,9 @@
122122 function handleChange (change) {
123123 for (var i = 0; i < change.addedNodes.length; i++) {
124124 // if parent is a mutant element, then safe to assume it has already been bound
125125 var node = change.addedNodes[i]
126- if (!caches.has(node.parentNode)) {
126 + if (!caches.has(node.parentNode) || !isBound(node)) {
127127 walk(node, rebind)
128128 }
129129 }
130130 for (var i = 0; i < change.removedNodes.length; i++) {
@@ -226,8 +226,21 @@
226226 }
227227 }
228228 }
229229
230 +function isBound (node) {
231 + if (node.nodeType === 1) {
232 + var data = caches.get(node)
233 + if (data) {
234 + return data.bindings.some(getBound)
235 + }
236 + }
237 +}
238 +
239 +function getBound (binding) {
240 + return binding.bound
241 +}
242 +
230243 function invokeBind (binding) {
231244 binding.bind()
232245 }
233246

Built with git-ssb-web