VNDB fork of mithril.js
Find a file
Trent Oswald 1d6405e547 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.
2015-04-22 10:31:33 -06:00
archive Removed archive/v0.1.34/mithril-tests.js from git. 2015-04-16 23:35:41 -07:00
deploy #518 fix package.json file for cdn.js 2015-03-30 14:54:20 -04:00
docs Duplicated senteces 2015-04-15 11:10:27 +09:00
tests fix svg tests 2015-04-01 12:31:39 -04:00
.gitignore restoring state 2014-11-13 21:50:26 -05:00
.npmignore adds saucelabs integration to unit tests 2014-07-25 11:23:47 -04:00
.travis.yml Updated Travis CI config to run e2e tests 2014-05-28 23:46:09 +03:00
Gruntfile.js v0.1.34 publish 2015-03-31 12:39:12 -04:00
LICENSE Initial commit 2014-03-16 18:59:39 -07:00
mithril.closure-compiler-externs.js externs for closure compiler 2014-07-21 22:48:24 -04:00
mithril.d.ts update typescript definition 2015-03-26 22:27:31 -04:00
mithril.js Added check for this.attrs into m.route 2015-04-22 10:31:33 -06:00
mithril.min.js Added check for this.attrs into m.route 2015-04-22 10:31:33 -06:00
mithril.min.js.map v0.1.34 publish 2015-03-31 12:39:12 -04:00
package.json Install grunt explicitly to stop warnings. 2015-04-15 16:53:58 -07:00
README.md js.org badge 2015-04-17 08:14:07 -04:00

JS.ORG Join the chat at https://gitter.im/lhorie/mithril.js Build Status

Mithril

A Javascript Framework for Building Brilliant Applications

See the website for documentation

There's also a blog and a mailing list


What is Mithril?

Mithril is a client-side MVC framework - a tool to organize code in a way that is easy to think about and to maintain.

Light-weight

  • Only 5kb gzipped, no dependencies
  • Small API, small learning curve

Robust

  • Safe-by-default templates
  • Hierarchical MVC via components

Fast

  • Virtual DOM diffing and compilable templates
  • Intelligent auto-redrawing system

Sample code

//namespace
var app = {};

//model
app.PageList = function() {
	return m.request({method: "GET", url: "pages.json"});
};

//controller
app.controller = function() {
	var pages = app.PageList();
	return {
		pages: pages,
		rotate: function() {
			pages().push(pages().shift());
		}
	}
};

//view
app.view = function(ctrl) {
	return [
		ctrl.pages().map(function(page) {
			return m("a", {href: page.url}, page.title);
		}),
		m("button", {onclick: ctrl.rotate}, "Rotate links")
	];
};


//initialize
m.module(document.getElementById("example"), app);

Learn more