[wp-trac] [WordPress Trac] #58517: HTML API: Introduce HTML Processor, a higher-level partner to the Tag Processor
WordPress Trac
noreply at wordpress.org
Fri Sep 22 21:34:56 UTC 2023
#58517: HTML API: Introduce HTML Processor, a higher-level partner to the Tag
Processor
----------------------------------------+------------------------------
Reporter: dmsnell | Owner: Bernhard Reiter
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.4
Component: HTML API | Version:
Severity: normal | Resolution:
Keywords: has-unit-tests 2nd-opinion | Focuses:
----------------------------------------+------------------------------
Comment (by azaozz):
Replying to [comment:18 oglekler]:
> we are getting closer to Beta 1, so, please review what we have.
Yep, there are some "philosophical differences" here about what is
considered a "good way" to do things with HTML and what is not a good idea
or a "bad way".
I have no doubt that @dmsnell will make the parsing of HTML in PHP work as
well as possible, and with the least amount of edge cases. However the
popular belief (not just mine but of many developers for many years) is
that it is impossible to account for all edge cases. This will always be
inferior to applying the same changes from JS using the browser's DOM. The
difference being that PHP has no idea what the DOM will look like once the
browser parses the HTML.
In these terms I'll continue to advocate against using this (or any other)
"processing of HTML as string in PHP" in WP core, now and in the future.
This would include cautioning/negative reviews for any code that uses
this. I believe this is the inferior way to manipulate the HTML, and that
using the browser's DOM will always be the better alternative.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58517#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list