Any bool will do
-
I come across this every now and then, and chuckle when I do.
From the W3C's documentation:
#HTML <input> checked Attribute
The checked attribute is a boolean attribute.
When present, it specifies that an <input> element should be pre-selected (checked) when the page loads.
You'd think that this means that checked="true" and checked="false" would produce different results.
But with these examples.
<input type="checkbox" /> <input type="checkbox" checked /> <input type="checkbox" checked="checked" /> <input type="checkbox" checked="true" /> <input type="checkbox" checked="false" /> <input type="checkbox" checked="Brillant!" /> <input type="checkbox" checked="FILE_NOT_FOUND" /> <input type="checkbox" checked="pedantic dickweed" />
The only one that's not checked is the first one. When they say that it's a boolean attribute, it's quite literally the attribute that's boolean, not its value.
Discuss.
-
SGML is a wonderful thing which is where this madness came from.
Also, yes, checked != value, you can supply an actual value as an attribute to be submitted instead of the default 'on' in the POST.
Also also, now I can't get Jason fucking Donovan out of my head. Thanks.
-
:
If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace.The values "true" and "false" are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.
Your first three examples are valid; the rest violate the spec.
-
NSFW: https://www.youtube.com/watch?v=Qb-Kh1oJSGE
Any cock'll do!
-
#THIS IS WHY WE CAN'T HAVE NICE THINGS, PEOPLE
body is invalid
-
I can see the C# for this now:
conditional ? chkOption.checked : chkOption;
-
Well, this is disturbing.
I typed in 'any bool will do' to Google, asked for videos, the first 5 videos are 'Ganglion Cyst removal - any MCSE book will do'.
I was hoping for someone to abuse Andrew Lloyd Webber's music and replace Jason Donovan's singing with something else but noooooooooooo, instead I have this in my head:
http://www.youtube.com/watch?v=ZVsGv0e4V7I
-
<input type="checkbox" checked />
This was the original intended usage. Then the xhtml era came and they realized this isn't the valid attribute syntax. Many shits were had by the comity, until the perfect solution was found:
<input type="checkbox" checked="checked" />
And thus, the day was saved and everything was by the spec in the world. The end.
-
The "great" think is that the implementation screws up conditional logic - if you could to checked="false" or checked="true", implementing this behaviour in, sayASP.NET MVC would be a no-brainer. But no, you have to remove the entire "checked" element, which leads to ugly as sin code.
-
Clearly this came as a total shock to the team designing ASP.NET MVC. I mean, it's such a new spec, and a total departure from the history of the web, it's not like Microsoft could have possibly known that attributes would work like that.....
-
Well, Microsoft has always been pretty creative in terms of how to work with standards.
-
It's not an element, it is an attribute. While the two are both dom nodes, they are not the same.
-
Flagged for pedantry award.
-
IMHO, that's what separates languages like PHP, where you have a Rube Goldberg language to prevent breaking any old code, and a language like Python:
"Dear Python 2.x,
You just weren't right for this relationship.
Love and kisses,
Python 3.x"
-
If PHP 6 decided to break all the backwards compatibility, I don't think anybody would shed a single tear.
Filed under: Those who would can be dealt with, swiftly and with style
-
Except all the people who use WordPress who would cry. Which is a frankly scary percentage of the web.
Thing is, WordPress is in precisely the same situation.
-
They should just rename PHP to get rid of the negative connotations.
-
-
That's not a terrible idea. But any language needs to overcome the whole 'PHP is everywhere' problem if it hopes to get any traction.
-
Except all the people who use WordPress who would cry. Which is a frankly scary percentage of the web.
Thing is, WordPress is in precisely the same situation.
Someone ought to write a PHP program that automatically transforms some old PHP into idiomatic new PHP!
-
They should just rename PHP to get rid of the negative connotations.
I vote for PHP_REAL_HYPERTEXT_PREPROCESSOR TM
-
Go the KDE route
PHP = PHP Hypertext PreprocessorTM
-
In my current environment it should become new PHP or nPHP for short.
-
-
FTFYPHPS
νPHP, surely?
Stupid font. Why do you have to look like a fricking ‘v’? If I wanted it to look like that, I'd have typed it…
-
QIQ
Pronounced "quick", for maximum irony.
-
It needs a compiler. To classic Unix shell, or maybe Brainfuck.
-
"Dear Python 2.x,
You just weren't right for this relationship.
Love and kisses,Python 3.x"
from __future__ import *
-
Go the KDE routePHP = PHP Hypertext PreprocessorTM
That's just recursive. If you wanted to go KDE route, every function should start with
P
.
LikePintval()
.
-
And
Pisset()
.
-
You mean like Facebook did with HipHop or the Hack language?
-
You mean like Facebook did with HipHop or the Hack language?
Yeah, but with more WTF. Compiling to a Unix shell script is very WTFy (and yes, I know that's what much of the automake ecosystem does; my point stands).
-
-
As long as you can't import from skynet, we'll be fine.
-
```python
from future import *Do braces come included?
-
Oh look, Discourse strikes again.
-
-
Also, StackOverflow strikes again with what strikes me as a legitimate question being derided by smug people who just have to know better, with the 'best' answer being upvoted even though it clearly says it's a joke.
-
As long as you can't import from skynet, we'll be fine.
Make sure you add a suitable killer-robots.txt file to all of your websites.
-
That's old news.
-
That's old news.
I'm reasonably sure you travelled back in time just now to make that post. Please put some clothes on.
EDIT: You're welcome for the nice post badge.
-
The only time travelling I've been doing lately is to beat up bears.