P1a: Element.animate() — Web Animations API Fake #78

Closed
opened 2026-06-18 17:17:55 +00:00 by Artur · 1 comment
Owner

P1a: Element.animate() — Web Animations API

Priority: HIGH
Betrifft: youtube.com, alle Polymer/Lit-Seiten
Aufwand: ~4h

Problembeschreibung

YouTube's Polymer-Framework nutzt element.animate() für UI-Animationen.
Element.animate() ist nicht implementiert → TypeError → App-Features deaktiviert.

Browser-Spec: element.animate(keyframes, options) erstellt eine Animation-Instanz.

Lösung: Minimaler Fake

class AnimationStub extends EventTarget {
  playState = 'finished';
  currentTime = 0;
  startTime = 0;
  effect = null;
  onfinish = null;
  oncancel = null;
  finished = Promise.resolve(this);
  
  play() { this.playState = 'running'; }
  pause() { this.playState = 'paused'; }
  finish() {
    this.playState = 'finished';
    this.dispatchEvent(new Event('finish'));
    if (this.onfinish) this.onfinish(new Event('finish'));
  }
  cancel() {
    this.playState = 'idle';
    this.dispatchEvent(new Event('cancel'));
    if (this.oncancel) this.oncancel(new Event('cancel'));
  }
  reverse() { /* noop */ }
  commitStyles() { /* noop */ }
}

Element.prototype.animate = function(keyframes, options) {
  return new AnimationStub();
};

Kein echtes Rendering — die Animation finished sofort (synchron).

Akzeptanzkriterien

  • element.animate(...) wirft keinen TypeError
  • Returned Animation-Objekt mit .playState, .finished, .cancel()
  • .finished ist ein Promise das sofort resolved
  • YouTube lädt ohne animate-bezogene TypeError
  • Unit-Test: animate returned AnimationStub

Betroffene Dateien

Datei Änderung
src/fakes/animations.ts NEU — AnimationStub + Element.animate
src/pages/page.ts installation in page setup
tests/unit/sprint17-animations.test.ts 5+ Tests
## P1a: `Element.animate()` — Web Animations API **Priority:** HIGH **Betrifft:** youtube.com, alle Polymer/Lit-Seiten **Aufwand:** ~4h ### Problembeschreibung YouTube's Polymer-Framework nutzt `element.animate()` für UI-Animationen. `Element.animate()` ist nicht implementiert → TypeError → App-Features deaktiviert. Browser-Spec: `element.animate(keyframes, options)` erstellt eine `Animation`-Instanz. ### Lösung: Minimaler Fake ```typescript class AnimationStub extends EventTarget { playState = 'finished'; currentTime = 0; startTime = 0; effect = null; onfinish = null; oncancel = null; finished = Promise.resolve(this); play() { this.playState = 'running'; } pause() { this.playState = 'paused'; } finish() { this.playState = 'finished'; this.dispatchEvent(new Event('finish')); if (this.onfinish) this.onfinish(new Event('finish')); } cancel() { this.playState = 'idle'; this.dispatchEvent(new Event('cancel')); if (this.oncancel) this.oncancel(new Event('cancel')); } reverse() { /* noop */ } commitStyles() { /* noop */ } } Element.prototype.animate = function(keyframes, options) { return new AnimationStub(); }; ``` Kein echtes Rendering — die Animation finished sofort (synchron). ### Akzeptanzkriterien - [ ] `element.animate(...)` wirft keinen TypeError - [ ] Returned Animation-Objekt mit `.playState`, `.finished`, `.cancel()` - [ ] `.finished` ist ein Promise das sofort resolved - [ ] YouTube lädt ohne animate-bezogene TypeError - [ ] Unit-Test: animate returned AnimationStub ### Betroffene Dateien | Datei | Änderung | |-------|----------| | `src/fakes/animations.ts` | NEU — AnimationStub + Element.animate | | `src/pages/page.ts` | installation in page setup | | `tests/unit/sprint17-animations.test.ts` | 5+ Tests |
Artur closed this issue 2026-06-18 17:27:08 +00:00
Author
Owner

Bereits implementiert — Element.animate() + AnimationStub

Fundort: src/fakes/animations.ts (NEU) + src/pages/page.ts:281-312

AnimationStub:

  • finished Promise resolved sofort
  • playState = 'finished' (kein echtes Rendering)
  • cancel(), play(), pause(), reverse() — alle noop
  • EventTarget-kompatible API (addEventListener, dispatchEvent)

Commit: eca1765

✅ **Bereits implementiert** — Element.animate() + AnimationStub **Fundort:** `src/fakes/animations.ts` (NEU) + `src/pages/page.ts:281-312` `AnimationStub`: - `finished` Promise resolved sofort - `playState = 'finished'` (kein echtes Rendering) - `cancel()`, `play()`, `pause()`, `reverse()` — alle noop - EventTarget-kompatible API (`addEventListener`, `dispatchEvent`) **Commit:** `eca1765`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
glow-all/true-headless-browser#78
No description provided.