Skip to content

Commit

Permalink
Merge pull request #444 from snianu/update-unsanitized-html-1
Browse files Browse the repository at this point in the history
Add exceptions in read method.
  • Loading branch information
sanketj authored Oct 10, 2023
2 parents d9db923 + 075f7f9 commit dbf1ee7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/clipboard-unsanitized/explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ EndFragment:<start offset of the end fragment comment tag>
```

### Read()
Follow the algorithm specified in [read()](https://w3c.github.io/clipboard-apis/#dom-clipboard-read) except for the below step:
1. If `text/html` representation is present in the [ClipboardItem](https://w3c.github.io/clipboard-apis/#clipboard-item-interface) and `text/html` is present in the `unsanitized` list, then return the blobData as-is without any sanitization.
Follow the algorithm specified in [read()](https://w3c.github.io/clipboard-apis/#dom-clipboard-read) except for the below steps:
1. If `text/html` representation is present in the [ClipboardItem](https://w3c.github.io/clipboard-apis/#clipboard-item-interface) and `text/html` is present in the `unsanitized` list, then follow the below steps:
1. If size of `unsanitized` list is greater than 1, then throw `Support to read multiple unsanitized formats is not supported.` exception.
2. If `text/html` is not at the first position in the `unsanitized` list, then throw `The unsanitized type` {formatName} `is not supported.` exception.
3. else, return the blobData as-is without any sanitization.
2. Else, follow the existing sanitization behavior as mentioned in [step-3](https://w3c.github.io/clipboard-apis/#dom-clipboard-read).

### JS example
Expand Down

0 comments on commit dbf1ee7

Please sign in to comment.