#3525 - $util.url is naive

This is a spacer post for a website comment topic. The content this topic relates to: #3525 - $util.url is naive
Fixed by https://github.com/ocproducts/composr/commit/6808c50844db063cc1a0dda2171c38cbb1eca8f0

I introduced a new function called $util.rel() for producing root-relative URLs and used it throughout the JS where appropriate. $util.url() is a general purpose function that returns a "URL"[1] instance, which can be used for URL manipulation, modifying the query string etc. but unfortunately it only works with absolute URLs.


The reason for using the tempcode {$BASE_URL} in $util.url() is to avoid UTIL.js having any dependency on CMS.js. $cms.getBaseUrl() would work too, should I switch?

1: https://developer.mozilla.org/en-US/docs/Web/API/URL
That sounds fine. " $cms.getBaseUrl() would work too, should I switch?" - no, your decision sounds fine.
0 guests and 0 members have recently viewed this.