Hmm, I wonder why this is always executing



  • <FONT color=#0000ff>Just to mess with one of my co-workers, who is actually really good, I'm posting one of his goofs</FONT>

    <FONT color=#0000ff>[code]
    if(Label2.Attributes["NextPage"].ToLower() != "Login.aspx")
    nextPage = Label2.Attributes["NextPage"];
    [/code]
    </FONT>

    <FONT color=#0000ff size=2><FONT color=#0000ff size=2></FONT></FONT>

  • Considered Harmful

    I don't remember seeing NextPage in the (X)HTML specs.  Nonstandard attributes make baby Jesus cry.

    Still funny to convert a string to lowercase and compare it to a Titlecase string.



  • Today's lesson is: Never case fold in web code. That way only leads to confusion.

    Thank you. 



  • @campkev said:

    <font color="#0000ff">Just to mess with one of my co-workers, who is actually really good, I'm posting one of his goofs</font>

    <font color="#0000ff">[code]
    if(Label2.Attributes["NextPage"].ToLower() != "Login.aspx")
    nextPage = Label2.Attributes["NextPage"];
    [/code]
    </font>

    <font color="#0000ff" size="2"><font color="#0000ff" size="2"></font></font>

    That code makes me feel sad. In fact, you might even say, I feel blue... :)



  • @joe.edwards@imaginuity.com said:

    I don't remember seeing NextPage in the (X)HTML specs.  Nonstandard attributes make baby Jesus cry.

    Still funny to convert a string to lowercase and compare it to a Titlecase string.

    I thought that the point of xhtml was that you COULD make things up?



  • @joe.edwards@imaginuity.com said:

    I don't remember seeing NextPage in the (X)HTML specs.  Nonstandard attributes make baby Jesus cry.

    Nothing in the code sample suggests that "Label2" is a DOM object. Programmers who jump to conclusions make baby Jesus cry.
     



  • I thought that the point of xhtml was that you COULD make things up?

    I believe that's the difference between XHTML 1.x and XHTML 2.0.

    1.x seems (from as much as I have understood) to be little more than a XML rendition of HTML. It uses XML as the underlying data format but is nevertheless not really extensible beyond what HTML offers (in the XML sense at least) and even comes with a "you shall not have any namespaces other than me" policy.

    2.0 however is fundamentally different, rebuild almost from scratch. Functionalities are organized into different modules, each with its own namespace. The same way, the language can simply be expanded with custom XML markup or with other languages, RDF for example. While in theory that would make the language incredibly clean and flexible, it comes at the cost of completely breaking the web as it is. Which is one of the reasons that it propably never will be used in its current form, despite sticking around for several years already...



  • @joe.edwards@imaginuity.com said:

    I don't remember seeing NextPage in the (X)HTML specs.  Nonstandard attributes make baby Jesus cry.

    Maybe they supplied their own DTD based off of the W3C version, which defined NextPage as a valid entity.


  • Considered Harmful

    @Zylon said:

    @joe.edwards@imaginuity.com said:

    I don't remember seeing NextPage in the (X)HTML specs.  Nonstandard attributes make baby Jesus cry.

    Nothing in the code sample suggests that "Label2" is a DOM object. Programmers who jump to conclusions make baby Jesus cry.
     

    Perhaps the ".aspx" in the code and the fact that System.Web.UI.WebControls.Label in ASP.NET is rendered to (X)HTML.



  • @PSWorx said:

    I thought that the point of xhtml was that you COULD make things up?

    I believe that's the difference between XHTML 1.x and XHTML 2.0.

    It shouldn't matter what version of XHTML is involved, it's still just XML. To be valid XML however, you should at least define your own namespace in the top-level tag for use with your own tags or attributes:

    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wtf="http://worsethanfailure.com/xml/1.0">
    ... <div wtf:nextpage="...">...



  • The Real WTF® [forgive me] is that everybody ignored that <font color="#0000ff"><font face="Lucida Console" size="2">Label2.Attributes["NextPage"].ToLower() != "Login.aspx"</font></font> will always be true and started talking about (X)HTML.



  • @CapitalT said:

    The Real WTF® [forgive me] is that everybody ignored that <font color="#0000ff"><font face="Lucida Console" size="2">Label2.Attributes["NextPage"].ToLower() != "Login.aspx"</font></font> will always be true and started talking about (X)HTML.
    I think they all found that much trivially obvious. :)



  • @Imroy said:

    @PSWorx said:

    I thought that the point of xhtml was that you COULD make things up?

    I believe that's the difference between XHTML 1.x and XHTML 2.0.

    It shouldn't matter what version of XHTML is involved, it's still just XML. To be valid XML however, you should at least define your own namespace in the top-level tag for use with your own tags or attributes:

    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wtf="http://worsethanfailure.com/xml/1.0">
    ... <div wtf:nextpage="...">...

     

    Things would be nice it it were that way but apparently the spec says differently:

    @XHTML 1.0 said:

    The XHTML namespace may be used with other XML namespaces as per XMLNS, although such documents are not strictly conforming XHTML 1.0 documents as defined above.

    That is a somewhat borderline definition in my opinion. But fact is that W3C's official validator doesn't even validate the example of the spec itself. And that seems to be enough for people to rule out that solution...



  • @CapitalT said:

    The Real WTF® [forgive me] is that everybody ignored that <font color="#0000ff"><font face="Lucida Console" size="2">Label2.Attributes["NextPage"].ToLower() != "Login.aspx"</font></font> will always be true and started talking about (X)HTML.

    No, the real WTF is that you completely missed the first two replies, which did exactly that.

     



  • @joe.edwards@imaginuity.com said:

    I don't remember seeing NextPage in the (X)HTML specs.  Nonstandard attributes make baby Jesus cry.

    No they don't.

    No really.

    In fact, they make him smile and coo, because you used a custom attribute, relevant to your operation, instead of misusing an existing one.



  • @dhromed said:

    @joe.edwards@imaginuity.com said:

    I don't remember seeing NextPage in the (X)HTML specs.  Nonstandard attributes make baby Jesus cry.

    No they don't.

    No really.

    In fact, they make him smile and coo, because you used a custom attribute, relevant to your operation, instead of misusing an existing one.


    So true...



  • thank you


Log in to reply