@@ -1418,9 +1418,9 @@ QUnit.test( "jQuery.parseXML", function( assert ) {
14181418 }
14191419 try {
14201420 xml = jQuery . parseXML ( "<p>Not a <<b>well-formed</b> xml string</p>" ) ;
1421- assert . ok ( false , "invalid xml not detected" ) ;
1421+ assert . ok ( false , "invalid XML not detected" ) ;
14221422 } catch ( e ) {
1423- assert . strictEqual ( e . message , "Invalid XML: <p>Not a <<b>well-formed</b> xml string</p>" , "invalid xml detected" ) ;
1423+ assert . ok ( e . message . indexOf ( "Invalid XML:" ) === 0 , "invalid XML detected" ) ;
14241424 }
14251425 try {
14261426 xml = jQuery . parseXML ( "" ) ;
@@ -1436,6 +1436,29 @@ QUnit.test( "jQuery.parseXML", function( assert ) {
14361436 }
14371437} ) ;
14381438
1439+ // Support: IE 11+
1440+ // IE throws an error when parsing invalid XML instead of reporting the error
1441+ // in a `parsererror` element, skip the test there.
1442+ QUnit . testUnlessIE ( "jQuery.parseXML - error reporting" , function ( assert ) {
1443+ assert . expect ( 2 ) ;
1444+
1445+ var errorArg , lineMatch , line , columnMatch , column ;
1446+
1447+ sinon . stub ( jQuery , "error" ) ;
1448+
1449+ jQuery . parseXML ( "<p>Not a <<b>well-formed</b> xml string</p>" ) ;
1450+ errorArg = jQuery . error . firstCall . lastArg . toLowerCase ( ) ;
1451+ console . log ( "errorArg" , errorArg ) ;
1452+
1453+ lineMatch = errorArg . match ( / l i n e \s * (?: n u m b e r ) ? \s * ( \d + ) / ) ;
1454+ line = lineMatch && lineMatch [ 1 ] ;
1455+ columnMatch = errorArg . match ( / c o l u m n \s * ( \d + ) / ) ;
1456+ column = columnMatch && columnMatch [ 1 ] ;
1457+
1458+ assert . strictEqual ( line , "1" , "reports error line" ) ;
1459+ assert . strictEqual ( column , "11" , "reports error column" ) ;
1460+ } ) ;
1461+
14391462testIframe (
14401463 "document ready when jQuery loaded asynchronously (#13655)" ,
14411464 "core/dynamic_ready.html" ,
0 commit comments