Created
August 5, 2015 21:26
-
-
Save kasperpeulen/466b560be75f76405598 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <!--material design lite--> | |
| <link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.0/material.indigo-indigo.min.css"> | |
| <link rel="stylesheet" href="styles.css"> | |
| </head> | |
| <body> | |
| <script type="application/dart" src="main.dart"></script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:html'; | |
| main() { | |
| // href tag will be removed without nodevalidator | |
| DivElement defaultValidator = new DivElement() | |
| ..setInnerHtml('Go to <a href="http://www.google.com">www.google.com</a>'); | |
| // nothing will be removed with the TrustedNodeValidator | |
| DivElement trustedValidator = new DivElement() | |
| ..setInnerHtml('Go to <a href="http://www.google.com">www.google.com</a>', | |
| validator: new TrustedNodeValidator()); | |
| document.body | |
| ..append(trustedValidator) | |
| ..append(defaultValidator); | |
| } | |
| /// A [NodeValidator] which allows everything. | |
| class TrustedNodeValidator implements NodeValidator { | |
| bool allowsElement(Element element) => true; | |
| bool allowsAttribute(element, attributeName, value) => true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| margin: 10px; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment