-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
es.regexp.sticky feature verification fails #1008
Comments
Sorry, I'm not sure that I understood the issue. I have no UC Browser for testing, but in Chrome 57 both of your examples work fine. BTW we can't use Could you explain what do you mean? Is this just |
? |
I wanted to test the compatibility of Core-JS across all versions of mobile browsers,so I added <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="./core-js-bundle/index.js"></script>
</head>
<body>
<div id="ua"></div>
<div id="regexp_constructor"></div>
<div id="regexp_sticky"></div>
</body>
<script>
var ua = document.getElementById('ua');
ua.innerHTML ='ua:' + navigator.userAgent; // + '<br/>' + 'appVersion:' + navigator.appVersion
var sticky = document.getElementById('regexp_constructor');
sticky.innerHTML = "es.regexp.constructor(RegExp(/a/g, 'i')):" + (RegExp(/a/g, 'i'));
var sticky = document.getElementById('regexp_sticky');
sticky.innerHTML = "es.regexp.sticky(new RegExp('a', 'y').sticky):" + (new RegExp('a', 'y').sticky);
</script>
</html> |
Thanks, interesting. As I wrote, now I have no environment where I can test it in UC browser and I have no ideas why it could fail. If you could dig it deeper and, if it's required, help to fix it - I would be happy. |
setTimeout(() => {
console.log(navigator.userAgent)
const re = RegExp('a', 'y')
console.log('re.toString:', re.toString())
console.log('re.sticky:', re.sticky)
var str = '#foo#';
var regex = /foo/y;
console.log('regex.toString:', regex.toString())
regex.lastIndex = 1;
console.log('lastIndex:1,', regex.test(str)); // true
regex.lastIndex = 5;
console.log('lastIndex:5,',regex.test(str));
}, 2000); Android UC browser download address chrome 56 PC UC chrome/57 The toString method and the sticky attribute are not supported, but the functionality is supported The chrome kernel version it uses is probably not real Chrome 57 |
Interesting, thanks. We could extend |
I think this browser patch can be abandoned! |
@chenyulun could you try a fix from this branch? https://github.com/zloirock/core-js/tree/uc-sticky |
I'll try to fix the problem, but it may take a few more days |
Just in case, I'll add a workaround for that from the branch above since it will not make something worse. |
es.regexp.sticky
ua:
Mozilla/5.0 (Linux; U; Android 11; zh-CN; M2102K1AC Build/RKQ1.201112.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.5.5.1035 Mobile Safari/537.36
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky
But the examples on the website can pass the test
by the way: In this browser,
es.regexp.constructor
:The full core-JS patch is still not supported
The text was updated successfully, but these errors were encountered: