-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Conversation
@@ -240,6 +240,7 @@ PHP 8.3 UPGRADE NOTES | |||
|
|||
- DOM: | |||
. Added DOMNode::contains() and DOMNameSpaceNode::contains(). | |||
. Added DOMElement::className. |
There was a problem hiding this comment.
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...
There was a problem hiding this 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"; |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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...
ref: https://dom.spec.whatwg.org/#dom-element-classname