Could you split this into two methods: one to create the lap DOM, and one to update it? Supporting an optional third argument is handy, but it drastically affects the behavior of the function and makes it a bit difficult to follow.

Also, neither method will need to be invoked in the context of the panel because they won't have side effects (is that what you'd call a "pure" function?)