Skip to content

Instantly share code, notes, and snippets.

@tekniklr
Created March 26, 2016 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tekniklr/b593813f1a1eaa9f1230 to your computer and use it in GitHub Desktop.
Save tekniklr/b593813f1a1eaa9f1230 to your computer and use it in GitHub Desktop.
was curious how this ( http://gizmodo.com/it-really-sucks-to-be-named-jennifer-null-1767159091 ) even happens - how does a form input validate a string value from a submitted form as equivalent to null???
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
<meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
<title>null</title>
<!-- was curious how this ( http://gizmodo.com/it-really-sucks-to-be-named-jennifer-null-1767159091 ) even happens - how does a form input validate a string value from a submitted form as equivalent to null??? -->
<script type="text/javascript">
function do_it() {
var the_thing = document.getElementById('the_thing').value;
var interpreted_thing = '';
if (the_thing == null) {
interpreted_thing = 'literally null';
} else if (the_thing == '') {
interpreted_thing = 'blank';
} else {
interpreted_thing = the_thing;
}
alert('yo, the thing is '+interpreted_thing);
}
</script>
</head>
<body>
<form>
<label for="the_thing">The thing:</label>
<input type="text" id="the_thing" />
<input type="submit" value="what" onclick="javascript:do_it(); return false;" />
</form>
</body>
</html>
@tekniklr
Copy link
Author

It seems that people on the original article are just as confused as I am! http://gizmodo.com/it-s-not-even-just-bad-programming-it-seems-like-delib-1767173941

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment