Feature #1348 » a-span-patch.diff
| src/Wt/WAnchor.C | ||
|---|---|---|
|
if (link_.type() != WLink::Resource && link_ == link)
|
||
|
return;
|
||
|
if (link_.isNull())
|
||
|
flags_.set(BIT_CHANGE_TAG);
|
||
|
link_ = link;
|
||
|
flags_.set(BIT_LINK_CHANGED);
|
||
| ... | ... | |
|
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) {
|
||
| ... | ... | |
|
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] != '/';
|
||
| ... | ... | |
|
DomElementType WAnchor::domElementType() const
|
||
|
{
|
||
|
return link_.isNull() ? WContainerWidget::domElementType() : DomElement_A;
|
||
|
return DomElement_A;
|
||
|
}
|
||
|
}
|
||