diff options
Diffstat (limited to 'assets/js/codemirror/addon/lint/html-lint.js')
-rw-r--r-- | assets/js/codemirror/addon/lint/html-lint.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/assets/js/codemirror/addon/lint/html-lint.js b/assets/js/codemirror/addon/lint/html-lint.js index 1e841709..dae47649 100644 --- a/assets/js/codemirror/addon/lint/html-lint.js +++ b/assets/js/codemirror/addon/lint/html-lint.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/LICENSE // Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js @@ -11,8 +11,8 @@ else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror", "htmlhint"], mod); else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { + mod(CodeMirror, window.HTMLHint); +})(function(CodeMirror, HTMLHint) { "use strict"; var defaultRules = { @@ -29,7 +29,14 @@ CodeMirror.registerHelper("lint", "html", function(text, options) { var found = []; - if (!window.HTMLHint) return found; + if (HTMLHint && !HTMLHint.verify) HTMLHint = HTMLHint.HTMLHint; + if (!HTMLHint) HTMLHint = window.HTMLHint; + if (!HTMLHint) { + if (window.console) { + window.console.error("Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run."); + } + return found; + } var messages = HTMLHint.verify(text, options && options.rules || defaultRules); for (var i = 0; i < messages.length; i++) { var message = messages[i]; |