This check is pointless if `queryChar >= 0` - you already know that `fragmentChar` has to be negative, so you should use `else if`. In fact, the big `else` here block is pointless - it should be `else if` as well:

    if (queryChar >= 0 && fragmentChar >= 0)
      ...
    else if (queryChar >= 0)
      ...
    else if (fragmentChar >= 0)
      ...
    else
      this._hostPortEnd = spec.length;

Note that this also takes care of pointlessly assigning `this._hostPortEnd` to `spec.length` in cases where it should have a different value.

Nits: please put a space after `if`. Also, `queryIndex` and `fragmentIndex` would describe the value of these variables better.