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

BOM as whitespace test case #177

Merged
merged 1 commit into from May 9, 2015
Merged

BOM as whitespace test case #177

merged 1 commit into from May 9, 2015

Conversation

subzey
Copy link

@subzey subzey commented Feb 29, 2012

Byte order mark (zero-width non-breaking space) chars should be trimmed in tags

@dasilvacontin
Copy link
Collaborator

We should add browser testing in order to check this.

dasilvacontin added a commit that referenced this pull request May 9, 2015
BOM as whitespace test case
@dasilvacontin dasilvacontin merged commit ca42511 into janl:master May 9, 2015
@dasilvacontin
Copy link
Collaborator

Thanks @subzey!

@bobthecow
Copy link

Why?

@dasilvacontin
Copy link
Collaborator

I think we should treat BOM (aka zero width no-break space) as whitespace. After what I've read about it so far it looks like it's the logical decision and it's also the trend.

Besides, it's something we were already supporting: !!'\ufeff'.match(/\s/) is true for node v0.10.33, iojs v2.0.1 and Chrome Version 42.0.2311.135 (64-bit) (at least it works on these versions, which are the ones I have currently installed). Therefore, a fixed version of this test passes on the Travis build: #448.

Related: https://code.google.com/p/v8/issues/detail?id=3109

@dasilvacontin
Copy link
Collaborator

What are/were your thoughts, @bobthecow?

@bobthecow
Copy link

My thoughts are that:

  1. There are a ton of (read: 25) "whitespace" characters in Unicode, and so far, none of 'em are special in mustache.
  2. No other mustache implementation (to my knowledge) treats anything besides space, tab, and the various newline/carriage return characters as the kind of "whitespace" that's allowed inside tags.

So this makes Mustache.js inconsistent, for (as far as i can tell) little to no benefit.

screen shot 2015-05-09 at 11 05 47 pm

@dasilvacontin
Copy link
Collaborator

  1. There are a ton of (read: 25) "whitespace" characters in Unicode, and so far, none of 'em are special in mustache.

We are not treating BOM as special right now, it just works due to the /\s/ definition in js.

  1. No other mustache implementation (to my knowledge) treats anything besides space, tab, and the various newline/carriage return characters as the kind of "whitespace" that's allowed inside tags.

So this makes Mustache.js inconsistent, for (as far as i can tell) little to no benefit.

That's something I didn't know. But then, if desirable, we should work into creating a cross-language definition for 'whitespace' that we'd use in Mustache, because there are probably other whitespacish characters that are treated differently.

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

Successfully merging this pull request may close these issues.

None yet

3 participants