Skip to content

string.split ie unexpected result #16955

@TurnsOut

Description

@TurnsOut

🐞 Bug report

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

This used to work in angular8.

Description


"tick".split(/^|\s+/) 

yields different results in chrome and ie.

I would expect results to be the same in chrome and ie.

🔬 Minimal Reproduction

  • ng new angular9stringSplit (routing yes, stylesheet scss)
  • change "target" from "es2015" to "es5" in tsconfig.json
  • add constructor to app.component.ts with "console.log('tick'.split(/^|\s+/));"
  • serve
  • compare output in ie (["t","i","c","k"]) with chrome (["tick"])

🔥 Exception or Error

🌍 Your Environment



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / ? \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.0.1
Node: 12.3.1
OS: win32 x64

Angular:
...
Ivy Workspace:

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.900.1
@angular-devkit/core         9.0.1
@angular-devkit/schematics   9.0.1
@schematics/angular          9.0.1
@schematics/update           0.900.1
rxjs                         6.5.3

edit 24/02/2020:
updated to



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / ? \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.0.3
Node: 12.3.1
OS: win32 x64

Angular:
...
Ivy Workspace:

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.900.3
@angular-devkit/core         9.0.3
@angular-devkit/schematics   9.0.3
@schematics/angular          9.0.3
@schematics/update           0.900.3
rxjs                         6.5.3

Anything else relevant?

When debugging i see that polyfill https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.split.js is already in use. Adding it again in polyfills.ts doesn't make a difference.

Unrelated: I'm migrating an angular8 app with d3 to angular9, d3 depends on this for registering callbacks. https://github.com/d3/d3-selection/blob/master/src/selection/on.js#L35

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions