Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8335967

"text-decoration: none" does not work with "A" HTML tags

    XMLWordPrintable

Details

    • b25
    • 23
    • b09
    • generic
    • generic

    Backports

      Description

        ADDITIONAL SYSTEM INFORMATION :
        OpenJDK Runtime Environment (build 23-ea+30-2323)

        A DESCRIPTION OF THE PROBLEM :
        In Java 22 it is possible to set "text-decoration: none" to disable link underline, e.g.:

        <a href="http://example.com" style="text-decoration: none"...

        In Java 23-EA it no longer works as expected.

        REGRESSION : Last worked in version 22.0.1

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Link without underline decoration
        ACTUAL -
        Link with underline decoration ("text-decoration: none" seems ignored)

        ---------- BEGIN SOURCE ----------
        import javax.swing.*;

        public class Test extends JFrame {

        Test() {
        JEditorPane ep = new JEditorPane();

        String text = """
        <style>
        body { font-size: x-large; margin: 50px }

        a { text-decoration: none; color: green; }
        a.test { text-decoration: none; color: red; }
        </style>

        <a href="http://example.com">Link 1</a>

        <br><br>

        <a class=test href="http://example.com">Link 2</a>

        <br><br>

        <a href="http://example.com" style="text-decoration: none; color: orange">Link 3</a>
        """;

        ep.setContentType("text/html");
        ep.setText(text);
        add(ep);

        pack();
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setVisible(true);
        }

        public static void main(String[] args) {
        SwingUtilities.invokeLater(Test::new);
        }

        }
        ---------- END SOURCE ----------

        FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

                aivanov Alexey Ivanov
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: