(dom, vnodes)
| 855 | } |
| 856 | |
| 857 | function render(dom, vnodes) { |
| 858 | if (!dom) throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.") |
| 859 | var hooks = [] |
| 860 | var active = $doc.activeElement |
| 861 | var namespace = dom.namespaceURI |
| 862 | |
| 863 | // First time rendering into a node clears it out |
| 864 | if (dom.vnodes == null) dom.textContent = "" |
| 865 | |
| 866 | if (!Array.isArray(vnodes)) vnodes = [vnodes] |
| 867 | updateNodes(dom, dom.vnodes, Vnode.normalizeChildren(vnodes), hooks, null, namespace === "http://www.w3.org/1999/xhtml" ? undefined : namespace) |
| 868 | dom.vnodes = vnodes |
| 869 | // document.activeElement can return null in IE https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement |
| 870 | if (active != null && $doc.activeElement !== active && typeof active.focus === "function") active.focus() |
| 871 | for (var i = 0; i < hooks.length; i++) hooks[i]() |
| 872 | } |
| 873 | |
| 874 | return {render: render, setEventCallback: setEventCallback} |
| 875 | } |
no test coverage detected