     element.className = element.className + " example info"
     element.textContent = "Leave empty to reset this option."
 
-  window.onbeforeunload = -> "You have unsaved changes to options." unless $("saveOptions").disabled
+  window.onbeforeunload = ->
+    unless $("saveOptions").disabled
+      return "You have unsaved changes to options."
+    return
 
   document.addEventListener "keyup", (event) ->
     if event.ctrlKey and event.keyCode == 13
-      document.activeElement.blur() if document?.activeElement?.blur
-      saveOptions()
+      if document && document.activeElement && document.activeElement.blur
+        document.activeElement.blur()
+        saveOptions()
 
   # Populate options. The constructor adds each new object to "Option.all".
   for own name, type of Options
     new type(name,onUpdated)
 
   maintainLinkHintsView()
+  return
 
 initPopupPage = ->
   chrome.tabs.query { active: true, currentWindow: true }, ([tab]) ->

    super(args...)
    @element.addEventListener "input", @onUpdated

  populateElement: (value) -> @element.value = value
  # If the new value is not empty, then return it. Otherwise, restore the default value.
  readValueFromElement: -> if value = @element.value.trim() then value else @restoreToDefault()

class CheckBoxOption extends Option
  populateElement: (value) -> @element.checked = value
  readValueFromElement: -> @element.checked

class ExclusionRulesOption extends Option

  # Base class for all option classes.
  # Abstract. Option does not define @populateElement or @readValueFromElement.

  constructor: (@field, @onUpdated) ->
    @element = $(@field)
    @element.addEventListener "change", @onUpdated
    @fetch()
