Flavio Copes
Flavio Copes

Reputation: 4359

Ember.js, strange characters added after body

Running this sample 'bare bones' self-contained example

<html>
<head>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  <script type="text/javascript" src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
  <script type="text/javascript" src="http://dl.dropbox.com/u/3024625/ember.js"></script>
  <script type="text/javascript">
  $(window).load(function(){
    var App = Ember.Application.create({
      ready: function() {
        this.layout = App.ApplicationView.create();
        this.layout.appendTo('body');
      }
    });
    App.ApplicationView = Ember.View.extend({
      template: Ember.Handlebars.compile('<h1>Application</h1>')
    });
    App.initialize();
  });
  </script>

  <script type="text/x-handlebars" data-template-name="application">
    test
  </script>​
</head>
<body>
</body>
</html>

Gives this output:

<body class="ember-application">​

<div id="ember129" class="ember-view"><h1>Application</h1></div></body>

Notice the "​" characters. Looks like an encoding issue, but in another setup those chars take the form of a new line above all the page (that's why I noticed the problem).

Deleting the

  <script type="text/x-handlebars" data-template-name="application">
    test
  </script>​

lines, make the characters go away.

I have this same issue with the latest Ember.js (master), and with a build from a month ago.

Anyone else had this problem?

Upvotes: 0

Views: 638

Answers (1)

pangratz
pangratz

Reputation: 16163

Strange, it looks like this is reproduced by trailing empty character at the end of the line 23 in your provided code. If you delete it, it works - also with the unused template application.

I did some further investigation and it looks like the invisible character is a ZERO WIDTH SPACE, see http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=%26%238203%3B&mode=char.

Upvotes: 5

Related Questions