Skip to content

Implement video element for Slipstream#226

Merged
jverkoey merged 3 commits into
mainfrom
claude/implement-video-element-011CUpnWWELC7jgMTsMHfsWi
Nov 5, 2025
Merged

Implement video element for Slipstream#226
jverkoey merged 3 commits into
mainfrom
claude/implement-video-element-011CUpnWWELC7jgMTsMHfsWi

Conversation

@jverkoey

@jverkoey jverkoey commented Nov 5, 2025

Copy link
Copy Markdown
Collaborator

Add support for the HTML

  • URL-based initializer for simple single-source videos
  • Content-based initializer for complex scenarios with multiple sources
  • Chainable modifiers for video attributes: controls, autoplay, muted, loop, width, height, and poster
  • Comprehensive test coverage
  • Updated documentation

The Video element follows established Slipstream patterns and strikes a balance between W3C idioms and SwiftUI conventions.

Part of #25

Add support for the HTML <video> element with a SwiftUI-like API. The implementation provides:

- URL-based initializer for simple single-source videos
- Content-based initializer for complex scenarios with multiple sources
- Chainable modifiers for video attributes: controls, autoplay, muted, loop, width, height, and poster
- Comprehensive test coverage
- Updated documentation

The Video element follows established Slipstream patterns and strikes a balance between W3C idioms and SwiftUI conventions.
Replace modifier methods with direct initializer parameters for a cleaner, more idiomatic API. Configuration options (controls, autoplay, muted, loop, width, height, poster) are now passed directly to the init methods instead of using a chain of modifier methods.

This simplifies the implementation by:
- Removing the private initializer
- Removing all modifier methods
- Exposing configuration directly in public initializers
- Making the API more straightforward and easier to use

Updated tests to use the new API.
Update test expectations to match the actual HTML output from SwiftSoup.
SwiftSoup renders some boolean attributes (controls, muted) without the
empty value (e.g., `controls` instead of `controls=""`), while others
(autoplay, loop) include it (e.g., `autoplay=""`). Both formats are
valid HTML5 for boolean attributes.
@jverkoey jverkoey merged commit 5acb017 into main Nov 5, 2025
2 checks passed
@jverkoey jverkoey deleted the claude/implement-video-element-011CUpnWWELC7jgMTsMHfsWi branch November 5, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants