Merge branch 'next' of https://github.com/lhorie/mithril.js into patch-2

This commit is contained in:
impinball 2015-11-13 21:55:36 -05:00
commit 37266a2b8f
9 changed files with 30 additions and 25 deletions

View file

@ -84,7 +84,7 @@
}], }],
"space-before-keywords": 2, "space-before-keywords": 2,
"space-in-parens": 2, "space-in-parens": 2,
"space-infix-ops": [2, {"int32Hint": false}], "space-infix-ops": [2, {"int32Hint": true}],
"space-unary-ops": 2, "space-unary-ops": 2,
"spaced-comment": [2, "always"], "spaced-comment": [2, "always"],
"max-depth": [2, 4], "max-depth": [2, 4],

View file

@ -1,7 +1,8 @@
/* eslint-env node */ /* eslint-env node */
module.exports = function (grunt) { // eslint-disable-line module.exports = function (grunt) { // eslint-disable-line
var version = "0.2.1"
var pkg = grunt.file.readJSON("package.json")
var currentYear = grunt.template.today("yyyy")
var inputFolder = "./docs" var inputFolder = "./docs"
var tempFolder = "./temp" var tempFolder = "./temp"
var archiveFolder = "./archive" var archiveFolder = "./archive"
@ -72,7 +73,7 @@ module.exports = function (grunt) { // eslint-disable-line
makeTasks("guide", guide) makeTasks("guide", guide)
makeTasks("api", api) makeTasks("api", api)
var currentVersionArchiveFolder = archiveFolder + "/v" + version var currentVersionArchiveFolder = archiveFolder + "/v" + pkg.version
grunt.initConfig({ grunt.initConfig({
// Keep this in sync with the .eslintignore // Keep this in sync with the .eslintignore
@ -107,10 +108,10 @@ module.exports = function (grunt) { // eslint-disable-line
options: { options: {
banner: [ banner: [
"/*", "/*",
"Mithril v" + version, "Mithril v" + pkg.version,
"http://github.com/lhorie/mithril.js", pkg.homepage,
"(c) Leo Horie", "(c) 2014-" + currentYear + " " + pkg.author.name,
"License: MIT", "License: " + pkg.license,
"*/", "*/",
].join("\n"), ].join("\n"),
sourceMap: true, sourceMap: true,
@ -135,7 +136,7 @@ module.exports = function (grunt) { // eslint-disable-line
force: true, force: true,
patterns: [ patterns: [
{match: /\.md/g, replacement: ".html"}, {match: /\.md/g, replacement: ".html"},
{match: /\$version/g, replacement: version}, {match: /\$version/g, replacement: pkg.version},
], ],
}, },
@ -232,7 +233,7 @@ module.exports = function (grunt) { // eslint-disable-line
expand: true, expand: true,
cwd: currentVersionArchiveFolder, cwd: currentVersionArchiveFolder,
src: "./**", src: "./**",
dest: outputFolder + "/archive/v" + version, dest: outputFolder + "/archive/v" + pkg.version,
}, },
}, },

View file

@ -1,6 +1,5 @@
[![JS.ORG](https://img.shields.io/badge/js.org-mithril-ffb400.svg?style=flat-square)](http://js.org) [![JS.ORG](https://img.shields.io/badge/js.org-mithril-ffb400.svg?style=flat-square)](http://js.org)
[![Join the chat at https://gitter.im/lhorie/mithril.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/lhorie/mithril.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/lhorie/mithril.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/lhorie/mithril.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Support and Consulting Services](https://s3-us-west-2.amazonaws.com/supportedsourceassets/buttons/supportandservices1.png)](http://supportedsource.org/consulting-services-and-support/Mithril)
[![Build Status](https://travis-ci.org/lhorie/mithril.js.svg?branch=master)](https://travis-ci.org/lhorie/mithril.js) [![Build Status](https://travis-ci.org/lhorie/mithril.js.svg?branch=master)](https://travis-ci.org/lhorie/mithril.js)
# Mithril # Mithril

View file

@ -419,14 +419,14 @@ Often, you will want to do some work before the component is unloaded (i.e. clea
var MyComponent = { var MyComponent = {
controller: function() { controller: function() {
return { return {
onunload = function() { onunload: function() {
console.log("unloading my component"); console.log("unloading my component");
} }
} }
}, },
view: function() { view: function() {
return m("div", "test") return m("div", "test")
}; }
}; };
m.mount(document.body, MyComponent); m.mount(document.body, MyComponent);

View file

@ -1,7 +1,7 @@
(function (global, factory) { void (function (global, factory) { // eslint-disable-line
"use strict" "use strict"
/* eslint-disable no-undef */ /* eslint-disable no-undef */
var m = factory(window) var m = factory(typeof window !== "undefined" ? window : {})
if (typeof module === "object" && module != null && module.exports) { if (typeof module === "object" && module != null && module.exports) {
module.exports = m module.exports = m
} else if (typeof define === "function" && define.amd) { } else if (typeof define === "function" && define.amd) {
@ -510,7 +510,10 @@
editable.innerHTML = data editable.innerHTML = data
} else { } else {
// was a trusted string // was a trusted string
if (nodes[0].nodeType === 1 || nodes.length > 1) { if (nodes[0].nodeType === 1 ||
nodes.length > 1 ||
(nodes[0].nodeValue.trim && !nodes[0].nodeValue.trim())
) {
clear(cached.nodes, cached) clear(cached.nodes, cached)
nodes = [$document.createTextNode(data)] nodes = [$document.createTextNode(data)]
} }

2
mithril.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -44,8 +44,8 @@ var ContactsWidget = {
}, },
view: function(ctrl) { view: function(ctrl) {
return [ return [
m.module(ContactForm), m.component(ContactForm),
m.module(ContactList) m.component(ContactList)
] ]
} }
} }

View file

@ -2,10 +2,18 @@
"name": "mithril", "name": "mithril",
"description": "Mithril.js beta build - use this to help us test the releases before they are released", "description": "Mithril.js beta build - use this to help us test the releases before they are released",
"version": "0.2.1", "version": "0.2.1",
"homepage": "http://mithril.js.org",
"license": "MIT",
"author": {
"name": "Leo Horie"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git@github.com:lhorie/mithril.js.git" "url": "git@github.com:lhorie/mithril.js.git"
}, },
"bugs": {
"url" : "http://github.com/lhorie/mithril.js/issues"
},
"scripts": { "scripts": {
"test": "grunt test" "test": "grunt test"
}, },
@ -33,12 +41,6 @@
"sinon": "^1.17.2", "sinon": "^1.17.2",
"sinon-chai": "^2.8.0" "sinon-chai": "^2.8.0"
}, },
"licenses": [
{
"type": "MIT",
"url": "http://opensource.org/licenses/MIT"
}
],
"files": [ "files": [
"mithril.min.js", "mithril.min.js",
"mithril.min.js.map", "mithril.min.js.map",