Commit 38277a02 authored by jan.koester's avatar jan.koester
Browse files

test

parent 2d012d01
Loading
Loading
Loading
Loading
+13 −15
Original line number Diff line number Diff line
@@ -558,7 +558,7 @@ GETTAGEND:

    for(size_t i=et; i<in.size(); i++){
            size_t kstart=std::string::npos,kend=std::string::npos;
            if(in[i]!=' ' || in[i]!='\r' || in[i]!='\n'){
            if(in[i]!=' ' && in[i]!='\r' && in[i]!='\n'){
                kstart=i;
                kend=in.size();
                bool value=false;
@@ -578,7 +578,7 @@ GETTAGEND:
                                vstart=++i;
                                continue;
                            }else{
                                vend=i++;
                                vend=i;
                                break;
                            }
                        }
@@ -1694,12 +1694,12 @@ libhtmlpp::HtmlElement *libhtmlpp::HtmlElement::getElementbyID(const std::string
    std::stack <Element*> childs;
    const Element *curel=this;
SEARCHBYID:
    if(curel->getType()==HtmlEl || curel->getType()== ScriptEL){
    if(curel->getType()==HtmlEl || curel->getType()== ScriptEL || curel->getType()==SvgEL){
        if(((HtmlElement*)curel)->_childElement){
            childs.push(((HtmlElement*)curel)->_childElement);
        }
        std::string idname=((HtmlElement*)curel)->getAtributte("id");
        if(!idname.empty() && std::equal(id.begin(),id.end(),idname.begin()) ){
        if(idname.length()==id.length() && std::equal(id.begin(),id.end(),idname.begin()) ){
            return (HtmlElement*)curel;
        }
    }
@@ -1721,7 +1721,7 @@ libhtmlpp::HtmlElement *libhtmlpp::HtmlElement::getElementbyTag(const std::strin
    std::stack <Element*> childs;
    const Element *curel=this;
SEARCHBYTAG:
    if(curel->getType()==HtmlEl || curel->getType()== ScriptEL){
    if(curel->getType()==HtmlEl || curel->getType()== ScriptEL || curel->getType()==SvgEL){
        if(((HtmlElement*)curel)->_childElement){
            childs.push(((HtmlElement*)curel)->_childElement);
        }
@@ -1746,14 +1746,13 @@ SEARCHBYTAG:

void libhtmlpp::HtmlElement::setAttribute(const std::string &name, const std::string &value) {
    Attributes* cattr = nullptr;

    for (Attributes* curattr = _firstAttr; curattr; curattr=curattr->_nextAttr) {
        if ( std::equal(name.begin(),name.end(),curattr->_Key.begin()) ) {
            cattr = curattr;
    for (cattr= _firstAttr; cattr; cattr=cattr->_nextAttr) {
        if(name.size() == cattr->_Key.size() && std::equal(name.begin(),name.end(),cattr->_Key.begin())){
            cattr->_Value.clear();
            std::copy(value.begin(),value.end(),std::back_inserter(cattr->_Value));
            return;
        }
    }
    if (!cattr) {
    if (_lastAttr){
            _lastAttr->_nextAttr = new Attributes();
            _lastAttr = _lastAttr->_nextAttr;
@@ -1763,7 +1762,6 @@ void libhtmlpp::HtmlElement::setAttribute(const std::string &name, const std::st
    }
    cattr = _lastAttr;
    std::copy(name.begin(),name.end(),std::back_inserter(cattr->_Key) );
    }
    std::copy(value.begin(),value.end(),std::back_inserter(cattr->_Value));
}