SignalR/SignalR — Issue #212: client-side exception then SignalR used togather with MicrosoftAjax
Author: dsosunov
Created: 2012-02-29 11:16:49+00:00
State: open

Microsoft AJAX disposes resources when window is unloading.
This framework uses internal method _ensureDomNode and nodes in SignalR frame is not created (wrapped) by framework.

$type._ensureDomNode = function DomEvent$_ensureDomNode(element) {
if (element && element.tagName && (element.tagName.toUpperCase() === "SCRIPT")) return;

var doc = element ? (element.ownerDocument || element.document || element) : null;
if (!element ||
((typeof(element.document) !== 'object') && (element != doc) && (typeof(element.nodeType) !== 'number'))) {
throw Error.argument("element", Sys.Res.argumentDomNode);
}
}

Therefore, element.tagName is not a string.

The quick fix is override this method and wrap in try/catch

Sample:
$(function () {
var original = Sys.UI.DomEvent["_ensureDomNode"];
Sys.UI.DomEvent["_ensureDomNode"] = function () {
try {
original();
} catch (e) {
}
};
});

But, may be community can propose the better solution.