Hey guys,

I'm pretty sure Prototype is incompatible with some Facebook Connect
functionality.  I am writing an app using an Ajax.Updater where I
return some FBML elements that I then want to render using Facebook's
JS API.

The returned HTML looks something like this:

<fb:serverfbml>
  <script type="text/fbml">
    <fb:request-form action="/post_friend_invite">
     ....
    </fb:request-form>
  </script>
</fb:serverfbml>

<script type="text/javascript">
  FB.XFBML.Host.parseDomTree();
</script>

The incompatibility comes in due to the fact that Facebook's
fb:serverfbml tag wants it's internal elements wrapped in a <script
type="text/fbml"> tag, but Prototype is trying to execute this code as
Javascript since it doesn't appear discriminate between different
types of script.

Since this is being done in an Ajax.Updater, I need to keep
evalScripts set to true for the parseDomTree() call to happen.  The
following change solved everything on my end, but it's pretty ugly:

<fb:serverfbml>
  <div id="replace_me"></div>
</fb:serverfbml>

<div id="fbml_holder" style="display: none">
    <fb:request-form action="/post_friend_invite">
     ....
    </fb:request-form>
</div>

<script type="text/javascript">
  var elm = new Element('script', {type: "text/fbml"});
  elm.update($('fbml_holder').innerHTML);
  $('replace_me').replace(elm)

  FB.XFBML.Host.parseDomTree();
</script>



I think that Prototype should be patched to not execute <script
type="text/fbml">

What do you all think?

Thanks,
Ryan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to