Recently in the development with the ANGULARJS encountered a supernatural event, from a website copy of the seemingly incomparable correct code run always error.
Experience tells us that the code that looks right may not actually be correct. I mean at the character level. There may be garbled characters, there are strange white space character, these will cause problems.
However, I examined it carefully, did not find garbled and extra space. The only exception is that the code coloring of Angularjs's interpolated string {{XXX}} In Visual Studio is not quite right. When the latest web tool for VS is installed, xxx in this interpolation string should be recognized by the editor and displayed in purple, {{and}} will appear bold, but they still appear blue in the pasted code, as in normal HTML attribute.
I didn't take it at first, thinking it was just a minor bug in vs. But after all the desperate, I began to re-examine the anomaly. I think the target is locked when I try to hit a {{{} In-place hand and observe the correct bold and coloring.
I copied this hand to play {{and paste instead of the original "{{", the coloring will be normal. After replacing all of the interpolated strings, the program runs completely normal.
Obviously, this looks exactly the same as "{{" is a different character. Verify equality in chrome console and return FALSE.
But in this step, my thinking has not yet reached. I infer that at least one of them is different. Check with charCodeAt () function, sure enough, charCodeAt (0) is 123, this is the normal {sign; charCodeAt (1) return 8203, what a ghost! Is it {The twin brother?
No. After finding the information, this character is called zero width space, Chinese can be called "0 wide blank". See here I realize that I have been cheated before, the evil string actually not you see the two characters, but three. See also Wikipedia
Http://zh.wikipedia.org/wiki/%E7%A9%BA%E6%A0%BC
The 8203 character is the u+200b.
An interesting Jsfuck-style application see
http://ucren.com/blog/archives/549
http://mn.tn/dev/z.js/
This character has no effect in the mainstream text editor, like a ghost that is invisible and cannot be touched. I generally used to let the text editor display white space characters, to distinguish between ordinary blanks, tabs, line breaks, etc., but encountered this 0 wide blank, I was really kneeling.
Ghostly presence: 0 wide Blank