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

WordPress Trac noreply at wordpress.org
Mon Jun 3 16:04:48 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 dmsnell):

 > So I really just noticed these changes actually. I swear I didn't make
 them (at least not on purpose), I don't know how they got into this patch.

 The same thing just happened to me on another ticket but with different
 changes. I don't know how those got there either.

 > it's really helpful. I wish this would be a standard in core :-)

 thanks for the kind words @birgire - I wasn't sure how it would be
 received. RegExp patterns are source code and I like to treat them that
 way beyond trivial matches: indentation, comments, etc…

 > have the stripped regex pattern available, either as part of an inline
 comment or vice versa, with the expanded version as a comment

 at this point I have a hard time knowing how to feel. if we add the
 description as a comment it's bound to be wrong as soon as the first
 change to the pattern occurs 🙃

 before I submitted I thought about including the full pattern by itself in
 a comment to make it easier for people to copy and paste into something
 like regex101.com. I came across the same problem though which was that
 keeping the comment and the actual pattern in sync was hard - even while
 developing it.

 Having the pattern written as code made it easier for me to adjust it as I
 caught a few bugs in the tests - easier than the pattern without the
 structure and comments was. However, leaving that in as a full comment
 feels more like a teaching tool than code and we lose the benefit to
 maintaining it.

 Sorry, this is me rambling on. I'll lean on the preferences people share
 here, but my experience tells me that it's valuable to have //only one//
 source of it based on explanatory RegExp comments that I've seen that
 described different RegExp patterns than they said they did 😛

 > What do you think about capitalizing the regex comments and end each
 line with a dot, when possible?

 Will update the patch - I'm not opposed at all, just in a different habit.

 > Can this be a strict comparison:

 Thanks! Good catch.

 > I would suggest adding to the test cases in data_custom_elements()

 Also a good idea - I'll try and add those in today.

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


More information about the wp-trac mailing list