Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple tags in the same line results in 'unexpected identifier' error #53

Open
mtarnovan opened this issue Jun 4, 2015 · 5 comments

Comments

@mtarnovan
Copy link

This code produces the aforementioned error:

  ...
  render: ->
    <span>foo</span><span>bar</span>

while this works:

  ...
  render: ->
    <span>foo</span>
    <span>bar</span>

Is this expected? Thanks.

@sophiebits
Copy link

You can't return two tags from render. Your second example returns only the second tag.

@mtarnovan
Copy link
Author

@spicyj I gave a wrong example, what I mean was - this results in an error:

...
render: ->
  <div>
    <span>foo></span><span>bar<span/>
  </div>

@jsdf
Copy link
Owner

jsdf commented Jun 5, 2015

You've got some malformed tags there... your code should be:

...
render: ->
  <div>
    <span>foo</span><span>bar</span>
  </div>

Or was the > after foo intentional? In that case it should be compiled as an escaped character.

@mtarnovan
Copy link
Author

That rogue > was 100% accidental. Actually, offending code looks something like this:

  render: ->
    <div className="comments" id="comments" name="comments">
      <h3 className="h3-text">
        Add your comments
        <span className="faded">
          — <i className="fa fa-comment"></i> <span className="comment-list__title__counter">{this.state.totalCommentsCount}</span>
        </span>
      </h3>

The error is unexpected indentation at the line with the <i> tag. I should mention I'm using sprockets-coffee-react in a Rails app. I solved this by adding a newline after the <i> tag, like this:

        <span className="faded">
          — <i className="fa fa-comment"></i>
          <span className="comment-list__title__counter">{this.state.totalCommentsCount}</span>
        </span>

Thanks

@jsdf
Copy link
Owner

jsdf commented Jun 9, 2015

Okay thanks, this gives me a enough information to say this is a genuine issue and I'll move forward with some changes I've been considering which should eliminate this class of white space related issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants