question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Realization of String.prototype.split is inconsistent with ecma-262

See original GitHub issue

Hello, executing following code:

let arg_0 = /(.)\1/i;
let handler_0 = {get:function (oTarget, sKey) { 
    print(sKey.toString());
    return Reflect.get(oTarget, sKey); 
}};
var p_0 = new Proxy(arg_0, handler_0);
(0 + "\u1234\0").split(p_0);

In ecma-262, seperator’s Symbol.split should be got firstly. However, ch get Symbol.toPrimitive firstly.

Output of ch:

Symbol(Symbol.toPrimitive)
toString
TypeError: RegExp.prototype.toString: 'this' is not a RegExp object

Output of other engines:

Symbol(Symbol.split)
constructor
flags
Symbol(Symbol.match)
source

BT group 2018.09.10

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jackhortoncommented, Sep 10, 2018

I feel like we should just take the jump and enable all of the ES6 bits at this point…

0reactions
rhuanjlcommented, Mar 25, 2020

Consolidating as part of #6390

Read more comments on GitHub >

github_iconTop Results From Across the Web

Realization of String.prototype.split is inconsistent with ecma-262 ...
Hello, executing following code: let arg_0 = /(.)\1/i; let handler_0 = {get:function (oTarget, sKey) { print(sKey.toString()); return Reflect.get(oTarget, ...
Read more >
JavaScript split Bugs: Fixed! - Flagrant Badassery
The String.prototype.split method is very handy, so it's a shame that if you use a regular expression as its delimiter, the results can...
Read more >
ECMAScript® 2023 Language Specification - TC39
Introduction. This Ecma Standard defines the ECMAScript 2023 Language. It is the fourteenth edition of the ECMAScript Language Specification.
Read more >
ECMA-262 Edition 5.1 - ECMAScript Language Specification
“primitive” means Undefined, Null, Boolean, String, or Number. “SpecOp” means the internal property is an internal method, an implementation provided procedure ...
Read more >
String.prototype.split() - JavaScript - MDN Web Docs
The split() method takes a pattern and divides a String into an ordered list of substrings by searching for the pattern, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found