You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A block that is created in Gutenberg with a start and end tag, but with no content in between, could be re-written with a self-closing tag, but it fails to pass validation.
For example, when you create an audio Gutenberg block it produces the following HTML:
See the only difference between these 2 equivalent HTML pieces of code is I moved from the <audio></audio> format to the self-closing <audio /> tag.
This is perfectly valid and equivalent HTML, but Gutenberg doesn’t like it and shows the This block appears to have been modified externally dialog.
This is a problem when opening a GB block on any HTML editor, just parsing it out and re-representing it on equivalent HTML presents this problem.
I’ve been checking a bit how this turns out to be on Gutenberg side, and found the comparison is based on method isEquivalentHTML here. What I understand that’s doing is it compares each token to an expected token, and of course it fails to find the ending token for <audio> tag, thus returning false and triggering the error dialog.
To Reproduce
Steps to reproduce the behavior:
Create a new draft and insert an audio block
Switch to HTML view mode
Remove the ending </audio> tag and close the opening tag withn />.
Switch back to visual mode
See the error dialog appears
Expected behavior
Equivalent HTML should be taken as equivalent and pass block validation. I'm not expecting very complex checks here, but a start/closing tag with nothing in between should be equivalent to a self-closing tag for all matters.
Desktop (please complete the following information):
OS: [macOS High Sierra 10.13.14]
Browser [Chrome]
Version [66.0.3359.181 ]
Additional context
Gutenberg version 2.9.2
The text was updated successfully, but these errors were encountered:
Describe the bug
A block that is created in Gutenberg with a start and end tag, but with no content in between, could be re-written with a self-closing tag, but it fails to pass validation.
For example, when you create an
audio
Gutenberg block it produces the following HTML:This is essentially equivalent to the following:
See the only difference between these 2 equivalent HTML pieces of code is I moved from the
<audio></audio>
format to the self-closing<audio />
tag.This is perfectly valid and equivalent HTML, but Gutenberg doesn’t like it and shows the
This block appears to have been modified externally
dialog.This is a problem when opening a GB block on any HTML editor, just parsing it out and re-representing it on equivalent HTML presents this problem.
I’ve been checking a bit how this turns out to be on Gutenberg side, and found the comparison is based on method
isEquivalentHTML
here. What I understand that’s doing is it compares each token to an expected token, and of course it fails to find the ending token for<audio>
tag, thus returningfalse
and triggering the error dialog.To Reproduce
Steps to reproduce the behavior:
</audio>
tag and close the opening tag withn/>
.Expected behavior
Equivalent HTML should be taken as equivalent and pass block validation. I'm not expecting very complex checks here, but a start/closing tag with nothing in between should be equivalent to a self-closing tag for all matters.
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: