Chrome v65 XSTProcessor bug

We have a site which utilizes client side XSLT transformation. As Chrome browser has updated to the version 65 the transformation stopped working. The transformToDocument() method outputs error messages to the Chrome development console like "Premature end of data in tag element line ...", referring to the xsl file loaded into the XSLTProcessor object. I don't see anything wrong in the XSLT file (and the line number mentioned just does not exist).
Is it possible to get more detailed information what happens inside the XSLTProcessor object?
LVL 19
zc2Asked:
Who is Participating?
 
zc2Connect With a Mentor Author Commented:
This is definitely a bug in Chrome browser, a memory corruption or something. I found a workaround:
                        
                      try {
                            var ver = parseInt(navigator.appVersion.match( /Chrome\/(\d{2,3})/ )[1]);
                            if( ver >= 65 ) {   // chrome bug workaround
                                var parser = new DOMParser();
                                xsl = parser.parseFromString( xsl.documentElement.outerHTML, "application/xml" );
                            }
                        } catch( e ) {
                        }
                        var xsl_processor = new XSLTProcessor();
            	        xsl_processor.importStylesheet( xsl );

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.