From cb09244a53369ca047d1cd08b81399884c0850d1 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Sat, 14 Aug 2021 15:35:41 +0800 Subject: [PATCH 1/3] fix: disable transition properties --- src/css/index.ts | 2 -- src/dom/element-container.ts | 8 +++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/css/index.ts b/src/css/index.ts index 272c6acce..b338871ec 100644 --- a/src/css/index.ts +++ b/src/css/index.ts @@ -143,7 +143,6 @@ export class CSSParsedDeclaration { textTransform: ReturnType; transform: ReturnType; transformOrigin: ReturnType; - transitionDuration: ReturnType; visibility: ReturnType; webkitTextStrokeColor: Color; webkitTextStrokeWidth: ReturnType; @@ -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); diff --git a/src/dom/element-container.ts b/src/dom/element-container.ts index 01f50183b..fe4d7dc65 100644 --- a/src/dom/element-container.ts +++ b/src/dom/element-container.ts @@ -23,15 +23,17 @@ export class ElementContainer { if (isDebugging(element, DebuggerType.PARSE)) { debugger; } + + if (isHTMLElementNode(element)) { + element.style.transitionProperty = 'none'; + } + 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 From ad6f78faa612e7fce0ce0e279f9b58591fa92392 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Sat, 14 Aug 2021 15:53:48 +0800 Subject: [PATCH 2/3] test: transition-delay --- tests/reftests/animation.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/reftests/animation.html b/tests/reftests/animation.html index 552abc432..6e12d23b6 100644 --- a/tests/reftests/animation.html +++ b/tests/reftests/animation.html @@ -56,6 +56,12 @@ } + .transition-delay { + transition: 1ms; + transition-delay: 50ms; + transform: rotate(45deg) + } + div { float: left; clear: left; @@ -84,5 +90,9 @@

Hello

+ +
+

Hello

+
From ce8d7b347f0e24f0f97d93c7cf42bc01b8645111 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Sat, 14 Aug 2021 16:03:08 +0800 Subject: [PATCH 3/3] fix: disable transitions during clone --- src/dom/document-cloner.ts | 1 + src/dom/element-container.ts | 4 ---- tests/reftests/animation.html | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/dom/document-cloner.ts b/src/dom/document-cloner.ts index e6c25884c..07dedb2b0 100644 --- a/src/dom/document-cloner.ts +++ b/src/dom/document-cloner.ts @@ -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'); diff --git a/src/dom/element-container.ts b/src/dom/element-container.ts index fe4d7dc65..151e0cd8f 100644 --- a/src/dom/element-container.ts +++ b/src/dom/element-container.ts @@ -24,10 +24,6 @@ export class ElementContainer { debugger; } - if (isHTMLElementNode(element)) { - element.style.transitionProperty = 'none'; - } - this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null)); if (isHTMLElementNode(element)) { diff --git a/tests/reftests/animation.html b/tests/reftests/animation.html index 6e12d23b6..f7e9693c5 100644 --- a/tests/reftests/animation.html +++ b/tests/reftests/animation.html @@ -55,7 +55,6 @@ transform: rotate(45deg) } - .transition-delay { transition: 1ms; transition-delay: 50ms;