       get: =>
         return @_stack[@_index]?.location || new Location(this, {})
       set: (url)=>
-        @_assign URL.resolve(@_stack[@_index]?.url, url)
+        @_assign @_resolve(url)
 
   # Called when we switch to a new page with the URL of the old page.
   _pageChanged: (was)->

  _submit: (url, method, data, enctype)->
    headers = { "content-type": enctype || "application/x-www-form-urlencoded" }
    @_stack = @_stack[0..@_index]
    url = URL.resolve(@_stack[@_index]?.url, url)
    @_stack[++@_index] = new Entry(this, url)
    @_resource @_stack[@_index].url, method, data, headers



  # ### location.href = url
  @prototype.__defineSetter__ "href", (new_url)->
    @_history._assign new_url

  # Getter/setter for location parts.
  for prop in ["hash", "host", "hostname", "pathname", "port", "protocol", "search"]
