[render] add support for SVG in m.trust() strings

This commit is contained in:
Pierre-Yves Gérardy 2018-03-02 14:41:49 +01:00 committed by Pierre-Yves Gérardy
parent fdd34f9726
commit ad46a21a7d
4 changed files with 48 additions and 13 deletions

View file

@ -29,7 +29,8 @@
- API: Event handlers may also be objects with `handleEvent` methods ([#1939](https://github.com/MithrilJS/mithril.js/issues/1939)).
- API: `m.route.link` accepts an optional `options` object ([#1930](https://github.com/MithrilJS/mithril.js/pull/1930))
- API: `m.request` supports `timeout` as attr - ([#1966](https://github.com/MithrilJS/mithril.js/pull/1966))
- Mocks: add limited support for the DOMParser API
- Mocks: add limited support for the DOMParser API ([#2097](https://github.com/MithrilJS/mithril.js/pull/2097))
- API: add support for raw SVG in `m.trust()` string ([#2097](https://github.com/MithrilJS/mithril.js/pull/2097))
#### Bug fixes

View file

@ -11,7 +11,7 @@
### Description
Turns an HTML string into unescaped HTML. **Do not use `m.trust` on unsanitized user input.**
Turns an HTML or SVG string into unescaped HTML or SVG. **Do not use `m.trust` on unsanitized user input.**
Always try to use an [alternative method](#avoid-trusting-html) first, before considering using `m.trust`.
@ -23,7 +23,7 @@ Always try to use an [alternative method](#avoid-trusting-html) first, before co
Argument | Type | Required | Description
----------- | -------------------- | -------- | ---
`html` | `String` | Yes | A string containing HTML text
`html` | `String` | Yes | A string containing HTML or SVG text
**returns** | `Vnode` | | A trusted HTML [vnode](vnodes.md) that represents the input string
[How to read signatures](signatures.md)