Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable transition properties #2659

Merged
merged 3 commits into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions src/css/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export class CSSParsedDeclaration {
textTransform: ReturnType<typeof textTransform.parse>;
transform: ReturnType<typeof transform.parse>;
transformOrigin: ReturnType<typeof transformOrigin.parse>;
transitionDuration: ReturnType<typeof duration.parse>;
visibility: ReturnType<typeof visibility.parse>;
webkitTextStrokeColor: Color;
webkitTextStrokeWidth: ReturnType<typeof webkitTextStrokeWidth.parse>;
Expand Down Expand Up @@ -221,7 +220,6 @@ export class CSSParsedDeclaration {
this.textTransform = parse(context, textTransform, declaration.textTransform);
this.transform = parse(context, transform, declaration.transform);
this.transformOrigin = parse(context, transformOrigin, declaration.transformOrigin);
this.transitionDuration = parse(context, duration, declaration.transitionDuration);
this.visibility = parse(context, visibility, declaration.visibility);
this.webkitTextStrokeColor = parse(context, webkitTextStrokeColor, declaration.webkitTextStrokeColor);
this.webkitTextStrokeWidth = parse(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth);
Expand Down
1 change: 1 addition & 0 deletions src/dom/document-cloner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export class DocumentCloner {

if (window && isElementNode(node) && (isHTMLElementNode(node) || isSVGElementNode(node))) {
const clone = this.createElementClone(node);
clone.style.transitionProperty = 'none';

const style = window.getComputedStyle(node);
const styleBefore = window.getComputedStyle(node, ':before');
Expand Down
4 changes: 1 addition & 3 deletions src/dom/element-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ export class ElementContainer {
if (isDebugging(element, DebuggerType.PARSE)) {
debugger;
}

this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));

if (isHTMLElementNode(element)) {
if (this.styles.animationDuration.some((duration) => duration > 0)) {
element.style.animationDuration = '0s';
}
if (this.styles.transitionDuration.some((duration) => duration > 0)) {
element.style.transitionDuration = '0s';
}

if (this.styles.transform !== null) {
// getBoundingClientRect takes transforms into account
Expand Down
9 changes: 9 additions & 0 deletions tests/reftests/animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
transform: rotate(45deg)
}

.transition-delay {
transition: 1ms;
transition-delay: 50ms;
transform: rotate(45deg)
}

div {
float: left;
Expand Down Expand Up @@ -84,5 +89,9 @@
<div class="transitioned broken">
<p>Hello</p>
</div>

<div class="transition-delay">
<p>Hello</p>
</div>
</body>
</html>