[wp-trac] [WordPress Trac] #47014: Tag balancing corrupts Custom Elements

WordPress Trac noreply at wordpress.org
Fri May 31 09:55:31 UTC 2019


#47014: Tag balancing corrupts Custom Elements
--------------------------------------+------------------------
 Reporter:  westonruter               |       Owner:  flixos90
     Type:  defect (bug)              |      Status:  reviewing
 Priority:  normal                    |   Milestone:  5.3
Component:  Formatting                |     Version:  2.0.4
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------

Comment (by flixos90):

 [attachment:"47014.diff"] makes the following updates:

 * Consider capitalized tags only if they don't include a dash (i.e. allow
 dashes only in combination with `[a-z0-9]`).
 * Update the regex so that we can check whether spaces were provided after
 what we assume to be the tag or not.
 * If there were no spaces provided and the first following character is a
 dash, we are in a tag that uses capitalization in combination with dashes,
 which is invalid - so the part is kept unchanged. That is not a super-
 elegant solution, but what I came up with that doesn't require tons of
 changes.
 * Add more tests, for invalid custom elements and for a capitalized
 regular tag to make sure those continue to work.

 I noticed, while this patch works completely for all the `balanceTags()`
 tests, it seems to cause breakage in three other tests for
 `wp_targeted_link_rel()`, which I'm not sure about why they're happening -
 would be great if one of y'all could verify if that happens for you too.
 Either way, I wanted to upload this patch already as possible iteration.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47014#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list