-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The /^<!--/ regExp causes bug when injecting js to html #7298
Comments
What's the difference? |
@posva sorry for ignoring github editor's self encoding, I updated my written with '\' instead of '' |
Why would |
@posva because |
ah, I see, so it's a repro after all. What version and what browser are failing? The change is minimal but I want to make sure there's actually a problem |
vue version: 2.5.2 |
This is weird, as it should not happen unless you are inlining the entire Vue codebase inside HTML. Why would you do that? |
This is an optimization strategy for hybrid web page. There are a wide range of Android device used by our users, and most of them are lower-end, which means very low performance and network speed. For those who use these devices, the WebView native cache is not reliable, most of the time would be wasted on network requests. We found that injecting js/css files into html can effectively improve the speed when open pages, as it really reduce the RTT(Round-Trip Time) in weak-network environment. Also, we have offline packages which are supported by native app, this would be really fast that native app could prefetch html and cache them. In most circumstances, the page is loaded locally. Without the SSR(need more machine and labor costs), it would be a good practice to inject js and css files into html, to get the significant performance optimization for most users who use the lower-end phone with weak-network environment. |
escape - to avoid regex being parsed as HTML comment when entire codebase is inlined. fix #7298
escape - to avoid regex being parsed as HTML comment when entire codebase is inlined. fix vuejs#7298
escape - to avoid regex being parsed as HTML comment when entire codebase is inlined. fix vuejs#7298
escape - to avoid regex being parsed as HTML comment when entire codebase is inlined. fix vuejs#7298
Version
undefined
Reproduction link
https://jsfiddle.net/xjtumj/u04ornp4/
Steps to reproduce
when injecting vue to html, there is nothing to show in android webview.
try to replace /^<!--/ with /^<!\--/, the showing turns to be right.
suggest to escape the expression.
What is expected?
render correctly
What is actually happening?
not render correctly
The text was updated successfully, but these errors were encountered: