Removed attributes, that are obsolet after a replacement by strong/span
authorKai Moritz <kai@juplo.de>
Tue, 12 Jan 2016 07:55:04 +0000 (08:55 +0100)
committerKai Moritz <kai@juplo.de>
Mon, 18 Jul 2016 14:52:12 +0000 (16:52 +0200)
src/main/java/de/juplo/thymeleaf/ActiveElementProcessor.java
src/main/java/de/juplo/thymeleaf/InactiveElementProcessor.java

index 9f714a0..46725e1 100644 (file)
@@ -56,8 +56,29 @@ public class ActiveElementProcessor extends AbstractProcessor
         element.removeAttribute(name);
         if ((Boolean)expression.execute(configuration, arguments))
         {
+          // We must not clone the processors, because we remove attributes
           Element strong =
-              element.cloneElementNodeWithNewName(element, "strong", true);
+              element.cloneElementNodeWithNewName(element, "strong", false);
+          strong.removeAttribute("charset");
+          strong.removeAttribute("th:charset");
+          strong.removeAttribute("coords");
+          strong.removeAttribute("href");
+          strong.removeAttribute("th:href");
+          strong.removeAttribute("hreflang");
+          strong.removeAttribute("th:hreflang");
+          strong.removeAttribute("media");
+          strong.removeAttribute("th:media");
+          strong.removeAttribute("name");
+          strong.removeAttribute("th:name");
+          strong.removeAttribute("rel");
+          strong.removeAttribute("th:rel");
+          strong.removeAttribute("ref");
+          strong.removeAttribute("th:ref");
+          strong.removeAttribute("shape");
+          strong.removeAttribute("target");
+          strong.removeAttribute("th:target");
+          strong.removeAttribute("type");
+          strong.removeAttribute("th:type");
           element.clearChildren();
           element.addChild(strong);
           element.getParent().extractChild(element);
index 621a764..cd05854 100644 (file)
@@ -56,8 +56,29 @@ public class InactiveElementProcessor extends AbstractProcessor
         element.removeAttribute(name);
         if ((Boolean)expression.execute(configuration, arguments))
         {
+          // We must not clone the processors, because we remove attributes
           Element strong =
-              element.cloneElementNodeWithNewName(element, "span", true);
+              element.cloneElementNodeWithNewName(element, "span", false);
+          strong.removeAttribute("charset");
+          strong.removeAttribute("th:charset");
+          strong.removeAttribute("coords");
+          strong.removeAttribute("href");
+          strong.removeAttribute("th:href");
+          strong.removeAttribute("hreflang");
+          strong.removeAttribute("th:hreflang");
+          strong.removeAttribute("media");
+          strong.removeAttribute("th:media");
+          strong.removeAttribute("name");
+          strong.removeAttribute("th:name");
+          strong.removeAttribute("rel");
+          strong.removeAttribute("th:rel");
+          strong.removeAttribute("ref");
+          strong.removeAttribute("th:ref");
+          strong.removeAttribute("shape");
+          strong.removeAttribute("target");
+          strong.removeAttribute("th:target");
+          strong.removeAttribute("type");
+          strong.removeAttribute("th:type");
           element.clearChildren();
           element.addChild(strong);
           element.getParent().extractChild(element);