U4-3439 - JS Errors when using legacy create dialogs

Created by Shannon Deminick 07 Nov 2013, 05:35:07 Updated by Shannon Deminick 26 Jun 2017, 07:11:51

Subtask of: U4-5829

I frequently am seeing this JS error. I've attached a screencast of how to replicate: http://screencast.com/t/ap7xUHuirJ

This happens on quite a few legacy trees both if you click OK or cancel

The JS trace is:

Uncaught Sys.ArgumentException: Sys.ArgumentException: Value must be a DOM element or a text node. Parameter name: element ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQiCIPDjo_JerxoZWK2ybBeBxW29jcMonNvBRWp1bvcIDqCqlo4FcTeGK0k…:237 Error$create ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQiCIPDjo_JerxoZWK2ybBeBxW29jcMonNvBRWp1bvcIDqCqlo4FcTeGK0k…:237 Error$argument ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQiCIPDjo_JerxoZWK2ybBeBxW29jcMonNvBRWp1bvcIDqCqlo4FcTeGK0k…:261 Sys$UI$DomEvent$_ensureDomNode ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQiCIPDjo_JerxoZWK2ybBeBxW29jcMonNvBRWp1bvcIDqCqlo4FcTeGK0k…:4173 Sys$UI$DomEvent$_removeHandler ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQiCIPDjo_JerxoZWK2ybBeBxW29jcMonNvBRWp1bvcIDqCqlo4FcTeGK0k…:4148 Sys$UI$DomEvent$removeHandler ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQiCIPDjo_JerxoZWK2ybBeBxW29jcMonNvBRWp1bvcIDqCqlo4FcTeGK0k…:4145 Sys$WebForms$PageRequestManager$dispose ScriptResource.axd?d=JnUc-DEDOM5KzzVKtsL1tYCboF3rCICde6VfzFD-lHcbleUGaJ9_nT-ckok-MS_cFxqAP0-B81Q35b…:695 Sys$WebForms$PageRequestManager$_onWindowUnload ScriptResource.axd?d=JnUc-DEDOM5KzzVKtsL1tYCboF3rCICde6VfzFD-lHcbleUGaJ9_nT-ckok-MS_cFxqAP0-B81Q35b…:1375 (anonymous function) ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQiCIPDjo_JerxoZWK2ybBeBxW29jcMonNvBRWp1bvcIDqCqlo4FcTeGK0k…:47 Sys$UI$DomEvent$addHandler.browserHandler ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQiCIPDjo_JerxoZWK2ybBeBxW29jcMonNvBRWp1bvcIDqCqlo4FcTeGK0k…:4052 x.fn.extend.remove jquery-2.0.3.min.js:10 c angular.min.js:19 dialog.close umbraco.services.js:658 removeAllDialogs umbraco.services.js:598 (anonymous function) umbraco.services.js:783 e.$emit angular.min.js:93 closeModalWindow LegacyUmbClientMgr.js:325 closeModalWindow UmbracoClientManager.js?cdv=29:203 onclick create.aspx?nodeId=init&nodeType=initmacros&nodeName=Macros&rnd=635193991854824890:93

Comments

Per Ploug 15 Nov 2013, 13:46:11

this is caused by the scriptmanager inside the iframe, which doesnt agree that we destroy the element containing the page, will see if there is a way around this..


Shannon Deminick 16 Nov 2013, 07:41:20

It's caused by this block of code in the script manager:

Sys.UI.DomEvent._ensureDomNode = function Sys$UI$DomEvent$_ensureDomNode(element) {
	if (element.tagName && (element.tagName.toUpperCase() === "SCRIPT")) return;
	
	var doc = element.ownerDocument || element.document || element;
	if ((typeof(element.document) !== 'object') && (element != doc) && (typeof(element.nodeType) !== 'number')) {
		throw Error.argument("element", Sys.Res.argumentDomNode);
	}
}

the 'element' is an element but the element.document is undefined, however element.ownerDocument is defined - but in the end the if check is true and the error is thrown. The element is a 'form' in these cases.

The error is initially caused by this code:

function Sys$WebForms$PageRequestManager$_onWindowUnload(evt) {
    this.dispose();
}

Not sure how we are destroying the iframe DOM stuff but maybe a small timeout might fix it ? dunno.


Per Ploug 16 Nov 2013, 09:24:15

yeah, trying out some things today, setting the iframe url to blank before destroying and so on, should be able to find a solution


Per Ploug 16 Nov 2013, 09:37:31

Well, problem solved, just remember to kill the iframe src first and it should properly destroy the element

if(dialog.element){ dialog.element.modal('hide'); dialog.element.find("iframe").attr("src", "#"); dialog.element.remove(); }


Shannon Deminick 16 Nov 2013, 10:37:40

Well played sir, well played :-)


Shannon Deminick 20 Nov 2013, 06:33:41

I still get this error in a couple places:

  • Create dialog for partial view macro scripts
  • Creating a template


Per Ploug 20 Nov 2013, 07:35:55

will have a look now


Per Ploug 20 Nov 2013, 22:20:28

This is a truly annoying issue, there are currently no way around these issues, I've tried everything, the changing of the source helps, but in some cases not, I'm setting it as a 7.1 issue to look further into, as it does not break anything, but does leave annoying messages in the log


Shannon Deminick 21 Nov 2013, 00:12:15

cool. def annoying :P


Shannon Deminick 26 Jun 2017, 07:11:51

Closing issue due to inactivity - see blog post for details https://umbraco.com/blog/issue-tracker-cleanup/


Priority: Normal

Type: Bug

State: Closed

Assignee: Per Ploug

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:

Sprint:

Story Points:

Cycle: