Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@expressen/tallahassee

Package Overview
Dependencies
Maintainers
12
Versions
207
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@expressen/tallahassee - npm Package Compare versions

Comparing version 12.1.0 to 13.0.0

lib/eventnames.js

5

CHANGELOG.md

@@ -6,2 +6,7 @@ Changelog

## 13.0.0
- `input.validate` is of type ValidationState
- `<input name="foo" required oninput="setCustomValidity('')" oninvalid="setCustomValidity('Required')">` now executes attribute event handlers
## 12.1.0

@@ -8,0 +13,0 @@

@@ -14,2 +14,4 @@ "use strict";

const NodeList = require("./NodeList");
const eventnames = require("./eventnames");
const vm = require("vm");

@@ -42,2 +44,10 @@ const classListSymbol = Symbol.for("classList");

if ($elm[0].attribs) {
for (const [name, value] of Object.entries($elm[0].attribs)) {
if (name.indexOf("on") !== 0) continue;
if (eventnames.indexOf(name.substring(2)) === -1) continue;
this[name] = vm.compileFunction(value, ["event"], { contextExtensions: [this] });
}
}
this._emitter.on("_insert", (...args) => {

@@ -44,0 +54,0 @@ if (this.parentElement) {

46

lib/HTMLInputElement.js

@@ -5,4 +5,14 @@ "use strict";

const Element = require("./Element");
const ValidityState = require("./ValidityState");
const kValidity = Symbol.for("validity");
const kValidationMessage = Symbol.for("validation message");
module.exports = class HTMLInputElement extends Element {
constructor(...args) {
super(...args);
this[kValidationMessage] = "";
this[kValidity] = new ValidityState(this);
}
get checked() {

@@ -47,2 +57,8 @@ return this.$elm.prop("checked");

}
get validationMessage() {
return this[kValidationMessage];
}
get validity() {
return this[kValidity];
}
get value() {

@@ -92,23 +108,13 @@ const value = this.getAttribute("value");

reportValidity() {
if (this.getAttribute("required") || this.value.length > 0) {
const attributes = [
["required", (val) => val.length > 0],
["min", (val, min) => val.length >= parseInt(min, 10)],
["max", (val, max) => val.length <= parseInt(max, 10)],
["pattern", (val, pattern) => new RegExp(`^(?:${pattern})$`).test(val)]
];
return attributes
.every(([key, processer]) => {
const attrVal = this.$elm.attr(key);
if (attrVal === undefined) return true;
const valid = processer(this.value, attrVal);
if (!valid) this.dispatchEvent(new Event("invalid"));
return valid;
});
}
return true;
return this.checkValidity();
}
checkValidity() {
const validity = this[kValidity];
if (!validity.valid) this.dispatchEvent(new Event("invalid", { bubbles: true }));
return validity.valid;
}
setCustomValidity(...args) {
if (!args.length) throw new TypeError(`Failed to execute 'setCustomValidity' on '${this.constructor.name}': 1 argument required, but only 0 present.`);
this[kValidationMessage] = `${args[0]}`;
}
};
{
"name": "@expressen/tallahassee",
"version": "12.1.0",
"version": "13.0.0",
"description": "Lightweight client testing framework",

@@ -38,4 +38,4 @@ "main": "index.js",

"@bonniernews/wichita": "^1.1.0",
"chai": "^4.3.6",
"eslint": "^8.26.0",
"chai": "^4.3.7",
"eslint": "^8.27.0",
"express": "^4.18.2",

@@ -42,0 +42,0 @@ "markdown-toc": "^1.2.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc