Implement embed element for Slipstream#222
Merged
jverkoey merged 4 commits intoNov 5, 2025
Merged
Conversation
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")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for the HTML element, which represents an integration point for external (typically non-HTML) content or plugins.
Features:
The implementation follows W3C specification and maintains consistency with existing embedded content elements (Image, IFrame).
Part of #25