-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngSanitize syntax error in Chrome/IE11 #11598
Comments
Can you please provide a runnable code example that shows this error? (plnkr.co etc.) This is not enough information to act on this issue. |
Interestingly, this error is only observable with the unminified angular-sanitize.js. When using angular-sanitize.min.js it is OK. <!DOCTYPE html>
<html>
<head>
<title>Angular Bug</title>
</head>
<body>
<script type="text/javascript" src="angular.js"></script>
<script type="text/javascript" src="angular-sanitize.js"></script>
</body>
</html> Open this html in Chrome, you can find error in the console. |
I can't reproduce: http://plnkr.co/edit/PaSOmNTTeXG8yq8aZfl3?p=preview Maybe your file got messed up during the download process? Edited by accident? Or maybe you've got a particular Chrome extension installed? In any case I can't reproduce it with a simple plunker. |
In the uncompressed file, there is a regex:
But in the min.js file, this regex is:
I guess there must be something wrong. |
@luanshixia yes, minification process seems to change some quote literals to their \u equivalents. Bot both regexps are still valid (at least syntactically).
Might be, but we still need a reproduce scenario. I've linked a simple plunker that represents what you've been describing (or at least my understanding of it!) and doesn't throw any errors? Could you please modify this plunk to expose the error? |
@pkozlowski-opensource just save the plunker sample to local hard drive and run. You will see that the filter does not work. At least on my machine. |
@luanshixia it still works if saved to a local file (I really don't see a reason to behave differently while saved to a local file). Does the plunker I've linked works for you?
This is why I was suggesting issues linked to your local env:
|
@pkozlowski-opensource the online sample works fine. Maybe it does have something to do with my environment, specifically the locale of Chrome. When opening/requesting the file in my Chrome (Simplified Chinese), I see messed up code in that regex. It is OK if opened in Sumlime Text. If this is true, is it possible to escape the quote marks in the source, just like the minified js? |
@luanshixia I don't think it is linked to the locale of Chrome since it would also affect Plunker version. What I think is happening that a file you've got on the local drive got corrupted somehow. You can surely send a pull request changing quotes to their respective \u equivalents but I really do think that the issue boils down to the changes in your local file. |
@pkozlowski-opensource But file is corrupted cannot explain why the messed-up code only seen in my Chrome but not my other text editors. What I know is I have experience similar situations in TFS, also related to the wide char of quote literals. Every time a check-in file contains these chars, the code will be messed up. All my colleagues confront this. We must replace the wide quote to plain quote to resolve the issue. Maybe it is an issue of Chrome or Windows, but it can be avoided. Since the wide quote is added in 1.3.x, I think just escaping is OK. |
Looks like this landed as 39ff333 |
[Message] Uncaught SyntaxError: Invalid regular expression: missing /
[File] angular-sanitize.js, Line: 619, Column: 98
[Version] 1.3.15
This error is not observed in 1.2.x.
The text was updated successfully, but these errors were encountered: