Skip to content

Implement DOMElement::className #11691

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

Closed
wants to merge 2 commits into from

Conversation

nielsdos
Copy link
Member

@@ -240,6 +240,7 @@ PHP 8.3 UPGRADE NOTES

- DOM:
. Added DOMNode::contains() and DOMNameSpaceNode::contains().
. Added DOMElement::className.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this in the "new functions" section, because I didn't know where to put it: there is no "new properties/fields" section...

@nielsdos nielsdos marked this pull request as draft July 12, 2023 18:18
@nielsdos nielsdos marked this pull request as ready for review July 12, 2023 18:19
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, just one comment.

var_dump($dom->documentElement->className);
$dom->documentElement->className = "é";
var_dump($dom->documentElement->className);
$dom->documentElement->className = "\0";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might need a note in UPGRADING and the docs that this is not binary safe (i.e. maybe add an example of a string like "ab\0de"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, shouldn't such invalid names possibly throw a DOM Exception like it is done in #11696 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, these characters are allowed in the value of the attribute, just not in the name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but libxml2 is not binary safe... sigh

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When/if they'll support fully HTML5-compliant parsing out of the box this problem should go away.
But for now, stepwise improvements I guess...

@nielsdos nielsdos closed this in b24b351 Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants