You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
<ion-icon name="?"> elements won't be displayed in AlertController #18239
This happens because of how the message is sanitized: innerHTML={sanitizeDOMString(this.message)} which only allows the following attributes: const allowedAttributes = ['class', 'id', 'href', 'src']; and removes the others:
This issue has been resolved via #18246 and will be in the next version of Ionic. I added in the name and slot attributes to the allowed list of attributes since I felt those were commonly used attributes.
In general, we don't add attributes to the allowed list of attributes. Components that allow HTML content like ion-alert are not intended for anything other than some basic HTML.
I have created a feature request for giving users the option of bypassing the sanitizer if they need to do something complex: #18277
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Activity
brandyscarney commentedon May 10, 2019
Thanks for the issue! I was able to confirm this: https://codepen.io/brandyscarney/pen/qGZydB?editors=1010
The following error is being thrown:
icon was not resolvedtopalavlad commentedon May 11, 2019
This happens because of how the message is sanitized:
innerHTML={sanitizeDOMString(this.message)}which only allows the following attributes:const allowedAttributes = ['class', 'id', 'href', 'src'];and removes the others:Another example is badge's slot attribute: https://codepen.io/Dudelozaur/pen/QREwJw
You can see that the badges are placed differently on the alert than the initial page. Same thing happens for button shapes, setting items as disabled.
redwolf2 commentedon May 13, 2019
@brandyscarney @topalavlad Thanks, now I understand the reason. Do you think there should be a way to pass unsanitized data to the modal?
liamdebeasi commentedon May 14, 2019
Hi everyone,
This issue has been resolved via #18246 and will be in the next version of Ionic. I added in the
nameandslotattributes to the allowed list of attributes since I felt those were commonly used attributes.In general, we don't add attributes to the allowed list of attributes. Components that allow HTML content like
ion-alertare not intended for anything other than some basic HTML.I have created a feature request for giving users the option of bypassing the sanitizer if they need to do something complex: #18277
Thanks!
ionitron-bot commentedon Jun 13, 2019
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.