p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 3.5 Basics (http://p2p.wrox.com/forumdisplay.php?f=351)
-   -   Invisible Post-processing (http://p2p.wrox.com/showthread.php?t=80574)

chroniclemaster1 August 19th, 2010 02:39 AM

Invisible Post-processing
 
I've used literal controls from time to time, especially when I need to generate some custom HTML and don't want the <span> tags around it which a label would generate. But I've never run into unexpected behavior before, literal has always simply output the string I feed it.

I'm outputting a string to a literal control. The string contains several values concatenated. Here's a snippet of the output code in an abstract class.

outputString += "<" + classTagName + getAttributes() + "/>";

In my implemented class I've defined this variable in the constructor

classTagName = "input type='radio'";

So how on earth can this produce the output...

<input ...lots of attributes... type="radio" />

The single quotes have become double quotes and the the attributes have been spliced into the middle of my string variable. Obviously, this isn't going to kill me, but I would like to know what's going on. (Before I do something that will kill my program.)

samjudson August 19th, 2010 02:48 AM

Have you tried it in different browsers? It might be the browser that is cleaning your code perhaps?

chroniclemaster1 August 19th, 2010 10:19 PM

:O OK, I thought you were drinking the koolaid, but I checked it anyway. How on earth did you figure this one!? It's a Firefox thing. So I assume that means I'm good to go and just give the Firefox XHTML an extra look before deploying anything since it may be a bit tweaked?

Here's some of the test results, check it out. In IE and Opera the output is identical but in Firefox, not so much.

Code output:
outputSelectTestsAndPagesUiOutput = "<input type='radio' id='myId' class='mighty mouse' lang='en' xml:lang='en' />";

XHTML output (as copied from view source):
<input id="myId" class="mighty mouse" xml:lang="en" lang="en" type="radio"> (Firefox 2.0)
<input id="myId" class="mighty mouse" xml:lang="en" type="radio" lang="en"> (Firefox 3.6)
<input type='radio' id='myId' class='mighty mouse' lang='en' xml:lang='en' /> (Opera 9.23)
<input type='radio' id='myId' class='mighty mouse' lang='en' xml:lang='en' /> (Opera 10.6)
<input type='radio' id='myId' class='mighty mouse' lang='en' xml:lang='en' /> (IE 6.0)
<input type='radio' id='myId' class='mighty mouse' lang='en' xml:lang='en' /> (IE 8.0)


Code output:
outputSelectTestsAndPagesUiOutput = "< id='myId' class='mighty mouse' > </ >";

XHTML output (as copied from view source):
&lt; id='myId' class='mighty mouse' &gt; <!-- --> (Firefox 2.0)
&lt; id='myId' class='mighty mouse' &gt; <!-- --> (Firefox 3.6)
< id='myId' class='mighty mouse' > </ > (Opera 9.23)
< id='myId' class='mighty mouse' > </ > (Opera 10.6)
< id='myId' class='mighty mouse' > </ > (IE 6.0)
< id='myId' class='mighty mouse' > </ > (IE 8.0)


All times are GMT -4. The time now is 01:05 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.