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
- <html>
- <head>
- <title>Test</title>
- <script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
- <script type="text/javascript">
- // workaround for bug in mootools 1.4.5
- Element.NativeEvents.hashchange = 2;
- </script>
- <script type="text/javascript" src="https://github.com/downloads/bitovi/canjs/can.mootools-1.1.3.js"></script>
- <script type="text/javascript">
- window.addEvent('domready', function() {
- can.route('');
- can.route(':base');
- var Routing = can.Control({
- init: function(element, options) {
- console.log("init");
- },
- ':base route' : function(data) {
- console.log("trapped: " + data.base);
- }
- });
- myRoute = new Routing(document.body);
- if(window.location.hash.length > 2) { // handle initial page load
- window.fireEvent("hashchange"); // force hashchange event
- }
- });
- </script>
- </head>
- <body>
- </body>
- </html>