feat(file): add webkitRelativePath property to File class#2119
Open
spaciousejar wants to merge 2 commits intocapricorn86:masterfrom
Open
feat(file): add webkitRelativePath property to File class#2119spaciousejar wants to merge 2 commits intocapricorn86:masterfrom
spaciousejar wants to merge 2 commits intocapricorn86:masterfrom
Conversation
Adds the missing webkitRelativePath property to the File class as per W3C File API specification. The property defaults to an empty string as required by the spec. - Add readonly webkitRelativePath property with empty string default - Add test case to verify the property returns empty string by default Fixes capricorn86#2093
There was a problem hiding this comment.
Pull request overview
Adds the missing webkitRelativePath property to Happy-DOM’s File implementation to align with the W3C File API behavior (defaulting to an empty string), and verifies it via a unit test.
Changes:
- Added
readonly webkitRelativePath: string = ''toFile. - Added a unit test asserting
webkitRelativePathdefaults to''.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/happy-dom/src/file/File.ts | Adds the webkitRelativePath property with an empty-string default on File instances. |
| packages/happy-dom/test/file/File.test.ts | Adds coverage to ensure webkitRelativePath returns '' by default. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Adds the missing
webkitRelativePathproperty to theFileclass as required by the W3C File API specification.Problem
The
Fileclass in Happy-DOM was missing thewebkitRelativePathproperty, which should be present and default to an empty string according to the W3C File API specification.This property is commonly used when working with file uploads, particularly when handling directory uploads where browsers need to preserve relative paths within the directory structure.
Solution
readonly webkitRelativePath: string = ''property to theFileclassChanges
webkitRelativePathproperty with empty string defaultTesting
webkitRelativePathreturns an empty string by defaultW3C Specification Reference
According to the W3C File API specification:
Fixes #2093