magento / magento/magento-coding-standard

"Avoid using self-closing tag" rule is false positive with inline svg

Open
#402 2 comments 0 reactions 0 assignees View on GitHub
bug Progress: ready for grooming
Dominant language
PHP
Stars
375
Forks
165
PR merge metrics
No merged PRs in 30d

Description

As SVG content must be in XML format it must be excluded from HTML validation.

### Preconditions
1. Installed Magento Coding Standard V19 or above

### Steps to reproduce
1. Add inline svg to test.html file
2. Run `vendor/bin/phpcs --severity=10 --standard=Magento2 --ignore-annotations test.html`

### Expected result
1. No errors appear

### Actual result
1. Errors are appear
Avoid using self-closing tag with non-void html element - ``

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with test.html and the documented vendor/bin/phpcs command under the Magento2 standard. Trace the HTML validation rule that reports the self-closing SVG rect element; done means inline SVG is excluded from this validation while the existing non-void HTML checks continue to report errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.