Refusing to load event handler tag as executable code. The node was injected using innerHTML

Anybody knows if it’s something XD specific? I never saw such error binding value to innerHtml. Looks like google doesn’t know anything about such error as well :frowning:

Plugin Error: Refusing to load event handler tag as executable code. The node was injected using innerHTML.
    at new b (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/js/runtime/src/js/runtime_scripts_loader.js:64:1929)
    at Object.logInternalUncaughtException (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/js/runtime/src/js/runtime_scripts_loader.js:64:2376)
    at d.value (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:486:4080)
    at b.value (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:470:1282)
    at didChangeAttribute (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:434:360)
    at b.set (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:106:1701)
    at b.set (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:106:1871)
    at b.value (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:122:4401)
    at Object.createElement (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:686:573)
    at e.value (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:882:38866)

What part of your code generated this error?

It crashes on

<span [innerHTML]="htmlValue"></span>

where htmlValue is a string like “some <b>bold</b> text
hmmm, it seems that I shared not full stack trace:

Plugin Error: Refusing to load event handler tag as executable code. The node was injected using innerHTML.
    at new b (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/js/runtime/src/js/runtime_scripts_loader.js:64:1929)
    at Object.logInternalUncaughtException (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/js/runtime/src/js/runtime_scripts_loader.js:64:2376)
    at d.value (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:486:4080)
    at b.value (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:470:1282)
    at didChangeAttribute (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:434:360)
    at b.set (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:106:1701)
    at b.set (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:106:1871)
    at b.value (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:122:4401)
    at Object.createElement (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:686:573)
    at e.value (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:882:38866)
ERROR [ReferenceError: DOCUMENT_POSITION_PRECEDING is not defined]
    at error (plugins/PluginLoader.js:1:11491)
    at b.<anonymous> (plugins/PluginLoader.js:1:2459)
    at uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:322:893
    at j (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:322:785)
    at g (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:322:390)
    at f (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:322:192)
    at k (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/domjs/src/js/domjs_scripts.js:322:1097)
    at b.value (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/pluginmanager/src/js/pluginmanager_scripts.js:87:4436)
    at console.<anonymous> (uxp://uxp-internal/home/ubuntu/jenkins/workspace/Torq/torq-native/release-3.1.0/build/modules_gen/js/runtime/src/js/runtime_scripts_loader.js:64:1034)
    at Cn (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:37805)
    at t.handleError (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:38006)
    at C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:51822
    at e.invoke (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\polyfills.js:1:7166)
    at t.run (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\polyfills.js:1:2369)
    at t.runOutsideAngular (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:41929)
    at t.tick (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:51766)
    at t._loadComponent (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:52118)
    at t.bootstrap (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:51288)
    at C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:48174
    at Array.forEach (<anonymous>)
    at t._moduleDoBootstrap (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:48145)
    at C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:47555
    at e.invoke (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\polyfills.js:1:7166)
    at Object.onInvoke (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:40900)
    at e.invoke (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\polyfills.js:1:7106)
    at t.run (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\polyfills.js:1:2369)
    at C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\polyfills.js:1:13833
    at e.invokeTask (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\polyfills.js:1:7850)
    at Object.onInvokeTask (C:\Users\avgre\AppData\Local\Packages\Adobe.CC.XD.Prerelease_adky2gkssdxte\LocalState\develop\sample.plugin\src\main.js:1:40812)

Could you insert your htmlValue by using JavaScript instead? something like this:

dialog.getElementById("mySpan").innerHTML = "htmlValue";

Really in my case it’s a pipe value within ngFor loop so I can’t use direct assignment: ``

<span ngFor="let project of projects" [innerHTML]="project.name | highlight"></span>

I just removed this functionality for now.

UXP in XD doesn’t permit eval, function("string") and event handlers as strings. I don’t know how, but it looks like the code is somehow injecting an event handler. I wonder if that’s from highlight?

I don’t know if Angular has a way of adding an event listener with addEventListener instead of setting an attribute in HTML like (<span onclick="...")?

Well, I suppose eval should be permitted and work exactly like in browsers. I don’t follow what is the reason for such limitations as it just breaks usage of standard js libraries.