Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Routing broken in 1.1 with Mootools

$
0
0
I posted this a while ago https://github.com/bitovi/canjs/issues/124 at it seems it's gotten "fixed" in 1.1.
However.. .after moving from 1.0.7 to 1.1.3, I cannot get routing to work.

If I manually set can.route.attr things are fine, but if the actual URL changes, nothing. Am I missing something?

See the JSFiddle attached.

Just tried a stand alone HTML file and it does not work with 1.1 and newer

  1. <html>
  2. <head>
  3. <title>Test</title>
  4. <script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
  5. <script type="text/javascript">
  6.     // workaround for bug in mootools 1.4.5
  7.     Element.NativeEvents.hashchange = 2;
  8. </script>
  9. <script type="text/javascript" src="https://github.com/downloads/bitovi/canjs/can.mootools-1.1.3.js"></script>
  10. <script type="text/javascript">
  11. window.addEvent('domready', function() {
  12. can.route('');
  13. can.route(':base');
  14. var Routing = can.Control({
  15.     init: function(element, options) {
  16.         console.log("init");
  17.     },
  18.     ':base route' : function(data) {
  19.         console.log("trapped: " + data.base);
  20.     }
  21. });
  22. myRoute = new Routing(document.body);
  23. if(window.location.hash.length > 2) { // handle initial page load
  24.     window.fireEvent("hashchange"); // force hashchange event
  25. }
  26. });
  27. </script>
  28. </head>
  29. <body>
  30. </body>
  31. </html>

Viewing all articles
Browse latest Browse all 3491

Trending Articles