Is there any approach or workaround to make a (global, if you wish, but not necessarily) function only available to inline event handlers of DOM elements?
JavaScript
function forInlineCallsOnly() {
// only callable from inline "on" attributes of DOM elements
};
That is, the above function should not be able to be called from other parts of the script, only from, for example:
HTML
<a onclick="forInlineCallsOnly();">Click me</a>
Could this be possible using stack tracing?
Note: this is not a question of best-practices regarding where event handlers should be defined.