phpDocumentor icon indicating copy to clipboard operation
phpDocumentor copied to clipboard

Seeing unexpected/possibly faulty HTML class tags in the output

Open jrfnl opened this issue 1 year ago • 1 comments

Expected behavior

  1. No class tags when there are no classes for a certain HTML element
  2. No class names starting with a -.

Actual behavior

The diffs are compared to phpDocumenter 3.4.3

  1. No class tags when there are no classes for a certain HTML element
-    <a href="classes/WpOrg-Requests-Auth.html#method_register">register()</a>
+    <a class="" href="classes/WpOrg-Requests-Auth.html#method_register">register()</a>

The class="" is redundant.

  1. No class names starting with a -.
-                    <section class="phpdocumentor-sidebar__category">
+                    <section class="phpdocumentor-sidebar__category -namespaces">

I'd expect the class name either to be phpdocumentor-sidebar__category-namespaces - i.e. without the space before the - - or this to be two class names and the second class name to not start with a -.

While the above may be intentional, to a casual onlooker, like me, it looks like an error.

Steps to reproduce the problem

The issue can be seen in this PR: https://github.com/WordPress/Requests/pull/883 which was created by this build: https://github.com/WordPress/Requests/actions/runs/9835949221 using this workflow: https://github.com/WordPress/Requests/blob/develop/.github/workflows/update-website.yml

Your environment

  • Version used: 3.5.2
  • Install method: PHAR (via setup-php)
  • PHP version: 8.1.29
  • Operating system and version: Ubuntu 22.04.4 (ubuntu-latest on GHA)
  • Link to your project: https://github.com/WordPress/Requests/

jrfnl avatar Jul 08 '24 08:07 jrfnl

Thanks for your report. The classes we are using are inspired by the BEM guidelines. however when I check those you are right that the classes should not start with a - (dash) however changes this would have an impact on anyone customizing the css via our template system. Since we are using this notation for a longer time I do not want to address that as I conciser it a breaking change in the template that is not needed to make it work. It's just for more clean naming.

The way we build our css also focuses on easy extends. So you will see the -protected and -property being combined every where. Which will make it very easy to change the protected icon on every location using the -protected I do the assumption that this was the reasoning behind this notation.

Regarding the empty class attribute, I think that was just a lazy developer ;-)

jaapio avatar Jul 15 '24 20:07 jaapio