-
Notifications
You must be signed in to change notification settings - Fork 3k
HTML API: Refactor wp_kses_hair()
#9248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
HTML API: Refactor wp_kses_hair()
#9248
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Trac ticket: Core-63694 `wp_kses_hair()` is built around an impressive state machine for parsing the `$attr` of an HTML tag, that is, the span of text after the tag name and before the closing `>`. Unfortunately, that parsing code doesn’t fully-implement the HTML specification and may be prone to mis-parsing. This patch replaces the existing state machine with a straight-forward use of the HTML API to parse the attributes for us, constructing a shell take for the `$attr` string and reading the attributes structurally. This shell is necessary because a previous stage of the pipeline has already separated what it thinks is the so-called “attribute list” from a tag. Props: dmsnell
68c7746
to
b476339
Compare
Trac ticket: Core-63694 `wp_kses_hair()` is built around an impressive state machine for parsing the `$attr` of an HTML tag, that is, the span of text after the tag name and before the closing `>`. Unfortunately, that parsing code doesn’t fully-implement the HTML specification and may be prone to mis-parsing. This patch replaces the existing state machine with a straight-forward use of the HTML API to parse the attributes for us, constructing a shell take for the `$attr` string and reading the attributes structurally. This shell is necessary because a previous stage of the pipeline has already separated what it thinks is the so-called “attribute list” from a tag. Props: dmsnell
b476339
to
6146ecd
Compare
Trac ticket: Core-63694 `wp_kses_hair()` is built around an impressive state machine for parsing the `$attr` of an HTML tag, that is, the span of text after the tag name and before the closing `>`. Unfortunately, that parsing code doesn’t fully-implement the HTML specification and may be prone to mis-parsing. This patch replaces the existing state machine with a straight-forward use of the HTML API to parse the attributes for us, constructing a shell take for the `$attr` string and reading the attributes structurally. This shell is necessary because a previous stage of the pipeline has already separated what it thinks is the so-called “attribute list” from a tag. Props: dmsnell
6146ecd
to
d64f56e
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Prep work for WordPress#9248 See also WordPress#9251
Prep work for WordPress#9248 See also WordPress#9251
Prep work for WordPress#9252. Part of WordPress#9248.
) Prep work for WordPress#9252. Part of WordPress#9248.
d64f56e
to
d8147fb
Compare
Trac ticket: Core-63694 `wp_kses_hair()` is built around an impressive state machine for parsing the `$attr` of an HTML tag, that is, the span of text after the tag name and before the closing `>`. Unfortunately, that parsing code doesn’t fully-implement the HTML specification and may be prone to mis-parsing. This patch replaces the existing state machine with a straight-forward use of the HTML API to parse the attributes for us, constructing a shell take for the `$attr` string and reading the attributes structurally. This shell is necessary because a previous stage of the pipeline has already separated what it thinks is the so-called “attribute list” from a tag. Props: dmsnell
d8147fb
to
d119749
Compare
Prep work for WordPress#9248 See also WordPress#9251
Prep work for WordPress#9248.
) Prep work for WordPress#9252. Part of WordPress#9248.
) Prep work for WordPress#9252. Part of WordPress#9248.
Prep work for WordPress#9248 See also WordPress#9251
) Prep work for WordPress#9252. Part of WordPress#9248.
) Prep work for WordPress#9252. Part of WordPress#9248.
) Prep work for WordPress#9252. Part of WordPress#9248.
Trac ticket: Core-63694
Replaces #7407, dmsnell#5
Coordination in #9256
wp_kses_hair()
is built around an impressive state machine for parsing the$attr
of an HTML tag, that is, the span of text after the tag name and before the closing>
. Unfortunately, that parsing code doesn’t fully-implement the HTML specification and may be prone to mis-parsing.This patch replaces the existing state machine with a straight-forward use of the HTML API to parse the attributes for us, constructing a shell take for the
$attr
string and reading the attributes structurally. This shell is necessary because a previous stage of the pipeline has already separated what it thinks is the so-called “attribute list” from a tag.Dependencies
rel
keywords toA
elements. #9252assertEqualHTML()
inwp_rel_nofollow()
tests. #9251assertEqualHTML
inwp_rel_ugc()
tests. #9255assertEqualHTML()
inwp_kses()
tests. #9257assertEqualHTML()
in post filtering tests. #9258oEmbed
filtering tests. #9259assertEqualHTML()
in media tests. #9264