I saw this in code. It blew my mind.
<% if (false) { %>
<script type="text/javascript" src="~/Scripts/jquery-1.3.2.js"></script>
<% } %>
This seems so patently illogical that it must be intentional. I can only assume that somehow this "came up", and somebody inserted this as a work-around. There are, of course, no comments.
Why would someone do this?
That's a trick to get Visual Studio to include the javascript Intellisense for jQuery without actually emitting the script to callers.
Here is an example from Scott Gu explaining it.
Intellisense in Visual Studio works for jQuery if you add that to every .aspx, .ascx file.
But instead of including it in every file it is included only in the masterpage.
Visual Studio parses the markup files and finds a reference to jQuery and then uses the provided intellisense on it.
You'll also need to add a vsdocs.js file into the project.
You can read more about it here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With