Skip to content

Commit 3e9fc36

Browse files
GiteaBotwxiaoguang
andauthored
Remove hacky patch for "safari emoji glitch fix" (#25208) (#25211)
Backport #25208 by @wxiaoguang According to my test, the UI (emoji) is fine in Safari And actually the code is just dead code, because the "resize" event is never fired on page loading. So for most cases users just view the pages without this hacky patch, nobody ever complains. Co-authored-by: wxiaoguang <[email protected]>
1 parent 8e798eb commit 3e9fc36

File tree

3 files changed

+0
-40
lines changed

3 files changed

+0
-40
lines changed

web_src/css/base.css

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,19 +2199,6 @@ table th[data-sortt-desc] .svg {
21992199
vertical-align: -0.075em;
22002200
}
22012201

2202-
@supports (-webkit-hyphens:none) {
2203-
body:not(.safari-above125) .emoji,
2204-
body:not(.safari-above125) .reaction {
2205-
font-size: inherit;
2206-
vertical-align: inherit;
2207-
}
2208-
body:not(.safari-above125) .emoji img,
2209-
body:not(.safari-above125) .reaction img {
2210-
font-size: 1.25em;
2211-
vertical-align: -0.225em !important;
2212-
}
2213-
}
2214-
22152202
.emoji img,
22162203
.reaction img {
22172204
border-width: 0 !important;

web_src/js/features/common-global.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import $ from 'jquery';
22
import 'jquery.are-you-sure';
3-
import {mqBinarySearch} from '../utils.js';
43
import {createDropzone} from './dropzone.js';
54
import {initCompColorPicker} from './comp/ColorPicker.js';
65
import {showGlobalErrorMessage} from '../bootstrap.js';
@@ -62,19 +61,6 @@ export function initGlobalButtonClickOnEnter() {
6261
}
6362

6463
export function initGlobalCommon() {
65-
// Undo Safari emoji glitch fix at high enough zoom levels
66-
if (navigator.userAgent.match('Safari')) {
67-
$(window).on('resize', () => {
68-
const px = mqBinarySearch('width', 0, 4096, 1, 'px');
69-
const em = mqBinarySearch('width', 0, 1024, 0.01, 'em');
70-
if (em * 16 * 1.25 - px <= -1) {
71-
$('body').addClass('safari-above125');
72-
} else {
73-
$('body').removeClass('safari-above125');
74-
}
75-
});
76-
}
77-
7864
// Semantic UI modules.
7965
const $uiDropdowns = $('.ui.dropdown');
8066

web_src/js/utils.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,6 @@ export function stripTags(text) {
3737
return text.replace(/<[^>]*>?/g, '');
3838
}
3939

40-
// searches the inclusive range [minValue, maxValue].
41-
// credits: https://matthiasott.com/notes/write-your-media-queries-in-pixels-not-ems
42-
export function mqBinarySearch(feature, minValue, maxValue, step, unit) {
43-
if (maxValue - minValue < step) {
44-
return minValue;
45-
}
46-
const mid = Math.ceil((minValue + maxValue) / 2 / step) * step;
47-
if (matchMedia(`screen and (min-${feature}:${mid}${unit})`).matches) {
48-
return mqBinarySearch(feature, mid, maxValue, step, unit); // feature is >= mid
49-
}
50-
return mqBinarySearch(feature, minValue, mid - step, step, unit); // feature is < mid
51-
}
52-
5340
export function parseIssueHref(href) {
5441
const path = (href || '').replace(/[#?].*$/, '');
5542
const [_, owner, repo, type, index] = /([^/]+)\/([^/]+)\/(issues|pulls)\/([0-9]+)/.exec(path) || [];

0 commit comments

Comments
 (0)