0

I am working on a problem that a client has come across, the javascript that they are using is causing a /* and /*]]>*/ to show up on the Login Tooltip. I have been looking for the cause and I am baffled by it. All I know is that it is being generated somehow by the JavaScript at This Page.

The plugin is using this template which doesn't have any of those characters in it:

<script type="text/template" id="api-login-btn-template">
    <div id="api-signin">
        <label for="api-signin-login">Login : </label><input type="text" id="api-signin-login" name="email" value="" title="e-mail address"/>
        <label for="api-signin-pass">Password : </label><input type="password" id="api-signin-pass" name="password" value="" title="password"/>
        <div class="sign-in-errors"></div>
        <br/>
        <button class="sign-in-btn"><span>Sign In</span> <span class="blue">&#x25B6;</span></button>
    </div>
    <div id="api-signout" style="display:none">
        <p><a href="/program-finder/favorites/">My Favorite Programs <span  class="ltblue_link">&#x25B6;</span></a></p>
        <p>Application: <a id="api-app-status" href="https://secure.apistudyabroad.com/forms"></a></p>
        <button class="sign-out-btn"><span>Sign Out</span></button>
    </div>
</script>

The javascript file responsible for this feature is here. I believe the pop up starts at Line 400 with $('.pane-container').each(function() {

OpensaurusRex
  • 842
  • 1
  • 12
  • 30

1 Answers1

1

This is how your template looks like on generated page (view source in Firefox):

<script type="text/template" id="find-a-program-template">
/*<![CDATA[*/<div style="padding:20px;"><h2> 
...
...
...<div class="clear"></div></div>/*]]>*/
</script>

Seems like PHP / WordPress adds that CDATA part to the template during page rendering, but jQuery plugin doesn't know how to ignore it and writes it down instead.

Btw, you also have a bunch of server side <?php the_time('m') ?> calls on the page, but that's probably unrelated.

Miroslav Popovic
  • 12,100
  • 2
  • 35
  • 47
  • Hmmmm they are using w3 Total Cache plugin, do you think that could be where it is adding it? – OpensaurusRex Jun 02 '12 at 17:09
  • Not really sure... I didn't work with WP. PHP, or WordPress is trying to be a good XHTML citizen and embeds the script tag content in CDATA - http://stackoverflow.com/questions/66837/when-is-a-cdata-section-necessary-within-a-script-tag jQuery plugin that parses the template should really ignore that CDATA... Maybe you could replace it with something else? – Miroslav Popovic Jun 02 '12 at 19:25
  • Ahhhh I see, so because it is a script tag and has HTML within it, it is handling it as an xml excerpt essentially? – OpensaurusRex Jun 02 '12 at 21:27
  • Thanks, that will help me figure out what to do about that. Who figured lol. – OpensaurusRex Jun 02 '12 at 21:29