handle xmlhook in mutation observer

This commit is contained in:
Kevin Jahns 2017-11-30 18:35:56 -08:00
parent e70aa09f88
commit e4c10fd6b3
2 changed files with 17 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* global Y, HTMLElement, customElements */ /* global Y, HTMLElement, customElements, CanvasJS */
window.onload = function () { window.onload = function () {
window.yXmlType.bindToDom(document.body) window.yXmlType.bindToDom(document.body)
@ -24,30 +24,29 @@ class MagicTable extends HTMLElement {
this.querySelectorAll('td').forEach(td => { this.querySelectorAll('td').forEach(td => {
let number = Number(td.textContent) let number = Number(td.textContent)
dataPoints.push({ dataPoints.push({
x: (dataPoints.length + 1)*10, x: (dataPoints.length + 1) * 10,
y: number, y: number,
label: '<magic-table> content' label: '<magic-table> content'
}) })
}) })
this.shadowRoot.innerHTML = '' this.shadowRoot.innerHTML = ''
var chart = new CanvasJS.Chart(this.shadowRoot, var chart = new CanvasJS.Chart(this.shadowRoot,
{ {
title:{ title: {
text: "Bar chart" text: 'Bar chart'
}, },
data: [
{
type: 'bar',
data: [ dataPoints: dataPoints
{ }
type: "bar", ]
})
dataPoints: dataPoints chart.render()
}
]
});
chart.render(); // this.shadowRoot.innerHTML = '<p>dtrn</p>'
//this.shadowRoot.innerHTML = '<p>dtrn</p>'
} }
} }
customElements.define('magic-table', MagicTable) customElements.define('magic-table', MagicTable)

View File

@ -268,7 +268,7 @@ export default class YXmlFragment extends YArray {
mutations.forEach(mutation => { mutations.forEach(mutation => {
const dom = mutation.target const dom = mutation.target
const yxml = dom._yxml const yxml = dom._yxml
if (yxml == null) { if (yxml == null || yxml.constructor === YXmlHook) {
// dom element is filtered // dom element is filtered
return return
} }