Shrinking

This commit is contained in:
Yorhel 2023-07-28 08:09:46 +02:00
parent 71ce364c54
commit 679ee70117
4 changed files with 17 additions and 18 deletions

View file

@ -1,11 +1,19 @@
# Mithril.js
# VNDB Fork of Mithril.js
[![npm Version](https://img.shields.io/npm/v/mithril.svg)](https://www.npmjs.com/package/mithril)  
[![License](https://img.shields.io/npm/l/mithril.svg)](https://github.com/MithrilJS/mithril.js/blob/next/LICENSE)  
[![npm Downloads](https://img.shields.io/npm/dm/mithril.svg)](https://www.npmjs.com/package/mithril)  
[![Build Status](https://img.shields.io/travis/MithrilJS/mithril.js/next.svg?colorB=brightgreen)](https://www.npmjs.com/package/mithril)  
[![Donate at OpenCollective](https://img.shields.io/opencollective/all/mithriljs.svg?colorB=brightgreen)](https://opencollective.com/mithriljs)  
[![Zulip, join chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://mithril.zulipchat.com/)
This is a shallow fork of [mithril.js](https://mithril.js.org/) with some
functionality removed to save a few bytes. In particular:
- No routing
- No XHR wrapper
- No URL helper utilities
- 'throw' errors instead of console.error() (nothing to do with size, just makes it easier to capture errors)
There's room for further optimization, but that easily runs into diminishing
returns. This'll do for now.
(Original README below)
# Mithril.js
- [What is Mithril.js?](#what-is-mithriljs)
- [Installation](#installation)

View file

@ -9,8 +9,7 @@ module.exports = function(render, schedule, console) {
function sync() {
for (offset = 0; offset < subscriptions.length; offset += 2) {
try { render(subscriptions[offset], Vnode(subscriptions[offset + 1]), redraw) }
catch (e) { console.error(e) }
render(subscriptions[offset], Vnode(subscriptions[offset + 1]), redraw)
}
offset = -1
}

View file

@ -1,7 +1,6 @@
"use strict"
var hyperscript = require("./hyperscript")
var request = require("./request")
var mountRedraw = require("./mount-redraw")
var domFor = require("./render/domFor")
@ -11,16 +10,9 @@ m.trust = hyperscript.trust
m.fragment = hyperscript.fragment
m.Fragment = "["
m.mount = mountRedraw.mount
m.route = require("./route")
m.render = require("./render")
m.redraw = mountRedraw.redraw
m.request = request.request
m.parseQueryString = require("./querystring/parse")
m.buildQueryString = require("./querystring/build")
m.parsePathname = require("./pathname/parse")
m.buildPathname = require("./pathname/build")
m.vnode = require("./render/vnode")
m.censor = require("./util/censor")
m.domFor = domFor.domFor
module.exports = m

View file

@ -700,7 +700,7 @@ module.exports = function($window) {
if (vnode.tag === "option" && old !== null && vnode.dom.value === "" + value) return
//setting input[type=file][value] to different value is an error if it's non-empty
// Not ideal, but it at least works around the most common source of uncaught exceptions for now.
if (isFileInput && "" + value !== "") { console.error("`value` is read-only on file inputs!"); return }
if (isFileInput && "" + value !== "") { throw new Error("`value` is read-only on file inputs!"); return }
/* eslint-enable no-implicit-coercion */
}
vnode.dom[key] = value