While I was fixing some js syntax to avoid problems with minification I spotted this block in a third-party js library:
if ('\u0041' == 'A') {
var u = n.userAgent;
if (u.indexOf('Safari') == -1) {
[...]
}
}
The block has no else condition following, and basically checks for browser type and version… anyway I don’t see why it should compare between the unicode code for the ‘A’ character and, well, the ‘A’ character! :/
Has anybody encountered a condition like this before? Am I missing something or it’s useless?
It must be a pretty old library which test javaScript’s support for Unicode.
For an old Browser like Netscape Navigator 4, it only supports
Latin-1encoding'\xXX'other than full Unicode support'\uXXXX'