Make behaviour when binding to detached DOM elements constistent


This refers to the case when applyBindings(...) is passed a DOM element that was created but not yet attached to the DOM.

Nothing happens until an observable in the view model is updated.

At this point Knockout checks if the element is part of the document and if not it destroys the underlying computed observable attached to the observable, thereby rendering the binding ineffective.

This can be a bit of a head-scratcher.

Ideally Knockout should either support binding to detached DOM elements (i.e. not destroy the binding when the detached view model is updated), or throw an exception when attempting to bind to a detached DOM element.

For more details of the issue please refer to the discussion in the forum: https://groups.google.com/forum/?fromgroups=#!topic/knockoutjs/aREJNrD-Miw

Thanks.