Repository navigation
Implement filter for file-type input's accept attribute - #11757
Conversation
|
Heads up! This PR modifies the following files:
|
|
cc @Manishearth |
|
☔ The latest upstream changes (presumably #11788) made this pull request unmergeable. Please resolve the merge conflicts. |
| if let Some('.') = p.chars().nth(0) { | ||
| filter.push(FilterPattern(p[1..].to_string())); | ||
| } else { | ||
| if let Some(exts) = mime_guess::get_mime_extensions_str(p) { |
There was a problem hiding this comment.
There might be a better way of doing this by directly telling the OS the mime type. However, since it's not in the tfd api yet, we can just merge this for now.
There was a problem hiding this comment.
Actually I am a bit surprised that OS might have a concept like MIME (thinking only Web has that)
There was a problem hiding this comment.
Oh, that's a good point. I think you can tell the OS "image files only" though I'm not sure. You can investigate that later if you want.
|
r=me post rebase |
|
@bors-servo r=Manishearth |
|
📌 Commit 74eb80d has been approved by |
Implement filter for file-type input's accept attribute
Now the two sides are pasted together with the new version of `mime_guess` landed.
I tested this thing locally with stuff like this:
```html
<input id="input_file" type="file" accept=".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"></input>
<a onclick="open_file();">Click</a>
<script type="text/javascript">
function open_file() {
console.log("Open file");
document.getElementById("input_file").click();
}
</script>
```
Will WPT be able to handle this automatically?
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes is related to #11131
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11757)
<!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows |
Now the two sides are pasted together with the new version of
mime_guesslanded.I tested this thing locally with stuff like this:
Will WPT be able to handle this automatically?
Related to #11131
This change is