Added check for this.attrs into m.route

m.route('path'), when called programmatically (not attached to an anchor
tag), did not update the url in the navigation bar. I tracked it to this
error, where it is searching for an elements attributes, sepecifically
the this.attrs.href, which did not exist when called programatically.
The error returning was "Cannot read property 'href' of undefined",
which linked back to line 618 in the mithril core file.

I added a simple check to see if this.attrs exists before calling in
.href. Fixed it like a charm. I tried to follow the current coding
style, but let me know if there is something amiss in my change.

I ran both grunt test and grunt testall and everything seemed to run
perfect.
This commit is contained in:
Trent Oswald 2015-04-22 10:31:33 -06:00
parent c5b0f068f1
commit 1d6405e547
2 changed files with 3 additions and 3 deletions

4
mithril.min.js vendored

File diff suppressed because one or more lines are too long