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

Potential edge case bugs #13

Open
Raynos opened this issue Jan 24, 2012 · 4 comments
Open

Potential edge case bugs #13

Raynos opened this issue Jan 24, 2012 · 4 comments

Comments

@Raynos
Copy link

Raynos commented Jan 24, 2012

https://gist.github.com/1120592

Lists a bunch of bugs that are in various implementations of ES5 shims. You may want to thoroughly check yours does not fail any.

For example

String#trim

using buggy character class \s instead of explicitly defining whitespace/line terminators

Note that \s fails in IE sometimes (because IE, rage.)

@olivernn
Copy link
Owner

Yeah I saw that gist, very useful.

I looked at the string trim issue, I decided not to include that in this release because I want to do a bit more testing around it.

Checking in chrome the native implementation seems to fail on some of those whitespace like characters, which is confusing because according to Kangax's article seems to imply that chrome shouldn't fail.

I'll spend some more time looking into this though as I would like augment to be close to agree with the spec where possible/reasonable.

@olivernn
Copy link
Owner

For what its worth this is the test (adapted from es5-shim) that I had that failed in chrome:

test("handling all unicode characters deemed as whitespace by the spec", function () {
  var str = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFFHello World!\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF";

  equal("Hello World!", str.trim(), "should remove all white space characters as defined by the spec")
})

@Raynos
Copy link
Author

Raynos commented Jan 24, 2012

Interesting. Can't trust those browsers :(.

Good job on the whole making it spec compliant thing though o/

@domenic
Copy link

domenic commented Jan 24, 2012

I think I remember seeing Chrome fail test-262 tests for whitespace in trim.

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