browserslist-useragent
browserslist-useragent copied to clipboard
Wrong result for Opera mobile UA
I've found a strange behaviour. For User Agent Mozilla/5.0 (Linux; Android 9; ANE-LX3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36 OPR/59.1.2926.54067
and browserslist
file
> 0.5%
last 2 major versions
not dead
ie 10-11
matchesUA
function returns false
.
I was playing a bit with code and I found out that here https://github.com/browserslist/browserslist-useragent/blob/5cbd491753085b9a5035b1e914f60964344db742/index.js#L247
resolvedUserAgent
is
{
family: 'Opera Mobile',
version: '59.1.2926'
}
and browser
is
{
family: 'OperaMobile',
version: '46'
}
So looks like the issue hides in map https://github.com/browserslist/browserslist-useragent/blob/5cbd491753085b9a5035b1e914f60964344db742/index.js#L21
I'm ready to do the PR, but I didn't dig deeper into details why this map looks like it looks and so on. That's why I would first contact maintainer and decide what is wrong and what should be done in order to fix this.