by tinfoilboy · 7y ago · 0 comments
However, the helper types could be useful, and might be able to be implemented as simple aliases to a Node. Also, the reason I take the approach of appending child nodes is for representing actual HTML easier. For instance, with your .text example (at least with my limited glance on it), you can't do something such as <p>Hello, <span>world!</span> Welcome!</p>, which was actually a previous problem that I had with another version of the library.
HTML::document d;
HTML::p p( d );
d.text( "Hello, " );
{
HTML::span s( d );
d.text( "world!" );
}
d.text( " Welcome!" );
Obviously though, if you were trying to do an HTML parser as well, then my ideas are not appropriate.