8784: Fix test for latest firefox.
[arvados.git] / apps / workbench / app / assets / javascripts / link_to_remote.js
1 $.rails.href = function(element) {
2     if (element.is('a')) {
3         // data-remote=true links must put their remote targets in
4         // data-remote-href="..." instead of href="...".  This helps
5         // us avoid accidentally using the same href="..." in both the
6         // remote (Rails UJS) and non-remote (native browser) handlers
7         // -- which differ greatly in how they use that value -- and
8         // forgetting to test any non-remote cases like "open in new
9         // tab". If you really want copy-link-address/open-in-new-tab
10         // to work on a data-remote=true link, supply the
11         // copy-and-pastable URI in href in addition to the AJAX URI
12         // in data-remote-href.
13         //
14         // (Currently, the only places we make any remote links are
15         // link_to() in ApplicationHelper, which renames href="..." to
16         // data-remote-href="...", and select_modal, which builds a
17         // data-remote=true link on the client side.)
18         return element.data('remote-href');
19     } else {
20         // Normal rails-ujs behavior.
21         return element.attr('href');
22     }
23 }