Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE8 for business #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions jquery.html5-placeholder-shim.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
(function($) {
// @todo Document this.
$.extend($,{ placeholder: {
//helper is a separate variable because IE8 was miss-behaving using "this"
//browser_supported(): verifies if a input accepts the placeholder
//shim(opts): applies the placeholders if the browser doesn't use them
var helper = {
browser_supported: function() {
return this._supported !== undefined ?
this._supported :
( this._supported = !!('placeholder' in $('<input type="text">')[0]) );
return helper._supported !== undefined ?
helper._supported :
( helper._supported = !!('placeholder' in $('<input type="text">')[0]) );
},
shim: function(opts) {
var config = {
Expand All @@ -13,9 +15,10 @@
selector: 'input[placeholder], textarea[placeholder]'
};
$.extend(config,opts);
return !this.browser_supported() && $(config.selector)._placeholder_shim(config);
return !helper.browser_supported() && $(config.selector)._placeholder_shim(config);
}
}});
};
$.extend($,{ placeholder: helper});

$.extend($.fn,{
_placeholder_shim: function(config) {
Expand Down
10 changes: 10 additions & 0 deletions jquery.html5-placeholder-shim.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.