Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

New post: "No errors here"

  • Loading branch information...
commit bd9de96ffc3e646e23fbbf5ec2f28aa3ecc2ce9a 1 parent 1e88f8e
Daniel Lo Nigro authored December 23, 2011

Showing 1 changed file with 41 additions and 0 deletions. Show diff stats Hide diff stats

  1. 41  _posts/2011-12-23-no-errors-here.md
41  _posts/2011-12-23-no-errors-here.md
Source Rendered
... ...
@@ -0,0 +1,41 @@
  1
+---
  2
+title: No errors here
  3
+layout: post
  4
+author: Daniel15
  5
+authorurl: http://dan.cx/
  6
+---
  7
+
  8
+{% highlight javascript %}
  9
+<script type="text/javascript">
  10
+    function handleError() {
  11
+        return true;
  12
+    }
  13
+    window.onerror = handleError;
  14
+</script>
  15
+<script type="text/javascript" language="javascript">
  16
+    function doCallback1(param1, param2, param3) {
  17
+        Callback1.Callback(param1, param2, param3);
  18
+    }
  19
+    function doCallback2(param1, param2, param3) {
  20
+        Callback1.Callback(param1, param2, param3);
  21
+        Callback2.Callback(param1, param2, param3);
  22
+        Callback3.Callback(param1, param2, param3);
  23
+    }
  24
+    function doCallback3(param1, param2, param3) {
  25
+        Callback2.Callback(param1, param2, param3);
  26
+        Callback3.Callback(param1, param2, param3);
  27
+    }
  28
+
  29
+    function InitLocation(division) {
  30
+        clbDivision.Callback(division);
  31
+    }
  32
+</script>
  33
+{% endhighlight %}
  34
+
  35
+I'm not sure what's worse - The fact that all JavaScript errors are silently ignored, doCallback2 
  36
+having three callbacks and doCallback3 having two callbacks, or the use of globals (Callback1, 
  37
+Callback2, Callback3). The same site had JavaScript functions with names like "foo" and "bar".
  38
+
  39
+As a side note, an interesting oddity in JavaScript: When you return true in the window.onerror 
  40
+handler, this prevents the default event handler. This is the opposite to all the other DOM 0 
  41
+events (such as onclick), where returning false prevents the default handler.

0 notes on commit bd9de96

Please sign in to comment.
Something went wrong with that request. Please try again.