Browse Source

Ensure href is not set to "" when target is null (#10543)

A link with href="" causes a reload of the page, at least in Firefox.

Change-Id: I0d04615b3669d3b7ccab5bf0d45b6a665f32fb1e
tags/7.0.2
Artur Signell 11 years ago
parent
commit
696ef550ad
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      client/src/com/vaadin/client/ui/link/LinkConnector.java

+ 5
- 1
client/src/com/vaadin/client/ui/link/LinkConnector.java View File

@@ -42,7 +42,11 @@ public class LinkConnector extends AbstractComponentConnector implements
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
getWidget().src = getResourceUrl(LinkConstants.HREF_RESOURCE);
getWidget().anchor.setAttribute("href", getWidget().src);
if (getWidget().src == null) {
getWidget().anchor.removeAttribute("href");
} else {
getWidget().anchor.setAttribute("href", getWidget().src);
}
}
});
}

Loading…
Cancel
Save