Opened 8 years ago

Closed 8 years ago

#13139 closed enhancement (duplicate)

replace dojo.moduleUrl, dojo._Url with require.toUrl

Reported by: Rawld Gill Owned by: Rawld Gill
Priority: high Milestone: 1.7
Component: General Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

In v1.6- we have the API dojo.moduleUrl which returns an instance of the class dojo._Url. This is quite odd for a couple of reasons:

  • a public API is returning an instance of a supposed private class
  • every usage of dojo.moduleToUrl within dojo, dijit, dojox, and demos converts the return to a string. Sometimes this is done implicitly, sometimes tersely (+""), sometimes verbosely (.toString()).

dojo._Url in dojo/_base/url is pretty long. It's been in base a long time.

Since, with the change to using an AMD loader, dojo base isn't responsible for converting modules to URLs, dojo.moduleUrl must use the loader API, and AMD loaders include the function require.toUrl which converts a module name that ends with a filetype into the proper URL as given by the current configuration. For example,

require.toUrl("dijit/form/templates/button.html")

Relative module ids may also be used.

This ticket tracks:

  1. dojo._Url not be included in base. It remains implemented in the module dojo/_base/url for those who really need dojo._Url. This will save some precious bytes in base. An alternative is to move it to dojo/url.
  1. dojo.moduleUrl be implemented in terms of require.toUrl. This means it always returns a string.
  1. dojo.moduleUrl be deprecated. require.toUrl should be used instead.

Change History (1)

comment:1 Changed 8 years ago by Rawld Gill

Resolution: duplicate
Status: newclosed

oops...already tracking this in #13058

Note: See TracTickets for help on using tickets.