Skip to content

Commit

Permalink
Fix for assignment of reverse reference on init
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyjb committed Mar 17, 2018
1 parent 3ab7970 commit ecf849e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions module/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit ecf849e

Please sign in to comment.