UNPKG

@danielkalen/simplybind

Version:

Magically simple, framework-less one-way/two-way data binding for frontend/backend in ~5kb.

11 lines (10 loc) 418 B
ko.bindingHandlers['html'] = { 'init': function() { // Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications) return { 'controlsDescendantBindings': true }; }, 'update': function (element, valueAccessor) { // setHtml will unwrap the value if needed ko.utils.setHtml(element, valueAccessor()); } };