Realization of String.prototype.split is inconsistent with ecma-262
See original GitHub issueHello, 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:
- Created 5 years ago
- Comments:7 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I feel like we should just take the jump and enable all of the ES6 bits at this point…
Consolidating as part of #6390