Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-62471

String.protype.split returns invalid results on regexps with ^ (beginning of input), breaks D3

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.9.1, 5.11.0

    Description

      Testcase:

      console.log(JSON.stringify(
          'end error'.trim().split(/^|\s+/)
      ));

      Expected result (as in browsers and Node.js):

      ["end","error"]
      

      Observed result:

      ["","nd","error"]
      

      d3.dispatch (a part of D3 4.0 library) uses that and gets broken:
      https://github.com/d3/d3-dispatch/blob/master/src/dispatch.js#L16

      Attachments

        Activity

          People

            shausman Simon Hausmann
            chalker Сковорода Никита
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: