Updated Branches: refs/heads/wicket-6.x cc0668452 -> 7cdc88f8c
WICKET-5270 Do not set the location.hash when clicking on a link Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/7cdc88f8 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/7cdc88f8 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/7cdc88f8 Branch: refs/heads/wicket-6.x Commit: 7cdc88f8ceeab651339aa86974488086176c2e3a Parents: cc06684 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Fri Jul 12 16:15:11 2013 +0300 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Fri Jul 12 16:18:34 2013 +0300 ---------------------------------------------------------------------- .../apache/wicket/ajax/markup/html/AjaxLink.java | 2 +- .../ajax/markup/html/form/AjaxSubmitLink.java | 2 +- .../wicket/markup/html/form/SubmitLink.java | 2 +- .../ajaxLink/AjaxLinkPageExpectedResult.html | 2 +- .../ajax/markup/html/ajaxLink/AjaxLinkTest.java | 19 +------------------ .../AjaxLinkWithBorderPageExpectedResult.html | 2 +- .../html/ajaxLink/AjaxPage2_ExpectedResult.html | 2 +- .../HideableBorderPage_ExpectedResult.html | 2 +- .../panel/InlinePanelPageExpectedResult_7.html | 2 +- .../panel/InlinePanelPageExpectedResult_8.html | 2 +- 10 files changed, 10 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/7cdc88f8/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java index 20b819d..4e1b344 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/AjaxLink.java @@ -120,7 +120,7 @@ public abstract class AjaxLink<T> extends AbstractLink implements IAjaxLink, IGe if (tag.getName().equalsIgnoreCase("a") || tag.getName().equalsIgnoreCase("link") || tag.getName().equalsIgnoreCase("area")) { - tag.put("href", "#"); + tag.put("href", "javascript:;"); } } else http://git-wip-us.apache.org/repos/asf/wicket/blob/7cdc88f8/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java index 0a38fe9..2d1a2c7 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java @@ -153,7 +153,7 @@ public abstract class AjaxSubmitLink extends AbstractSubmitLink { if (tag.getName().toLowerCase().equals("a")) { - tag.put("href", "#"); + tag.put("href", "javascript:;"); } } else http://git-wip-us.apache.org/repos/asf/wicket/blob/7cdc88f8/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SubmitLink.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SubmitLink.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SubmitLink.java index fb0c5da..f9ec2ad 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SubmitLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/SubmitLink.java @@ -164,7 +164,7 @@ public class SubmitLink extends AbstractSubmitLink { if (tag.getName().equalsIgnoreCase("a")) { - tag.put("href", "#"); + tag.put("href", "javascript:;"); } tag.put("onclick", getTriggerJavaScript()); } http://git-wip-us.apache.org/repos/asf/wicket/blob/7cdc88f8/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html index 583dab3..6ca1167 100644 --- a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html +++ b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html @@ -22,6 +22,6 @@ Wicket.Ajax.ajax({"u":"../page?0-1.IBehaviorListener.0-ajaxLink","e":"click","c" </script> </head><body> <span wicket:id="ajaxLabel" id="ajaxLabel2">UpdateMe</span> - <a href="#" wicket:id="ajaxLink" id="ajaxLink1">Update</a> + <a href="javascript:;" wicket:id="ajaxLink" id="ajaxLink1">Update</a> </body> </html> http://git-wip-us.apache.org/repos/asf/wicket/blob/7cdc88f8/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java index e76f875..5b99e11 100644 --- a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java @@ -21,7 +21,6 @@ import org.apache.wicket.Page; import org.apache.wicket.WicketTestCase; import org.apache.wicket.behavior.AbstractAjaxBehavior; import org.apache.wicket.util.tester.TagTester; -import org.junit.Ignore; import org.junit.Test; @@ -42,7 +41,7 @@ public class AjaxLinkTest extends WicketTestCase TagTester ajaxLink = tester.getTagByWicketId("ajaxLink"); // It was a link to google in the markup, but should be replaced to "#" - assertTrue(ajaxLink.getAttributeIs("href", "#")); + assertTrue(ajaxLink.getAttributeIs("href", "javascript:;")); } /** @@ -61,22 +60,6 @@ public class AjaxLinkTest extends WicketTestCase } /** - * Test that the onclick on ajax link has "return !wcall;" at the end. This ensures that - * execution is not turned over to the href attribute, which would then append # to the url. - */ - @Test - @Ignore - // TODO Wicket.next - re-enable - public void javaScriptEndsWithReturn() - { - tester.startPage(AjaxLinkPage.class); - - TagTester ajaxLink = tester.getTagByWicketId("ajaxLink"); - - assertTrue(ajaxLink.getAttributeEndsWith("onclick", "return !wcall;")); - } - - /** * * @throws Exception */ http://git-wip-us.apache.org/repos/asf/wicket/blob/7cdc88f8/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html index 68e0e20..9e57e6e 100644 --- a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html +++ b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html @@ -25,7 +25,7 @@ Wicket.Ajax.ajax({"u":"../page?0-1.IBehaviorListener.0-border-border_body-ajaxLi Border <wicket:body> <span wicket:id="ajaxLabel" id="ajaxLabel2">UpdateMe</span> - <a href="#" wicket:id="ajaxLink" id="ajaxLink1">Update</a> + <a href="javascript:;" wicket:id="ajaxLink" id="ajaxLink1">Update</a> </wicket:body> Border </wicket:border></span> http://git-wip-us.apache.org/repos/asf/wicket/blob/7cdc88f8/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html index 13eb2c5..34772dc 100644 --- a/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html +++ b/wicket-core/src/test/java/org/apache/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html @@ -30,7 +30,7 @@ Wicket.Ajax.ajax({"u":"../page?0-1.IBehaviorListener.0-pageLayout-pageLayout_bod <td width = "100%"> <wicket:body> <span wicket:id="ajaxLabel" id="ajaxLabel2">AAAAAAA</span> - <a href="#" wicket:id="ajaxLink" id="ajaxLink1">Update</a> + <a href="javascript:;" wicket:id="ajaxLink" id="ajaxLink1">Update</a> </wicket:body> </td> </tr> http://git-wip-us.apache.org/repos/asf/wicket/blob/7cdc88f8/wicket-core/src/test/java/org/apache/wicket/markup/html/border/HideableBorderPage_ExpectedResult.html ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/border/HideableBorderPage_ExpectedResult.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/border/HideableBorderPage_ExpectedResult.html index fdb0817..a87fd9b 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/border/HideableBorderPage_ExpectedResult.html +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/border/HideableBorderPage_ExpectedResult.html @@ -22,7 +22,7 @@ Wicket.Ajax.ajax({"u":"../page?0-1.IBehaviorListener.0-hideable-hideLink","e":"c </script> </head><body> <div wicket:id="hideable"><wicket:border> - <a wicket:id="hideLink" id="hideLink1" href="#">Hide contents</a> + <a wicket:id="hideLink" id="hideLink1" href="javascript:;">Hide contents</a> <div wicket:id="wrapper" id="wrapper2"> <wicket:body> Contents <span wicket:id="content">label</span> http://git-wip-us.apache.org/repos/asf/wicket/blob/7cdc88f8/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/InlinePanelPageExpectedResult_7.html ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/InlinePanelPageExpectedResult_7.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/InlinePanelPageExpectedResult_7.html index d722d6c..23a060a 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/InlinePanelPageExpectedResult_7.html +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/InlinePanelPageExpectedResult_7.html @@ -34,7 +34,7 @@ Wicket.Ajax.ajax({"u":"../page?0-1.IBehaviorListener.0-provider-ajaxRefresh","e" -<a wicket:id="ajaxRefresh" id="ajaxRefresh1" href="#">AJAX refresh</a> +<a wicket:id="ajaxRefresh" id="ajaxRefresh1" href="javascript:;">AJAX refresh</a> </wicket:panel></div> http://git-wip-us.apache.org/repos/asf/wicket/blob/7cdc88f8/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/InlinePanelPageExpectedResult_8.html ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/InlinePanelPageExpectedResult_8.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/InlinePanelPageExpectedResult_8.html index 4b55aca..25731bd 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/InlinePanelPageExpectedResult_8.html +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/InlinePanelPageExpectedResult_8.html @@ -26,7 +26,7 @@ Wicket.Ajax.ajax({"u":"../page?0-1.IBehaviorListener.0-add","e":"click","c":"add <span wicket:id="number">0</span><br/> <div id="nextContainer2" style="display:none"></div> </div> -<a wicket:id="add" id="add1" href="#">Add</a> +<a wicket:id="add" id="add1" href="javascript:;">Add</a>
