Adding a semicolon to the javascript reference in empty Anchor widgets to fix a FF2 bug where Anchor widgets open the error console.
Patch by: jlabanca
Review by: rjrjr
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6331 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/Anchor.java b/user/src/com/google/gwt/user/client/ui/Anchor.java
index 8331d56..6e0d800 100644
--- a/user/src/com/google/gwt/user/client/ui/Anchor.java
+++ b/user/src/com/google/gwt/user/client/ui/Anchor.java
@@ -74,26 +74,26 @@
/**
* Creates an anchor for scripting.
*
- * The anchor's href is set to <code>javascript:</code>, based on the
+ * The anchor's href is set to <code>javascript:;</code>, based on the
* expectation that listeners will be added to the anchor.
*
* @param text the anchor's text
*/
public Anchor(String text) {
- this(text, "javascript:");
+ this(text, "javascript:;");
}
/**
* Creates an anchor for scripting.
*
- * The anchor's href is set to <code>javascript:</code>, based on the
+ * The anchor's href is set to <code>javascript:;</code>, based on the
* expectation that listeners will be added to the anchor.
*
* @param text the anchor's text
* @param asHtml <code>true</code> to treat the specified text as html
*/
public Anchor(String text, boolean asHtml) {
- this(text, asHtml, "javascript:");
+ this(text, asHtml, "javascript:;");
}
/**
diff --git a/user/test/com/google/gwt/user/client/ui/AnchorTest.java b/user/test/com/google/gwt/user/client/ui/AnchorTest.java
index 8cb74ef..4a5804f 100644
--- a/user/test/com/google/gwt/user/client/ui/AnchorTest.java
+++ b/user/test/com/google/gwt/user/client/ui/AnchorTest.java
@@ -124,7 +124,7 @@
assertEquals(1, DOM.getChildCount(p.getElement()));
assertEquals("A", DOM.getChild(p.getElement(), 0).getTagName());
assertEquals("Foo", anchor.getText());
- assertAttributeHasValue("javascript:", anchor.getElement(), "href");
+ assertAttributeHasValue("javascript:;", anchor.getElement(), "href");
for (String attribute : new String[] {"name", "id", "rel", "ref", "target"}) {
assertAttributeNotPresent(attribute, anchor.getElement());
@@ -140,7 +140,7 @@
assertEquals(1, DOM.getChildCount(p.getElement()));
assertEquals("A", DOM.getChild(p.getElement(), 0).getTagName());
assertEquals("SPAN", DOM.getChild(anchor.getElement(), 0).getTagName());
- assertAttributeHasValue("javascript:", anchor.getElement(), "href");
+ assertAttributeHasValue("javascript:;", anchor.getElement(), "href");
for (String attribute : new String[] {"name", "id", "rel", "ref", "target"}) {
assertAttributeNotPresent(attribute, anchor.getElement());