How to get clicked elelment in <fb:visible-to-connection>-context?

103 views Asked by At

It seems FB have removed the possibility to get the the clicked element (i.e. this) in the context of <fb:visible-to-connection>.

I.e:

<a onclick="doSomething(this);">test</a>
<script>
function doSomething(this) {
   console.log(this);
}
<script>

Will give the following in Firebug:

Object { PRIV_obj=a, appendChild=function(), insertBefore=function(), more...}

Whereas

<fb:visible-to-connection>
    <a onclick="doSomething(this);">test</a>
<fb:else>
</fb:else>
    <a onclick="doSomething(this);">test</a>
</fb:visible-to-connection>

<script type="text/javascript">
function doSomething(element) {
   console.log(element);
}
</script>

Will give:

null

Is this a temporary bug in FBJS or due to some new feature? How do I get hold of "this" in the second example?

1

There are 1 answers

1
Igy On BEST ANSWER

This was changed for security reasons, you can't access HTML elements inside FMBL elements any more - the initial bug report (which was closed as a 'by design') was about using getElementById but I believe this is the same cause