Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1005 Bytes

no-parse-xml.md

File metadata and controls

35 lines (24 loc) · 1005 Bytes

no-parse-xml

Disallows the $.parseXML utility. Prefer DOMParser#parseFromString.

📋 This rule is enabled in plugin:no-jquery/slim.

📋 This rule is enabled in plugin:no-jquery/all.

🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

Rule details

❌ Examples of incorrect code:

$.parseXML( '<b>test</b>' );

✔️ Examples of correct code:

parseXML( '<b>test</b>' );
'test'.parseXML( '<b>test</b>' );
'<b>test</b>'.parseXML;

🔧 Examples of code fixed by this rule:

$.parseXML( '<b>test</b>' ); /* → */ ( new window.DOMParser() ).parseFromString( '<b>test</b>', 'text/xml' );

Resources