alleyinteractive / alleyinteractive/wp-asset-manager
`wp_kses_hair()` in WordPress 7.0 causes PHP Unit failures
- Ngôn ngữ chính
- PHP
- Star
- 30
- Fork
- 5
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
WordPress 7.0 changed how the `wp_kses_hair()` function parses HTML. It now does so using the HTML API, `WP_HTML_Tag_Processor` class. This has resulted in two unexpected changes in HTML that are causing PHP Unit failures. This is also blocking PRs from merging see #75
Trac Ticket for `wp_kses_hair()`: https://core.trac.wordpress.org/ticket/63724
https://github.com/WordPress/wordpress-develop/pull/9248 ("HTML API: Refactor wp_kses_hair() for spec-compliance")
Regressions:
- HTML tag attributes being changed to be all lowercase and in the case of SVG tags, those attributes are case-sensitive like `viewBox` or `attributeName` for example. This is the cause of most PHP Unit test failures. NOTE: SVGs appear to still work in browsers despite these attributes being case sensitive.
- quote characters are being entity-encoded.
### Example Test Failures when running PHP Unit on WP 7.0
```
1) Alley\WP\Asset_Manager\Tests\SpriteTest::test_add_assets
Should properly escape the sprite sheet.
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'...viewBox="0 0 0 0" width="0">...'
+'...viewbox="0 0 0 0" width="0">...'
```
Snippet above shows the loss of camel-cased tag attributes.
```
2) Alley\WP\Asset_Manager\Tests\StylesTest::test_print_asset
Should load CSS via tag that, on load, will switch to the media attribute from `print` to `all`
Failed asserting that two strings are equal.
-'...this.media='all'" />
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.