Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add HTML entities in Dart?

I want to add HTML entities like   or & using a Dart class. I tried this :

my_element.nodes.add(new Text('&©'));

but as mentioned in Text class doc, markup is parsed into information, meaning everything is escaped, I guess. I read Node class doc looking for an Entity class; there is none, and I don't want to embed my entity in a tag:

my_element.nodes.add(new Element.html('<span>&amp;&copy;</span>'));

Which class should I use to add an HTML entity ?

like image 725
Eric Lavoie Avatar asked Jun 17 '13 18:06

Eric Lavoie


1 Answers

DocumentFragment will do the job. This:

my_element.nodes.add(new DocumentFragment.html('&amp;&copy;'));

will output in your HTML document.

like image 85
Eric Lavoie Avatar answered Sep 30 '22 15:09

Eric Lavoie