Skip to content

Commit

Permalink
Fix the dependency checking
Browse files Browse the repository at this point in the history
if (!(CSSParser ...)) was giving "Uncaught ReferenceError" rather than the intended error message.
  • Loading branch information
willmoffat committed Oct 8, 2010
1 parent 03f7485 commit 01ded91
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions js/parsehtmlmixed.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
var HTMLMixedParser = Editor.Parser = (function() {
if (!(CSSParser && JSParser && XMLParser))
throw new Error("CSS, JS, and XML parsers must be loaded for HTML mixed mode to work.");
XMLParser.configure({useHTMLKludges: true});

// tags that trigger seperate parsers
var triggers = {
"script": "JSParser",
"style": "CSSParser"
};

function checkDependencies() {
var parsers = ['XMLParser'];
for (var p in triggers) parsers.push(triggers[p]);
for (var i in parsers) {
if (!window[parsers[i]]) throw new Error(parsers[i] + " parser must be loaded for HTML mixed mode to work.");
}
XMLParser.configure({useHTMLKludges: true});
}

function parseMixed(stream) {
checkDependencies();
var htmlParser = XMLParser.make(stream), localParser = null, inTag = false;
var iter = {next: top, copy: copy};

Expand Down

0 comments on commit 01ded91

Please sign in to comment.