Skip to content

Implement embed element for Slipstream#222

Merged
jverkoey merged 4 commits into
mainfrom
claude/implement-embed-element-011CUpjygGUvQAKxwRGK8bEX
Nov 5, 2025
Merged

Implement embed element for Slipstream#222
jverkoey merged 4 commits into
mainfrom
claude/implement-embed-element-011CUpjygGUvQAKxwRGK8bEX

Conversation

@jverkoey

@jverkoey jverkoey commented Nov 5, 2025

Copy link
Copy Markdown
Collaborator

Add support for the HTML element, which represents an integration point for external (typically non-HTML) content or plugins.

Features:

  • Support for src URL attribute
  • Optional type parameter for MIME type
  • Width and height support via frame() modifier
  • Comprehensive test coverage

The implementation follows W3C specification and maintains consistency with existing embedded content elements (Image, IFrame).

Part of #25

Add support for the HTML <embed> element, which represents an integration
point for external (typically non-HTML) content or plugins.

Features:
- Support for src URL attribute
- Optional type parameter for MIME type
- Width and height support via frame() modifier
- Comprehensive test coverage

The implementation follows W3C specification and maintains consistency
with existing embedded content elements (Image, IFrame).
Remove incorrect usage of environment._width and environment._height
properties that don't exist. The Embed element now follows the same
simple pattern as Image and IFrame elements.

Changes:
- Removed environment width/height lookups from render method
- Updated documentation example to not show .frame() modifier
- Removed dimension-related test cases
- Add Embed to W3CViews.md embedded content section
- Update SlipstreamForWebDevelopers.md to mark <embed> as implemented
- Also fix Caption documentation which was previously added but not documented
Introduce a new MimeType enum to provide type safety when specifying
MIME types for embedded content, while still allowing custom string
values for flexibility.

Features:
- MimeType enum with common MIME types (video, audio, application, image, text)
- Two Embed initializers: one accepting MimeType enum, one accepting String
- Comprehensive test coverage for both enum and string variants
- Documentation updates with cross-references

The enum follows the same pattern as CrossOrigin and includes:
- Video types: MP4, WebM, Ogg, QuickTime
- Audio types: MPEG, Ogg, WAV, WebM
- Application types: PDF, Flash, JSON, XML
- Image types: SVG, PNG, JPEG, GIF, WebP
- Text types: Plain, HTML, CSS

Example usage:
  Embed(URL(string: "/video.mp4"), type: .videoMP4)
  Embed(URL(string: "/custom.bin"), type: "application/x-custom")
@jverkoey jverkoey merged commit 3e684bc into main Nov 5, 2025
2 checks passed
@jverkoey jverkoey deleted the claude/implement-embed-element-011CUpjygGUvQAKxwRGK8bEX branch November 5, 2025 13:30
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