private void OnHandleNodeScript(Event evt, string handlerCode) { //the code in the 'href' attribute of the anchor element have to be executed asynchronously var async = evt.Type == "click" && evt.CurrentTarget is HtmlAnchorElement anchor && string.IsNullOrEmpty(anchor.GetAttribute("onclick")); handlerCode = handlerCode.Trim(); if (handlerCode.Last() != ';') { handlerCode += ";"; } if (async) { Task.Run( () => { lock (_document) return(_scriptExecutor.EvalFuncAndCall("function (event){" + handlerCode + "}", evt.Target, evt)); }); } else { _scriptExecutor.EvalFuncAndCall("function (event){" + handlerCode + "}", evt.Target, evt); } }
private void OnHandleNodeScript(Event evt, string handlerCode) { handlerCode = handlerCode.Trim(); if (handlerCode.Last() != ';') { handlerCode += ";"; } _scriptExecutor.EvalFuncAndCall("function (event){" + handlerCode + "}", evt.Target, evt); }