Repository: wicket
Updated Branches:
  refs/heads/wicket-6.x 9d946b663 -> ac369b16e


WICKET-6289 fix autolinker so it does not generate an onclick attribute for img 
tags


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/c22e46c8
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/c22e46c8
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/c22e46c8

Branch: refs/heads/wicket-6.x
Commit: c22e46c8fd6caa9e7697320700062c4f52663551
Parents: 9d946b6
Author: Carl-Eric Menzel <[email protected]>
Authored: Fri Nov 25 15:16:31 2016 +0100
Committer: Carl-Eric Menzel <[email protected]>
Committed: Fri Nov 25 15:29:47 2016 +0100

----------------------------------------------------------------------
 .../markup/resolver/AutoLinkResolver.java       |   2 +-
 .../html/link/AutolinkPageExpectedResult_5.html |   9 +++++
 .../wicket/markup/html/link/AutolinkPage_5.html |   9 +++++
 .../wicket/markup/html/link/AutolinkPage_5.java |  36 +++++++++++++++++++
 .../wicket/markup/html/link/AutolinkTest.java   |   7 ++++
 .../markup/html/link/subdir/apache-wicket.png   | Bin 0 -> 210963 bytes
 6 files changed, 62 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/c22e46c8/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
index bf3f073..c127db7 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
@@ -907,7 +907,7 @@ public final class AutoLinkResolver implements 
IComponentResolver
                        // resolving didn't have the desired result or there 
was no delegate
                        // found; fallback on the default resolving which is a 
simple
                        // component that leaves the tag unchanged
-                       autoComponent = new AutolinkExternalLink(autoId, 
pathInfo.reference);
+                       autoComponent = new WebMarkupContainer(autoId);
                }
 
                return autoComponent;

http://git-wip-us.apache.org/repos/asf/wicket/blob/c22e46c8/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_5.html
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_5.html
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_5.html
new file mode 100644
index 0000000..a8462cc
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPageExpectedResult_5.html
@@ -0,0 +1,9 @@
+<html xmlns:wicket>
+<body>
+<wicket:link autolink="true">
+  <img 
src="../resource/org.apache.wicket.markup.html.link.AutolinkPage_5/subdir/apache-wicket.png"/>
+  <!-- image does not exist => Do not change at all -->
+  <img src="does-not-exist.png"/>
+</wicket:link>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/c22e46c8/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.html
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.html
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.html
new file mode 100644
index 0000000..c135a95
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.html
@@ -0,0 +1,9 @@
+<html xmlns:wicket>
+<body>
+<wicket:link autolink=true>
+  <img src="subdir/apache-wicket.png"/>
+  <!-- image does not exist => Do not change at all -->
+  <img src="does-not-exist.png"/>
+</wicket:link>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/c22e46c8/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.java
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.java
new file mode 100644
index 0000000..f88db08
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkPage_5.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.html.link;
+
+
+import org.apache.wicket.markup.html.WebPage;
+
+
+/**
+ * Mock page for testing.
+ */
+public class AutolinkPage_5 extends WebPage
+{
+       private static final long serialVersionUID = 1L;
+
+       /**
+        * Construct.
+        */
+       public AutolinkPage_5()
+       {
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c22e46c8/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkTest.java
index 92dc307..b3c92c7 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/AutolinkTest.java
@@ -68,4 +68,11 @@ public class AutolinkTest extends WicketTestCase
                
tester.getApplication().getMarkupSettings().setAutomaticLinking(true);
                executeTest(AutolinkPage_4.class, 
"AutolinkPageExpectedResult_4.html");
        }
+
+       @Test
+       public void imgTagsShouldNotGetOnClick() throws Exception
+       {
+               
tester.getApplication().getMarkupSettings().setAutomaticLinking(true);
+               executeTest(AutolinkPage_5.class, 
"AutolinkPageExpectedResult_5.html");
+       }
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/c22e46c8/wicket-core/src/test/java/org/apache/wicket/markup/html/link/subdir/apache-wicket.png
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/link/subdir/apache-wicket.png
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/subdir/apache-wicket.png
new file mode 100644
index 0000000..7d4d922
Binary files /dev/null and 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/link/subdir/apache-wicket.png
 differ

Reply via email to