Fix Custom HTML error when block is empty#8556
Conversation
| potentialIframe = potentialIframe.children[0]; | ||
| } | ||
| if ( 'IFRAME' === potentialIframe.tagName ) { | ||
| if ( potentialIframe && 'IFRAME' === potentialIframe.tagName ) { |
There was a problem hiding this comment.
So was the error caused by property access on the undefined value?
If so, shouldn't we also need to consider the .tagName property access in the condition immediately preceding this one?
There was a problem hiding this comment.
potentialIframe && potentialIframe.tagname && 'IFRAME' === potentialIframe.tagName
is that way, right?
There was a problem hiding this comment.
If so, shouldn't we also need to consider the .tagName property access in the condition immediately preceding this one?
potentialIframe isn't undefined until it's re-assigned in the condition above.
|
What is this code even doing? Can we just remove it? |
|
cc. @notnownikki |
|
@aduth |
|
Admittedly, the code to discover the first iframe is janky. Sorry about that. |
Description
Fix Custom HTML block error when block is empty and Preview button is clicked.
Closes: #7277
How has this been tested?
This has been tested with "npm test" and manually on Chrome and Firefox
Types of changes
Bug fix
Checklist: