update dependencies and fix some other things

This commit is contained in:
Kent C. Dodds 2016-05-02 20:47:25 -06:00
parent 0c1b0afe31
commit ddb3b92b4b
5 changed files with 30 additions and 14 deletions

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -3,10 +3,11 @@
<head>
<meta charset="utf-8">
<title>VanillaJS • TodoMVC</title>
<script src="bundle.js"></script>
<link rel="shortcut icon" href="/favicon.ico">
<style>.hide {display: none;}</style>
</head>
<body>
<section class="todoapp">
<section class="todoapp hide">
<header class="header">
<h1>todos</h1>
<input class="new-todo" placeholder="What needs to be done?" autofocus>
@ -32,12 +33,14 @@
<button class="clear-completed">Clear completed</button>
</footer>
</section>
<footer class="info">
<footer class="info hide">
<p>Double-click to edit a todo</p>
<p>Created by <a href="http://twitter.com/oscargodson">Oscar Godson</a></p>
<p>Refactored by <a href="https://github.com/cburgmer">Christoph Burgmer</a></p>
<p>Ported to ES6 by <a href="https://twitter.com/kentcdodds">Kent C. Dodds</a></p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?ua=Mozilla/5.0%20(Windows;%20U;%20MSIE%209.0;%20WIndows%20NT%209.0;%20en-US))&features=default,Promise&flags=gated"></script>
<script src="bundle.js"></script>
</body>
</html>

View File

@ -2,7 +2,7 @@ import 'todomvc-common/base.css'
import 'todomvc-app-css/index.css'
import View from './view'
import {$on} from './helpers'
import {$on, qsa, removeClass} from './helpers'
import Controller from './controller'
import Model from './model'
import Store from './store'
@ -30,5 +30,6 @@ function setView() {
$on(window, 'load', function() {
todo = new Todo('todos-vanillajs')
setView()
removeClass(qsa('.hide'), 'hide')
})
$on(window, 'hashchange', setView)

View File

@ -1,5 +1,4 @@
/*global NodeList */
export {qs, qsa, $on, $delegate, $parent}
export {qs, qsa, removeClass, $on, $delegate, $parent}
// Get element(s) by CSS selector:
function qs(selector, scope) {
@ -8,6 +7,19 @@ function qs(selector, scope) {
function qsa(selector, scope) {
return (scope || document).querySelectorAll(selector)
}
function removeClass(el, className) {
if (el.length) {
for (var i = 0; i < el.length; i++) {
removeClass(el[i], className)
}
return
}
if (el.classList) {
el.classList.remove(className)
} else {
el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ')
}
}
// addEventListener wrapper:
function $on(target, type, callback, useCapture) {

View File

@ -6,26 +6,26 @@
},
"devDependencies": {
"babel": "6.5.2",
"babel-core": "6.7.4",
"babel-eslint": "6.0.2",
"babel-core": "6.8.0",
"babel-eslint": "6.0.4",
"babel-loader": "6.2.4",
"babel-plugin-__coverage__": "0.11111.0",
"babel-preset-es2015-webpack": "6.4.0",
"babel-plugin-__coverage__": "0.111111.1",
"babel-preset-es2015-webpack": "6.4.1",
"babel-preset-stage-2": "6.5.0",
"cross-env": "1.0.7",
"css-loader": "0.23.1",
"eslint": "2.7.0",
"eslint-config-kentcdodds": "6.1.1",
"eslint": "2.9.0",
"eslint-config-kentcdodds": "6.2.1",
"eslint-loader": "1.3.0",
"jasmine-core": "2.4.1",
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-chrome-launcher": "1.0.1",
"karma-coverage": "0.5.5",
"karma-firefox-launcher": "0.1.7",
"karma-jasmine": "0.3.8",
"karma-webpack": "1.7.0",
"style-loader": "0.13.1",
"webpack": "2.1.0-beta.4",
"webpack": "2.1.0-beta.6",
"webpack-dev-server": "2.0.0-beta"
},
"scripts": {