UNPKG

@danielkalen/simplybind

Version:

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

12 lines (11 loc) 551 B
ko.bindingHandlers['text'] = { 'init': function() { // Prevent binding on the dynamically-injected text node (as developers are unlikely to expect that, and it has security implications). // It should also make things faster, as we no longer have to consider whether the text node might be bindable. return { 'controlsDescendantBindings': true }; }, 'update': function (element, valueAccessor) { ko.utils.setTextContent(element, valueAccessor()); } }; ko.virtualElements.allowedBindings['text'] = true;