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

ampersand-input-view

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-input-view - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

17

ampersand-input-view.js

@@ -24,2 +24,3 @@ var domify = require('domify');

this.value = opts.value || '';
this.originalValue = opts.value || '';
this.el = opts.el;

@@ -42,5 +43,5 @@ this.template = opts.template || template;

this.handleBlur = this.handleBlur.bind(this);
this.handleInputEvent = this.handleInputEvent.bind(this);
this.handleInputChanged = this.handleInputChanged.bind(this);
this.input.addEventListener('blur', this.handleBlur, false);
this.input.addEventListener('input', this.handleInputEvent, false);
this.input.addEventListener('input', this.handleInputChanged, false);

@@ -55,3 +56,3 @@ // tests for validity

TextInputView.prototype.remove = function () {
this.input.removeEventListener('input', this.handleInputEvent, false);
this.input.removeEventListener('input', this.handleInputChanged, false);
this.input.removeEventListener('blur', this.handleBlur, false);

@@ -63,3 +64,5 @@ var parent = this.el.parentNode;

// handle input events and show appropriate errors
TextInputView.prototype.handleInputEvent = function () {
TextInputView.prototype.handleInputChanged = function () {
// track whether user has edited directly
if (document.activeElement === this.input) this.directlyEdited = true;
this.value = this.input.value;

@@ -71,2 +74,8 @@ this.edited = true;

// Expose a method for explicitly setting the value
TextInputView.prototype.setValue = function (value, runValidation) {
this.input.value = value;
this.handleInputChanged();
};
// set the error message if exists

@@ -73,0 +82,0 @@ // hides the message container entirely otherwise

{
"name": "ampersand-input-view",
"description": "A view module for intelligently rendering and validating input. Works well with ampersand-form-view.",
"version": "0.2.1",
"version": "0.3.0",
"author": "Henrik Joreteg <henrik@andyet.net>",

@@ -6,0 +6,0 @@ "bugs": {

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