Formatter & anonymous function

Bug Reports and Fixes
Post Reply
Victor_Homyakov
Posts: 4
Joined: Thu Jan 06, 2011 10:50 am

Formatter & anonymous function

Post by Victor_Homyakov » Thu Jan 06, 2011 12:34 pm

The following code cannot be properly formatted when using Spket formatter:

Code: Select all

(function() {
  function element(event) {
    var node = event.target;
    return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
  }

  document.on("keydown", "form#registrationForm", function formKeydownHandler(event, form) {
    if (event.stopped || event.returnValue === false) {
      return;
    }
    var keyCode = event.keyCode;
    if (keyCode == Event.KEY_PAGEUP || keyCode == Event.KEY_PAGEDOWN) {
      var e = element(event) /*event.element()*/;
      Event.stop(event);
      var next = Validator.findNextElement(form, e, keyCode == Event.KEY_PAGEUP);
      if (next) {
        next[Object.isFunction(next.activate) ? "activate" : "focus"]();
        if (next.tagName.toLowerCase() == "select") {
  //var index = next.selectedIndex;
    //console.log("Selected:", index);
    (function(select, index) {
            select.selectedIndex = index;
          }).defer(next, next.selectedIndex);
        }
      }
      return false;
    }
  });
})();
Indentation of comment and anonymous function is incorrect (too small).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest