context:. In the version for developing a JavaScript project, I wrote a small utility for tracking script dependencies (because I donβt like the fun syntax requirements of existing libraries). I wanted it to work in the same way as other languages, so I decided to parse the imported files for comments as follows:
Build and evaluate dependency graphs and select dependencies using jQuery $ .ajax (). This works well with top level files. However, files that remain unanswered using an ajax call are deprived of comments, so I cannot analyze the dependencies again.
For your interest: Cycle
- fetch file
- parse regular expression content for dependencies
- expand the dependency graph, if necessary
- start with (1) if (3) happened (with the necessary files, of course)
- evaluate script files in order
Q: Is there a way to stop jQuery from removing JavaScript comment tags from files uploaded by $ .ajax ()?
code: I call ajax this way
$.ajax({ url: fileName, dataType: 'text', context: this, success: function(jqXHR) { this.parseImport(fileName, jqXHR); } });
(from within the method providing fileName and that is correct). I was hoping that dataType: "text" would force jQuery to import the text literally, but, well, it is not: -D
The API document for $ .ajax () states that the contents of dataType: text elements are processed using window.String, but I'm not sure what window.String does to input it. Maybe the solution is somewhere in this part?
I would be happy if someone could point me in the right direction.
jquery ajax
waechtertroll
source share