erikringsmuth / app-router

Router for Web Components
https://erikringsmuth.github.io/app-router/
MIT License
610 stars 83 forks source link

Logic of .go() options causes replace mode to be default #51

Closed jonvuri closed 9 years ago

jonvuri commented 9 years ago

From https://github.com/erikringsmuth/app-router/blob/v2.3.0/src/app-router.js#L111:

  AppRouter.go = function(path, options) {
    if (this.getAttribute('mode') !== 'pushstate') {
      // mode = auto or hash
      path = '#' + path;
    }
    if (options && options.replace !== true) {
      window.history.pushState(null, null, path);
    } else {
      window.history.replaceState(null, null, path);
    }
    stateChange(this);
  };

Since that block checks for the existence of options, if no options object is passed in it will default to the else block and use replace mode. Docs don't explicitly say what the default is but the example makes it seem like replace mode must be specified with the option, and that would make the most sense.

erikringsmuth commented 9 years ago

Cool! I'll get this tagged with a new version tonight.