| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /** 2 * JSHINT has some GPL Compatibility issues, so we are faking it out and using esprima for validation 3 * Based on https://github.com/jquery/esprima/blob/gh-pages/demo/validate.js which is MIT licensed. 4 * This is now deprecated in favor of Espree. 5 * 6 * @since 4.9.3 7 * @deprecated 7.0.0 8 * @output wp-includes/js/codemirror/fakejshint.js 9 * @see https://core.trac.wordpress.org/ticket/42850 10 * @see https://core.trac.wordpress.org/ticket/64558 11 */ 12 13 /* jshint -W057, -W058 */ 14 var fakeJSHINT = new function() { 15 var syntax, errors; 16 var that = this; 17 this.data = []; 18 this.convertError = function( error ){ 19 return { 20 line: error.lineNumber, 21 character: error.column, 22 reason: error.description, 23 code: 'E' 24 }; 25 }; 26 this.parse = function( code ){ 27 try { 28 syntax = window.esprima.parse(code, { tolerant: true, loc: true }); 29 errors = syntax.errors; 30 if ( errors.length > 0 ) { 31 for ( var i = 0; i < errors.length; i++) { 32 var error = errors[i]; 33 that.data.push( that.convertError( error ) ); 34 } 35 } else { 36 that.data = []; 37 } 38 } catch (e) { 39 that.data.push( that.convertError( e ) ); 40 } 41 }; 42 }; 43 44 window.JSHINT = function( text ){ 45 fakeJSHINT.parse( text ); 46 }; 47 window.JSHINT.data = function(){ 48 return { 49 errors: fakeJSHINT.data 50 }; 51 }; 52 53
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Tue Jul 21 08:20:16 2026 | Cross-referenced by PHPXref |