UNPKG

malevic

Version:

Malevič.js - minimalistic reactive UI library

24 lines (20 loc) 996 B
/* malevic@0.20.2 - Aug 10, 2024 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('malevic/dom')) : typeof define === 'function' && define.amd ? define(['exports', 'malevic/dom'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.Malevic = global.Malevic || {}, global.Malevic.Forms = {}), global.Malevic.DOM)); })(this, (function (exports, dom) { 'use strict'; function withForms(type) { dom.plugins.setAttribute.add(type, function (_a) { var element = _a.element, attr = _a.attr, value = _a.value; if (attr === 'value' && element instanceof HTMLInputElement) { var text = (element.value = value == null ? '' : value); element.value = text; return true; } return null; }); return type; } exports.withForms = withForms; }));