Skip to content

Commit

Permalink
Merge pull request #1943 from JacksonJN/fix-null-acitive-element
Browse files Browse the repository at this point in the history
Fixing IE bug causing active element to be null causing render function to error
  • Loading branch information
Isiah Meadows authored Aug 30, 2017
2 parents 19969e2 + 5303e70 commit 11183f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

- core: don't call `onremove` on the children of components that return null from the view [#1921](https://github.com/MithrilJS/mithril.js/issues/1921) [octavore](https://github.com/octavore) ([#1922](https://github.com/MithrilJS/mithril.js/pull/1922))
- hypertext: correct handling of shared attributes object passed to `m()`. Will copy attributes when it's necessary [#1941](https://github.com/MithrilJS/mithril.js/issues/1941) [s-ilya](https://github.com/s-ilya) ([#1942](https://github.com/MithrilJS/mithril.js/pull/1942))
- Fix IE bug where active element is null causing render function to throw error. ([1943](https://github.com/MithrilJS/mithril.js/pull/1943))

---

Expand Down
3 changes: 2 additions & 1 deletion render/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ module.exports = function($window) {
updateNodes(dom, dom.vnodes, Vnode.normalizeChildren(vnodes), false, hooks, null, namespace === "http://www.w3.org/1999/xhtml" ? undefined : namespace)
dom.vnodes = vnodes
for (var i = 0; i < hooks.length; i++) hooks[i]()
if ($doc.activeElement !== active) active.focus()
// document.activeElement can return null in IE https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement
if (active != null && $doc.activeElement !== active) active.focus()
}

return {render: render, setEventCallback: setEventCallback}
Expand Down

0 comments on commit 11183f3

Please sign in to comment.