Skip to content

Commit

Permalink
fix(chore): remove unnecessary methods and prefixes
Browse files Browse the repository at this point in the history
Since 2.9.0 we limited the browser support, so many browser methods are available everywhere. There is no need to check for them beforehand so i removed those.
  • Loading branch information
lubber-de authored Dec 21, 2022
1 parent 1d41122 commit 5b012ba
Show file tree
Hide file tree
Showing 26 changed files with 34 additions and 123 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Fomantic includes an interactive installer to help setup your project.
* IE 11[^2]
* Microsoft Edge 12-44[^2]

[^1]: Fomantic-UI should basically still work in iOS Safari 7+, Android 4.4+, but, starting from v2.9.0, we won't support them anymore if anything works different than in recent versions.
[^1]: Fomantic-UI should basically still work in iOS Safari 9+, Android 4.4+, but, starting from v2.9.0, we won't support them anymore if anything works different than in recent versions.
[^2]: Fomantic-UI should basically still work in IE11 / old Edge, but, starting from v2.9.0, we won't support them anymore in terms of dedicated bugfixes.

---
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/behaviors/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/behaviors/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@
if ($allModules.length > 1) {
title += ' (' + $allModules.length + ')';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/behaviors/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
10 changes: 1 addition & 9 deletions src/definitions/behaviors/visibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@

instance = $module.data(moduleNamespace),

requestAnimationFrame = window.requestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.msRequestAnimationFrame
|| function (callback) {
setTimeout(callback, 0);
},

element = this,
disabled = false,

Expand Down Expand Up @@ -1100,7 +1092,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
45 changes: 9 additions & 36 deletions src/definitions/globals/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,45 +60,16 @@
},

normalize: function () {
module.fix.console();
module.fix.requestAnimationFrame();
// keep the function for backward compatibility
// eslint-disable-next-line no-useless-return
return;
},

fix: {
console: function () {
module.debug('Normalizing window.console');
if (console === undefined || console.log === undefined) {
module.verbose('Console not available, normalizing events');
module.disable.console();
}
if (console.group === undefined || console.groupEnd === undefined || console.groupCollapsed === undefined) {
module.verbose('Console group not available, normalizing events');
window.console.group = function () {};
window.console.groupEnd = function () {};
window.console.groupCollapsed = function () {};
}
if (console.markTimeline === undefined) {
module.verbose('Mark timeline not available, normalizing events');
window.console.markTimeline = function () {};
}
},
consoleClear: function () {
module.debug('Disabling programmatic console clearing');
window.console.clear = function () {};
},
requestAnimationFrame: function () {
module.debug('Normalizing requestAnimationFrame');
if (window.requestAnimationFrame === undefined) {
module.debug('RequestAnimationFrame not available, normalizing event');
window.requestAnimationFrame = window.requestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.msRequestAnimationFrame
|| function (callback) {
setTimeout(callback, 0);
};
}
},
},

moduleExists: function (name) {
Expand Down Expand Up @@ -244,7 +215,7 @@
groupEnd: function () {},
info: function () {},
log: function () {},
markTimeline: function () {},
table: function () {},
warn: function () {},
};
}
Expand Down Expand Up @@ -334,7 +305,7 @@
totalTime += data['Execution Time'];
});
title += ' ' + totalTime + 'ms';
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down Expand Up @@ -441,21 +412,23 @@
'dimmer',
'dropdown',
'embed',
'flyout',
'form',
'modal',
'nag',
'popup',
'slider',
'progress',
'rating',
'search',
'shape',
'sidebar',
'slider',
'state',
'sticky',
'tab',
'toast',
'transition',
'visibility',
'visit',
],

siteNamespace: 'site',
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/dimmer.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@
if ($allModules.length > 1) {
title += ' (' + $allModules.length + ')';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -3851,7 +3851,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@
if ($allModules.length > 1) {
title += ' (' + $allModules.length + ')';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
15 changes: 1 addition & 14 deletions src/definitions/modules/flyout.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@
methodInvoked = typeof query === 'string',
queryArguments = [].slice.call(arguments, 1),

requestAnimationFrame = window.requestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.msRequestAnimationFrame
|| function (callback) {
setTimeout(callback, 0);
},

returnedValue
;

Expand Down Expand Up @@ -437,14 +429,12 @@
style += ''
+ ' .ui.visible.' + direction + '.flyout ~ .fixed,'
+ ' .ui.visible.' + direction + '.flyout ~ .pusher {'
+ ' -webkit-transform: translate3d(' + distance[direction] + 'px, 0, 0);'
+ ' transform: translate3d(' + distance[direction] + 'px, 0, 0);'
+ ' }';
} else if (direction === 'top' || direction === 'bottom') {
style += ''
+ ' .ui.visible.' + direction + '.flyout ~ .fixed,'
+ ' .ui.visible.' + direction + '.flyout ~ .pusher {'
+ ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
+ ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
+ ' }';
}
Expand All @@ -456,21 +446,18 @@
module.debug('Adding CSS rules for animation distance', width);
style += ''
+ ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher::after {'
+ ' -webkit-transform: translate3d(' + distance[direction] + 'px, 0, 0);'
+ ' transform: translate3d(' + distance[direction] + 'px, 0, 0);'
+ ' }';
} else if (direction === 'top' || direction === 'bottom') {
style += ''
+ ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher::after {'
+ ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
+ ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
+ ' }';
}
/* opposite sides visible forces content overlay */
style += ''
+ ' body.pushable > .ui.visible.left.flyout ~ .ui.visible.right.flyout ~ .pusher::after,'
+ ' body.pushable > .ui.visible.right.flyout ~ .ui.visible.left.flyout ~ .pusher::after {'
+ ' -webkit-transform: translate3d(0, 0, 0);'
+ ' transform: translate3d(0, 0, 0);'
+ ' }';
}
Expand Down Expand Up @@ -1215,7 +1202,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
10 changes: 1 addition & 9 deletions src/definitions/modules/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@
methodInvoked = typeof query === 'string',
queryArguments = [].slice.call(arguments, 1),

requestAnimationFrame = window.requestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.msRequestAnimationFrame
|| function (callback) {
setTimeout(callback, 0);
},

returnedValue
;

Expand Down Expand Up @@ -1221,7 +1213,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/nag.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@
if (moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
if ($allModules.length > 1) {
title += ' (' + $allModules.length + ')';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@
if ($allModules.length > 1) {
title += ' (' + $allModules.length + ')';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
14 changes: 1 addition & 13 deletions src/definitions/modules/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@
methodInvoked = typeof query === 'string',
queryArguments = [].slice.call(arguments, 1),

requestAnimationFrame = window.requestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.msRequestAnimationFrame
|| function (callback) {
setTimeout(callback, 0);
},

returnedValue
;

Expand Down Expand Up @@ -216,10 +208,6 @@
if (settings.duration || settings.duration === 0) {
$sides.add($side)
.css({
'-webkit-transition-duration': duration,
'-moz-transition-duration': duration,
'-ms-transition-duration': duration,
'-o-transition-duration': duration,
'transition-duration': duration,
})
;
Expand Down Expand Up @@ -677,7 +665,7 @@
if ($allModules.length > 1) {
title += ' (' + $allModules.length + ')';
}
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
if (performance.length > 0) {
console.groupCollapsed(title);
if (console.table) {
console.table(performance);
Expand Down
Loading

0 comments on commit 5b012ba

Please sign in to comment.