From ecf849e74a95bfd0e8ad5355dcfe6a375e343eae Mon Sep 17 00:00:00 2001 From: Anthony Blackshaw Date: Sat, 17 Mar 2018 15:55:06 +0000 Subject: [PATCH] Fix for assignment of reverse reference on init --- module/index.js | 7 ++++--- package.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/module/index.js b/module/index.js index 96700f0..3711481 100644 --- a/module/index.js +++ b/module/index.js @@ -50,10 +50,8 @@ export class CharacterCount { // Domain for related DOM elements this._dom = {} - // Store a reference to the input field (we also store a reverse - // reference to this instance against the input). + // Store a reference to the input field this._dom.input = input - this._dom.input._mhCharacterCount = this // Set up event handlers this._handlers = { @@ -95,6 +93,9 @@ export class CharacterCount { * Initialize the character counter. */ init() { + // Store a reference to the character count instance against the input + this._dom.input._mhCharacterCount = this + // Create the counter element const cls = this.constructor const counter = cls.behaviours.counter[this._behaviours.counter] diff --git a/package.json b/package.json index 2d25a89..6c14bbf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "manhattan-character-count", - "version": "1.0.2", + "version": "1.0.3", "description": "Add a character count to a text input or textarea.", "engines": { "node": ">=8.9.4"