This also worked for the same problem I was seeing on WordPress 4.9.9. We were getting the same error in the wp-admin page editor for pages with snippets embedded in them. Not all scripts were affected – I have not been able to figure out why some pages were and some were not. There is no significant difference in the scripts.