From 8f5433b0625ba08b380ba757ee6b090945f8cf2c Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 12 Jan 2016 08:55:04 +0100 Subject: [PATCH] Removed attributes, that are obsolet after a replacement by strong/span --- .../thymeleaf/ActiveElementProcessor.java | 23 ++++++++++++++++++- .../thymeleaf/InactiveElementProcessor.java | 23 ++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/juplo/thymeleaf/ActiveElementProcessor.java b/src/main/java/de/juplo/thymeleaf/ActiveElementProcessor.java index 9f714a0..46725e1 100644 --- a/src/main/java/de/juplo/thymeleaf/ActiveElementProcessor.java +++ b/src/main/java/de/juplo/thymeleaf/ActiveElementProcessor.java @@ -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); diff --git a/src/main/java/de/juplo/thymeleaf/InactiveElementProcessor.java b/src/main/java/de/juplo/thymeleaf/InactiveElementProcessor.java index 621a764..cd05854 100644 --- a/src/main/java/de/juplo/thymeleaf/InactiveElementProcessor.java +++ b/src/main/java/de/juplo/thymeleaf/InactiveElementProcessor.java @@ -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); -- 2.20.1