Loading src/html.cpp +19 −27 Original line number Diff line number Diff line Loading @@ -717,27 +717,22 @@ void libhtmlpp::HtmlElement::insertChild(const libhtmlpp::Element* el){ remove(_childElement); } Element *curel=_childElement; for(const Element *nextel=el; nextel; nextel=nextel->nextElement()){ switch(nextel->getType()){ switch(el->getType()){ case HtmlEl: curel=new HtmlElement; _childElement=new HtmlElement; break; case TextEl: curel=new TextElement; _childElement=new TextElement; break; case CommentEl: curel=new CommentElement; _childElement=new CommentElement; break; default: HTMLException ex; ex[HTMLException::Critical] << "appendChild: Unknown html element found: "<< el->getType() << " !"; throw ex; } _copy(curel,nextel); if(nextel->nextElement()) curel=curel->_nextElement; } _copy(_childElement,el); } void libhtmlpp::HtmlElement::insertChild(const Element& el){ Loading @@ -752,8 +747,8 @@ void libhtmlpp::HtmlElement::appendChild(const libhtmlpp::Element* el){ curel=curel->nextElement(); }while(curel); for(const Element *nextel=el; nextel; nextel=nextel->nextElement()){ switch(nextel->getType()){ switch(curel->getType()){ case HtmlEl: curel=new HtmlElement; break; Loading @@ -768,16 +763,13 @@ void libhtmlpp::HtmlElement::appendChild(const libhtmlpp::Element* el){ ex[HTMLException::Critical] << "appendChild: Unknown html element found: "<< el->getType() << " !"; throw ex; } _copy(curel,nextel); if(nextel->nextElement()) curel=curel->_nextElement; } _copy(curel,el); if(prev){ prev->_nextElement=curel; curel->_prevElement=prev; } }else{ insertChild(el); } Loading Loading
src/html.cpp +19 −27 Original line number Diff line number Diff line Loading @@ -717,27 +717,22 @@ void libhtmlpp::HtmlElement::insertChild(const libhtmlpp::Element* el){ remove(_childElement); } Element *curel=_childElement; for(const Element *nextel=el; nextel; nextel=nextel->nextElement()){ switch(nextel->getType()){ switch(el->getType()){ case HtmlEl: curel=new HtmlElement; _childElement=new HtmlElement; break; case TextEl: curel=new TextElement; _childElement=new TextElement; break; case CommentEl: curel=new CommentElement; _childElement=new CommentElement; break; default: HTMLException ex; ex[HTMLException::Critical] << "appendChild: Unknown html element found: "<< el->getType() << " !"; throw ex; } _copy(curel,nextel); if(nextel->nextElement()) curel=curel->_nextElement; } _copy(_childElement,el); } void libhtmlpp::HtmlElement::insertChild(const Element& el){ Loading @@ -752,8 +747,8 @@ void libhtmlpp::HtmlElement::appendChild(const libhtmlpp::Element* el){ curel=curel->nextElement(); }while(curel); for(const Element *nextel=el; nextel; nextel=nextel->nextElement()){ switch(nextel->getType()){ switch(curel->getType()){ case HtmlEl: curel=new HtmlElement; break; Loading @@ -768,16 +763,13 @@ void libhtmlpp::HtmlElement::appendChild(const libhtmlpp::Element* el){ ex[HTMLException::Critical] << "appendChild: Unknown html element found: "<< el->getType() << " !"; throw ex; } _copy(curel,nextel); if(nextel->nextElement()) curel=curel->_nextElement; } _copy(curel,el); if(prev){ prev->_nextElement=curel; curel->_prevElement=prev; } }else{ insertChild(el); } Loading