Odd "bug/user error" in visual studio 2013 - visual-studio-2013

I have this line of HTML
<input id="checkVSC" type="checkbox" checked data-toggle="toggle" name="checkVSC"
data-onstyle="info" data-offstyle="default" data-size="small"
data-on="<i class='icon icon-checkmark'></i> VSC"
data-off="<i class='icon icon-line-plus'></i> VSC">
for the data-on it gives me the green squiggly line saying: "If the attribute value is enclosed in quotations marks, the quotation marks must match"
This isn't a major item, but when I do Ctrl-K Ctrl-D to re-format the lines of code to make them neat and pretty it adds a ">" to the data-on attribute.
<input id="checkVSC" type="checkbox" checked data-toggle="toggle" name="checkVSC"
data-onstyle="info" data-offstyle="default" data-size="small"
**data-on="><i class='icon icon-checkmark'></i> VSC"**
data-off="<i class='icon icon-line-plus'></i> VSC">
Any one have any idea as to what is going on here and why it is doing what it is doing?

VS gets fooled because your HTML is invalid.
Attribute strings should be escaped:
data-on="<i class='icon icon-checkmark'></i> VSC"
data-off="<i class='icon icon-line-plus'></i> VSC">
To avoid such situations in the future You might try to:
enable HTML validation
try any online validator
Some other IDEs and text editors provide automatic validation and even automatic escaping as well.

Related

Workaround or fix for VS messing up Knockout binding attribute?

Whenever one of my data-bind attribute spans two lines. Visual Studio strips out all of the colons.
Has anyone else experienced this? Has anyone found a workaround or fix?
I am not sure if it is VS or some extension that I installed. Maybe Web Extensions or something.
I am currently using VS2015 I had the same issue with VS2013
You can see it most immediately when you try to copy and paste it. But then sometimes it'll just happen. I'll see a page that worked perfectly before just up and break and the reason is because VS formatted my knockoutjs binding attribute.
My most common scenario is select tags which tend to get real long.
Here is an example.
Before:
<select class="input-block-level" data-bind="value: DayId, options: $parent.availableDays,
optionsText: 'DisplayName' , optionsValue: 'Id' , optionsCaption: '--' "></select>
After:
<select class="input-block-level" data-bind=" value DayId, options $parent.availableDays,
optionsText 'DisplayName' , optionsValue 'Id' , optionsCaption '--' "></select>

Remove empty lines after Ctrl+K Ctrl+D

In VS 2012 and earlier i was able to press CTRL+K, CTRL+D which would change
<div>
<div>
<asp:TextBox runat="server" Id="Textbox1"></asp:/TextBox>
</div>
</div>
to
<div>
<div>
<asp:TextBox runat="server" Id="Textbox1"></asp:/TextBox>
</div>
</div>
So it would remove the extra lines. In VS 2013 when i do the same it doesn't format it correctly (or in the way i prefer).
I've looked under Tools but nothing that i can see that would sort the issue, i also have Productivity Power Tools installed and again no option to remove the extra lines.
Anyway around this?
Edit 1
using \n\n and \n
Under Windows, line endings are \r\n. To search for blank lines, search for ^\r\n with regular expressions on and replace with a blank string.
Note: the Replace... shown is an empty string placeholder.

Extra characters added to multiline textbox

The issue I am having is that when I create a multiline textbox, it prepends
(carriage return line feed) characters.
I am using .NET 4.5. I created an empty project with just a multiline textbox:
<asp:TextBox ID="txtTest" runat="server" TextMode="MultiLine" Rows="5" Columns="50"></asp:TextBox>
In firefox and chrome it renders as:
<textarea name="txtTest" rows="5" cols="50" id="txtTest">
</textarea>
In IE, it is fine.
Thank you in advance.
Like jmoreno suggested, changing
controlRenderingCompatibilityVersion=4.0
to
controlRenderingCompatibilityVersion=4.5
in web.config helped me.
this is fixed in .NET 4.5 RTM version. Are you using 4. RC? Connect issue fixed in RTM
The initial leading newline (LF or CRLF) of a textarea is ignored.
IE 8 and other older browsers (e.g. Firefox 3) remove the leading newline after parsing character entities.
However newer browsers removing the leading newline before parsing character entities, which then get interpreted as part of the default value of the textarea.
I don't know why .NET would generate those character entities.

Correct way to call a product page using a static block in Magento

I have a content slider setup and works correctly, but when try to add a url to the content navigation I am still seeing my placeholder (#) in the link instead of see the link. What is the correct way to call a product in a static block? I tried using something along the lines of this:
<ul id="nav1">
<li><input id="array_text_0" type="hidden" value="<li></li>"/></li>
<li><input id="array_text_1" type="hidden" value="<li></li>"/></li>
<li><input id="array_text_2" type="hidden" value="<li></li>"/></li>
</ul>
however the link does not change from (#)
I have just tested with a product at /frame.html. To link to that page in a static block I used {{store direct_url="frame.html"}} (the use of direct_url, instead of url, removes the trailing slash.)
I assume you've got caching disabled? If not, disable it and try again.
Edit: There's also the fact that you've used double-quotes to wrap the arguments and in the value. You'll either need to escape the double-quotes you're using as a value, or use single-quotes.

Xpath: Selecting checkbox and radio's via it's inner Text...are my Xpath's correct?

I find that sometimes, the value = "" is missing. So I am reverting to querying for the normalized inner Text.
<label><input type="radio" name="addThree">A Radio</label>
<label><input type="checkbox" name="hasPic"> A Checkbox </label>
Here are the xpath's respectively...Are these correct?
//label/input[normalize-space(text()) = "A Radio"]
//label/input[normalize-space(text()) = "A Checkbox"]
It should work in this case, but it is not the best way; better omit the parameter to normalize-space (which then makes it equivalent to . which is the concatenation of all text content of the input element). Using it the way you did may cause problems if there are multiple text nodes inside the input element, which may happen if you also have comments or processing instructions inside.

Resources