I am writing a custom module that uses some javascript. As I understand it for >2.0 I can put this in to view.php
$PAGE->requires->js('mod/mymodule/javascript/sr.js',true);
But this gives an error "Coding error detected, it must be fixed by a programmer: Invalid JS url, it has to be shortened url starting with / or moodle_url instance."
I changed the code by adding an initial slash:
$PAGE->requires->js('/mod/mymodule/javascript/sr.js',true);
and there is then no error. But all of the examples and details I have seen on the web use the first form (without the leading slash). Just wondering if this has changed in the most recent versions of moodle (I'm using 2.4.1)?