Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery parsing HTML unexpectedly and wrongly
    text
    copied!<p>So I have a non-<a href="http://en.wikipedia.org/wiki/JQuery" rel="nofollow noreferrer">jQuery</a> solution to this problem, but I would rather use jQuery if there is a way, and also I am very curious as to why this is happening. </p> <p>I have a Facebook iframe application, and I am using <a href="http://famspam.com/facebox/" rel="nofollow noreferrer">Facebox</a> to dynamically load a some XFBML in an on-page pop-up. </p> <p>Now the XFBML I have loading happens to be the <code>fb:serverfbml</code> tag, which creates an iframe pointed at Facebook and renders the FBML. Which essentially means I need to dynamically add the FBML and then re-parse the XFBML after I display the popup. So I have code that looks like:</p> <pre><code>var App = {}; App.inviteFBML = '\ &lt;fb:serverfbml style="width: 300px; height: 225px;"&gt; \ &lt;script type="text/fbml"&gt; \ &lt;fb:fbml&gt; \ &lt;/fb:fbml&gt;\ &lt;/script&gt;\ &lt;/fb:serverfbml&gt;'; App.inviteFBMLHolder = "&lt;div id='invite_holder' style='width: 300px; height: 250px;'&gt;&lt;/div&gt;"; App.showInvitePrompt = function(){ $.facebox(App.inviteFBMLHolder); document.getElementById('invite_holder').innerHTML = App.inviteFBML; FB.XFBML.Host.parseDomElement(document.getElementById('facebox')); }; </code></pre> <p>Now the above code works, however notice that I am using </p> <pre><code>document.getElementById('invite_holder').innerHTML </code></pre> <p>rather than </p> <pre><code>$('#invite_holder').html(); </code></pre> <p>If I use jQuery's <code>.html</code> function it actually restructures my HTML before inserting it. It restructures it to the following:</p> <pre><code>&lt;fb:serverfbml style="width: 300px; height: 225px;"&gt; &lt;/fb:serverfbml&gt; &lt;script type="text/fbml"&gt; &lt;fb:fbml&gt; &lt;/fb:fbml&gt; &lt;/script&gt; </code></pre> <p>I assume it is doing this because it contains non-standard tags, but is there any way to have jQuery not reformat my string before inserting it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload