Behaviour SwRS-MDOKFSTUDIO-PALETTE-229
Pasted HTML never brings active content
When the clipboard HTML of a paste is converted, the extension SHALL drop script, style, embedded, form control, media and template elements, comments and hidden content, read only a short list of attributes, and keep only the text of a link or image whose address is not safe.
Another outcome at step 2 of path 2 in StRS-MDOKFSTUDIO-PALETTE-018, in the state “The host converts the HTML”.
Scenarios 3
The situations the tests check; open one to read it.
nominalScripts, styles, comments and hidden content are dropped
Givena script, a style and a paragraph with an onclick attribute, and a span with display none
Whenthe HTML is converted
Thenonly the text of the paragraph is kept and the text of the hidden span is dropped
| Input | Outcome |
|---|---|
| script, style, head, iframe, object, embed, svg, math, form control, media or template element | dropped from the Markdown |
| comment | dropped from the Markdown |
| content hidden by the hidden attribute | dropped from the Markdown |
| content hidden by the style display none, visibility hidden or mso-hide all | dropped from the Markdown |
nominalOnly a few attributes are read
Givena link with an href and a title, and a paragraph with an onclick attribute
Whenthe HTML is converted
Thenthe href is used, the title is dropped and the onclick attribute has no effect on the Markdown
| Input | Outcome |
|---|---|
| attribute href, src, alt, class, style, colspan, rowspan, type, checked or start | read |
| any other attribute (an event attribute such as onclick, title) | dropped; no other attribute reaches the output |
refusalAn unsafe address keeps only the text
Givena link to javascript:alert(1) with the text click, and an image with a data: address and alt text pic
Whenthe HTML is converted
Thenthe text is click without a link, and the text is pic
| Address of the link or image | Outcome |
|---|---|
| http, https, mailto or tel address | accepted |
| fragment | accepted |
| relative path (without a scheme colon before its first slash) | accepted |
| any other scheme, such as javascript: | only the text is kept |
| address that holds a control character | only the text is kept |
| data: image | only its alternative text is kept |