jamesallardice / Placeholders.js

A JavaScript polyfill for the HTML5 placeholder attribute
http://jamesallardice.github.io/Placeholders.js
950 stars 232 forks source link

password field issues w/ IE9 #13

Open brettmarl opened 11 years ago

brettmarl commented 11 years ago

first of all - awesome plugin. i so want this to work :)

I'm using on a login-page (user|pass) with IE9. the password is type-input, when i fail login and bring them back to the page with value prepopulated in the input tag. eg:

it renders as a non-password input showing the value attribute, not the place holder. looks really bad as it shows the users password in the clear.

any ideas?

brettmarl commented 11 years ago

i fixed this locally by adding a value check on line 336:

if(element.value === "")
element.type = "text";

if i read the code right, this keeps my edit as a password field, but also adds the data-placeholder type password so that if i backspace out my password, it springs back to a clear-text input with the placeholder.

jamesallardice commented 11 years ago

Nice one, that's definitely a bug. If you fork the repository and commit your fix I can take a proper look at it in a pull request and merge it in to the main code base. Thanks for your help :)

becoder commented 11 years ago

It's really valuable plugin and fix my problem in graceful way.

However I got this "type=password" problem in IE8, I saw the issue #21 and #6, it seems the issue has been fixed in IE9

Doest this issue already/will be fixed in IE8?

Thanks. BR.

jamesallardice commented 11 years ago

@becoder No, there are no plans to add this functionality in IE8. As discussed in other issues, that would involve a complete change in the way the polyfill works. I do not intend to introduce new elements into the DOM, which would be the only way to do this in IE <9.

becoder commented 11 years ago

Hi @jamesallardice

Thanks for your prompt feedback.

I understand, IE is nightmare...

BTW, if we don't need to support IE<9, I am wondering whether it's possible to let the password box empty instead of set of dot. :)

Hope it will not impact source code a lot.

Thanks.

tazmaniax commented 11 years ago

I agree, probably in the case of IE8 better to leave blank then populate with text which is displayed as the dots of an existing password

jamesallardice commented 11 years ago

That is definitely an option, but I'm reluctant to make it a default as it would change the current behaviour. I will look at adding it as an configurable option though.

tazmaniax commented 11 years ago

@becoder in the end I used this project https://github.com/matoilic/jquery.placeholder because it had the specific support for password that I needed. However, the project isn't being updated as regularly so there are pros and cons - kudos to both projects.

GameScripting commented 10 years ago

This is still an issue for IE 9 (9.0.812.16421) for me

My "workaround" was to use an condition comment

<!--[if gt IE 9]>
    <script type="text/javascript" src="/content/js/Placeholders.min.js"></script>
<![endif]-->

because it's better to have no placeholders instead of clear-text passwords.

I am using knockouts data-bindings, and I think the problem should be related to knockoutjs (related: #59)