bigskysoftware / idiomorph

A DOM-merging algorithm
BSD 2-Clause "Simplified" License
631 stars 31 forks source link

Exclude `document.body` when morphing with `ignoreActiveValue: true` #34

Closed seanpdoyle closed 5 months ago

seanpdoyle commented 5 months ago

When morphing with ignoreActiveValue: true, the <body> element and its children (that is, the entire document) can be preserved if no other element has focus.

Its common in some browsers (for example, Safari) to return document.body from document.activeElement when no other element has focus.

This commit incorporates that condition into the ignoreValueOfActiveElement() predicate function.