Skip to content

Instantly share code, notes, and snippets.

@matflores
Created April 7, 2011 17:40
Show Gist options
  • Save matflores/908277 to your computer and use it in GitHub Desktop.
Save matflores/908277 to your computer and use it in GitHub Desktop.
IE Fixes
From b89f9514facc348091074ca360e57a5ef9ab94e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C3=ADas=20Flores?= <mflores@atlanware.com>
Date: Thu, 7 Apr 2011 14:36:16 -0300
Subject: [PATCH 1/2] Add missing semi-colons
---
ui.watermark.js | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/ui.watermark.js b/ui.watermark.js
index c97bcbc..ceb37d5 100644
--- a/ui.watermark.js
+++ b/ui.watermark.js
@@ -7,7 +7,7 @@
$.widget("ui.watermark", {
_init: function() {
- if ($.ui.watermark.nativePlaceholderSupported) return this.element
+ if ($.ui.watermark.nativePlaceholderSupported) return this.element;
var watermark = this;
@@ -33,10 +33,10 @@ $.widget("ui.watermark", {
});
window.onbeforeunload = function() {
- watermark.elements().each(watermark.handlerOff);
+ watermark.elements.each(watermark.handlerOff);
}
- return this.element
+ return this.element;
},
refresh: function() {
@@ -44,7 +44,7 @@ $.widget("ui.watermark", {
},
handlerOn: function() {
- var placeholder = this.getAttribute("placeholder")
+ var placeholder = this.getAttribute("placeholder");
if (placeholder && placeholder != '' && (this.value == '' || this.value == placeholder)) {
$(this).addClass("watermark");
@@ -59,7 +59,7 @@ $.widget("ui.watermark", {
},
handlerOff: function() {
- var placeholder = this.getAttribute("placeholder")
+ var placeholder = this.getAttribute("placeholder");
if (this.type == 'text' || this.type == 'textarea') {
if (this.value == placeholder && placeholder && placeholder != '') {
--
1.7.4.1
From 1d5b43f4eaa6ad81424e0d0970497844f2782c2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C3=ADas=20Flores?= <mflores@atlanware.com>
Date: Thu, 7 Apr 2011 14:38:09 -0300
Subject: [PATCH 2/2] Ignore watermark value when setting defaultValue
---
ui.watermark.js | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/ui.watermark.js b/ui.watermark.js
index ceb37d5..01dfd5c 100644
--- a/ui.watermark.js
+++ b/ui.watermark.js
@@ -19,7 +19,9 @@ $.widget("ui.watermark", {
this.elements.each(function() {
this.ignoreDefaultValue = ignoreDefaultValue;
- this.defaultValue = this.value;
+ if (!$(this).hasClass("watermark")) {
+ this.defaultValue = this.value;
+ }
});
this.elements.focus(this.handlerOff);
--
1.7.4.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment