Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

.hideShowPassword-field not added on init #11

Closed
jbarreiros opened this issue May 6, 2014 · 2 comments
Closed

.hideShowPassword-field not added on init #11

jbarreiros opened this issue May 6, 2014 · 2 comments
Assignees
Labels

Comments

@jbarreiros
Copy link

Noticing that when a password field is initialized, class "hideShowPassword-field" is not assigned to the input element. The class is only added after clicking the toggle button for the first time.

Traced it to if (! this.options.enable || this.isType()) return false; in the updateElement function. On init, both evaluate to true.

Is this by design?

Thanks for making your plugin available.

@tylersticka tylersticka added the bug label May 7, 2014
@tylersticka tylersticka self-assigned this May 7, 2014
@tylersticka
Copy link
Member

@jbarreiros Great catch! Changes to the <input> field typically only occur when the user or dev actually changes it's state from "shown" to "hidden" (or vice-versa). But in the case of the class-name, that really decreases the usefulness of the class.

The line you identified is indeed what's preventing the class from being assigned initially, but it's also preventing unnecessary changes from occurring as the plugin is used. I think the issue is that we're adding the non-state-specific class-name within a method that is responsible for updating the state of the element, when in reality that should be part of the init() method.

Marked as a bug, will fix in a minor release as soon as we're able. Thanks for flagging this!

@tylersticka
Copy link
Member

@jbarreiros Thank you for your patience! Just pushed v2.0.2 with a fix for this. You should now notice that any <input> element manipulated by the plugin at all gets the hideShowPassword-field class (or alternatively whatever className you pass as an option).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants