-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add Dom\Element::insertAdjacentHTML() #16614
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
8417dfd
to
e028a00
Compare
According to the WHATWG issue, there's indeed a spec mistake. So the implementation here is correct after all. |
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.
The code and algorithm look right to me
xmlNodePtr context = NULL; | ||
|
||
/* 3. Use the first matching item from this list: (...) */ | ||
switch (ZSTR_LEN(where) + ZSTR_VAL(where)[2]) { |
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.
wtf
(edit: yes i see it, avoid strcmp for performance~)
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.
Similar trick is done in ext/random btw if you're curious
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.
We really need a mechanism to solve this in a generic fashion. The RoundingMode enum uses the same trick.
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.
Agreed. It would be useful to be able to compare enum elements, or at least their name, by address.
Maybe we can store the address of enum elements in some struct once they are instantiated. Storing them in the zend_class_entry
would be ideal, but I'm not sure this is doable. Case classes may help with that. Alternatively we could store them in a separate struct generated in _arginfo.h
.
LGTM 👍 |
e028a00
to
64083ff
Compare
No complaints were raised on the mailing list, I'm merging this. |
Blocked by whatwg/html#10725