Check out my experiment page to see the different side effects this issue causes.
If you're seeing weirdness when having hyphens in your (X)HTML comments, it's most likely because you're using two adjacent to each other, which is a big no-no according to the W3C.
Avoid using hyphens in your comments to avoid the issues... dumb, but required.
I know we're all prone to yell at Mozilla and tell them they're doing it wrong, because all the other latest versions of other browsers will still honor the comments, but Firefox isn't necessarily doing it wrong, because as I understand it, they're allowed by the standard to not honor the comment if there are two adjacent hyphens together. In one way I think it's good that Firefox doesn't, because it forces we, the web authors, to follow standards.
On the other hand, I think the standard is flawed and that nothing between the start and end of a comment should matter... so part of me wishes Firefox would do like the other browsers and still honor the comments.
Oh well, go the safe route and keep hyphens out of your comments.
ThatOneDeveloper.Document(crapIRunIntoWhileCoding).Return(BlogPostsSoIDoNotRunIntoItAgain);
Showing posts with label XHTML. Show all posts
Showing posts with label XHTML. Show all posts
2009-06-29
Ensure XHTML Strict Compliance by Removing Name Attribute from Form tag in ASP.NET
Many of us web developers are trying to be "good citizens" and conform to the higher standards of XHTML in our apps.
By default, ASP.NET will add the name="FormName" attribute to the rendered XHTML.
To force ASP.NET to omit the name attribute, simply add the following tag to the system.web section of your web.config file for your app:
Be warned, however; unfortunately it doesn't seem to make ASP.NET render HyperLinks properly. I have an asp:HyperLink that happens to have an ampersand (&) in the Text and ToolTip properties. The ToolTip properly renders a title="" attribute with the ampersand encoded as & ... but the text between the open and close <a> tags doesn't have the ampersand properly encoded.
The only advice I can give you there is to:
1. Use the word "and" instead of an ampersand
2. Make static "a" tags instead of using the ASP.NET HyperLink object, if you can. If someone knows a smoother/quicker/more elegant solution, please leave a comment with it!
By default, ASP.NET will add the name="FormName" attribute to the rendered XHTML.
To force ASP.NET to omit the name attribute, simply add the following tag to the system.web section of your web.config file for your app:
<xhtmlConformance mode="Strict" />
Be warned, however; unfortunately it doesn't seem to make ASP.NET render HyperLinks properly. I have an asp:HyperLink that happens to have an ampersand (&) in the Text and ToolTip properties. The ToolTip properly renders a title="" attribute with the ampersand encoded as & ... but the text between the open and close <a> tags doesn't have the ampersand properly encoded.
The only advice I can give you there is to:
1. Use the word "and" instead of an ampersand
2. Make static "a" tags instead of using the ASP.NET HyperLink object, if you can. If someone knows a smoother/quicker/more elegant solution, please leave a comment with it!
Subscribe to:
Comments (Atom)