diff --git a/src/Wt/WAnchor.C b/src/Wt/WAnchor.C index cf527f5..ff1752e 100644 --- a/src/Wt/WAnchor.C +++ b/src/Wt/WAnchor.C @@ -170,9 +170,6 @@ void WAnchor::setLink(const WLink& link) if (link_.type() != WLink::Resource && link_ == link) return; - if (link_.isNull()) - flags_.set(BIT_CHANGE_TAG); - link_ = link; flags_.set(BIT_LINK_CHANGED); @@ -289,18 +286,6 @@ void WAnchor::enableAjax() void WAnchor::updateDom(DomElement& element, bool all) { - if (element.type() != DomElement_A) { - WContainerWidget::updateDom(element, all); - return; - } - - if (flags_.test(BIT_CHANGE_TAG)) { - if (!all) - element.callJavaScript(WT_CLASS ".changeTag(" + jsRef() + ",'a');"); - - flags_.reset(BIT_CHANGE_TAG); - } - bool needsUrlResolution = false; if (flags_.test(BIT_LINK_CHANGED) || all) { @@ -323,10 +308,13 @@ void WAnchor::updateDom(DomElement& element, bool all) url = app->encodeUntrustedUrl(url); std::string href = resolveRelativeUrl(url); - element.setAttribute("href", href); + if (link_.isNull()) + element.removeAttribute("href"); + else + element.setAttribute("href", href); - needsUrlResolution = !app->environment().hashInternalPaths() - && href.find("://") == std::string::npos && href[0] != '/'; + needsUrlResolution = link_.isNull() ? false : (!app->environment().hashInternalPaths() + && href.find("://") == std::string::npos && href[0] != '/'); flags_.reset(BIT_LINK_CHANGED); } @@ -367,7 +355,7 @@ void WAnchor::propagateRenderOk(bool deep) DomElementType WAnchor::domElementType() const { - return link_.isNull() ? WContainerWidget::domElementType() : DomElement_A; + return DomElement_A; } }