Skip to content

Commit

Permalink
Removed unnecessary transition end name, supported browser support na…
Browse files Browse the repository at this point in the history
…tive one
  • Loading branch information
Havunen committed Jan 23, 2025
1 parent 58e147b commit 9b1802f
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 104 deletions.
153 changes: 81 additions & 72 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"@swc/jest": "^0.2.37",
"@types/jest": "^29.5.14",
"@types/jsdom": "^21.1.7",
"@types/node": "^22.10.9",
"@types/node": "^22.10.10",
"@typescript-eslint/eslint-plugin": "^8.21.0",
"@typescript-eslint/parser": "^8.21.0",
"babel-plugin-inferno": "6.8.3",
Expand Down

This file was deleted.

7 changes: 1 addition & 6 deletions packages/inferno-animation/__tests__/utils.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {
registerTransitionListener,
removeClassName,
setDimensions,
setDisplay,
transitionEndName,
setDisplay
} from '../src/utils';

describe('inferno-animation utils', () => {
Expand Down Expand Up @@ -123,8 +122,4 @@ describe('inferno-animation utils', () => {
});
el.dispatchEvent(new Event('load'));
});

it('transitionEnd is valid', () => {
expect(transitionEndName).toEqual('transitionend');
});
});
18 changes: 0 additions & 18 deletions packages/inferno-animation/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,24 +197,6 @@ function _getMaxTransitionDuration(nodes): {
};
}

export const transitionEndName: string = (function () {
if (typeof document === 'undefined') return '';

const elementStyle = document.createElement('div').style;
const transitions = {
transition: 'transitionend',
OTransition: 'oTransitionEnd',
MozTransition: 'transitionend',
WebkitTransition: 'webkitTransitionEnd',
};

for (const t in transitions) {
if (elementStyle[t] !== undefined) {
return transitions[t];
}
}
})();

function setAnimationTimeout(onTransitionEnd, rootNode, maxDuration): void {
if (rootNode.nodeName === 'IMG' && !rootNode.complete) {
// Image animations should wait for loaded until the timeout is started, otherwise animation will be cut short
Expand Down

0 comments on commit 9b1802f

Please sign in to comment.