Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Remap Safari 4.1 -> 5 and 6.1/6.2 -> 7 #1244

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,33 @@ const parseUA = (userAgent, browsers) => {
data.browser.name = browsers[data.browser.id].name;
data.inBcd = false;

if (data.browser.id === 'safari') {
// Handle Safari backport versions
if (
compareVersions.compare(data.version, '4.1', '>=') &&
compareVersions.compare(data.version, '5', '<')
) {
// Safari 4.1 is a backported version of Safari 5
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also link to https://en.wikipedia.org/wiki/Safari_version_history#Safari_4 + https://en.wikipedia.org/wiki/Safari_version_history#Safari_5 as evidence? The release date and WebKit version is the same for 4.1 and 5.0.

// https://github.com/mdn/browser-compat-data/issues/4679

data.inBcd = true;
data.version = '5';
return data;
}

if (
compareVersions.compare(data.version, '6.1', '>=') &&
compareVersions.compare(data.version, '7', '<')
) {
// Safari 6.1/6.2 are backported versions of Safari 7
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Safari 6.1/6.2 are backported versions of Safari 7
// Safari 6.1/6.2 are backported versions of Safari 7.0/7.1

Also can you link to https://en.wikipedia.org/wiki/Safari_version_history#Safari_6 + https://en.wikipedia.org/wiki/Safari_version_history#Safari_7 as above?

// https://github.com/mdn/browser-compat-data/issues/9423

data.inBcd = true;
data.version = '7';
return data;
}
}

const versions = Object.keys(browsers[data.browser.id].releases);
versions.sort(compareVersions);

Expand Down