Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Unified Diff: chrome/test/data/webui/test_api.js

Issue 2927663003: Fix Test.disableAnimationsAndTransitions to work with new /deep/ (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/test_api.js
diff --git a/chrome/test/data/webui/test_api.js b/chrome/test/data/webui/test_api.js
index a58c731e1fc9ffefb7d2ee66936b57cb6c329717..8868a016df4b9062ee22e48d8ec397c19c6bdd7e 100644
--- a/chrome/test/data/webui/test_api.js
+++ b/chrome/test/data/webui/test_api.js
@@ -53,16 +53,15 @@ var testing = {};
* will break. animationend events should still work.
*/
Test.disableAnimationsAndTransitions = function() {
- var noAnimationStyle = document.createElement('style');
- noAnimationStyle.id = 'no-animation';
- noAnimationStyle.textContent =
- '*, * /deep/ * {' +
- ' -webkit-transition-duration: 0ms !important;' +
- ' -webkit-transition-delay: 0ms !important;' +
- ' animation-duration: 0ms !important;' +
- ' animation-delay: 0ms !important;' +
- '}';
- document.querySelector('head').appendChild(noAnimationStyle);
+ let all = document.body.querySelectorAll('*, * /deep/ *');
+ const ZERO_MS_IMPORTANT = '0ms !important';
+ for (let i = 0, l = all.length; i < l; ++i) {
+ let style = all[i].style;
+ style.animationDelay = ZERO_MS_IMPORTANT;
+ style.animationDuration = ZERO_MS_IMPORTANT;
+ style.transitionDelay = ZERO_MS_IMPORTANT;
+ style.transitionDuration = ZERO_MS_IMPORTANT;
+ }
var realElementAnimate = Element.prototype.animate;
Element.prototype.animate = function(keyframes, opt_options) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698