-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add $outerHTML property to DOM #15887
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
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.
LGTM apart from two nits, but I'm not knowledgable enough to actually approve it. I guess feel free to merge it.
The joys of a living specification ;) Thanks for the review! I'll write the mailing list soon-ish to see if anyone objects and if I hear no complaints merge it. |
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.
It's interesting seeing the tests call saveXML()
instead of saveHTML()
.
Did you consider adding a test showing a situation where the DOM is unrepresentable?
$dom = DOM\HTMLDocument::createFromString( '<a href="#one"><p>Link</p></a>' );
$p = $dom->body->querySelector('p');
$p->outerHTML = '<a href="#two">Another Link</a>';
echo $dom->saveHTML();
// <html><head></head><body><a href="#one"><a href="#two">Another Link</a></a></body></html>
I don't know if this is worthwhile, but it could clarify that it's following the spec and producing an invalid document.
@dmsnell Thanks for the input. In the end calling saveXML or saveHTML don't really matter that much. I'll add calls for saveHTML too. The more testing the better anyway. For the same reason I'll add your test as well. |
cc60546
to
f040af8
Compare
No description provided.