Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if ( typeof fn === 'function' ) {
el.renderFn = fn
// Previously defined
} else if ( el.renderFn ) {
// Apply new attributes to render function
// Empty string to prevent undefined
el.renderFn = el.renderFn( fn || '' )
// No render function
} else return
patch( el, el.renderFn )
// The rendered element
return el.firstChild
}
it(desc, () => IncrementalDOM.patch(fixture(), func));
}
it('parses HTML string by htmlparser2', () => {
const func = md({
incrementalizeDefaultRules: false,
}).renderInlineToIncrementalDOM(mdString)
IncrementalDOM.patch(document.body, func)
expect(spy).toHaveBeenCalledWith(expectedHTML)
})
})
const renderWithIncrementalDOM = (func, args) => {
IncrementalDOM.patch(document.body, func(...args))
return document.body.innerHTML
}
const instance = md()
const { options } = instance
const tokens = instance.parse('# test')
instance.renderer.rules.heading_open = () => '['
instance.renderer.rules.heading_close = () => ']'
const rendererOne = instance.IncrementalDOMRenderer
IncrementalDOM.patch(document.body, rendererOne.render(tokens, options))
expect(document.body.innerHTML).toBe('[test]')
instance.renderer.rules.heading_open = () => '^'
instance.renderer.rules.heading_close = () => '$'
const rendererTwo = instance.IncrementalDOMRenderer
IncrementalDOM.patch(document.body, rendererTwo.render(tokens, options))
expect(document.body.innerHTML).toBe('^test$')
})
})
proxy_inst.$draw = function({key_id,is}:any){
//console.log(key_id,is,this);
patch(
document.getElementById(key_id),
this.$render.bind(this,{key_id, is, loaded:true}),
this
)
}
inst_watched[key_id] = {$loaded: false, inst: proxy_inst, $is:is, $propsAfterAttached:propsAfterAttached};
function render () {
var tree = makeTree(fsos)
patch(el, update, tree)
}
element.render = (fn, el) => (patch(el, fn))
return function () {
let templateBuilderFn = component.template()
if (INCREMENTAL_RENDERING) {
templateBuilderFn()
} else {
INCREMENTAL_RENDERING = true
IncrementalDOM.patch(component, templateBuilderFn)
INCREMENTAL_RENDERING = false
}
}
}
return function (elem) {
if (!elem.shadowRoot) {
elem.attachShadow({ mode: 'open' });
}
patch(elem.shadowRoot, internalRenderer, elem);
};
}