From 5318f95afc26e7531100298c1a2ce022ed3ae6f7 Mon Sep 17 00:00:00 2001
From: Luke Brookhart
Date: Wed, 23 Nov 2011 13:43:45 -0500
Subject: [PATCH] Add check for data-placeholder being explicitly set to false
each select option. Also remove getAttribute('value') in favor of $this.val()
---
js/jquery.mobile.forms.select.custom.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/js/jquery.mobile.forms.select.custom.js b/js/jquery.mobile.forms.select.custom.js
index 385e44182fa..0d0746b1556 100644
--- a/js/jquery.mobile.forms.select.custom.js
+++ b/js/jquery.mobile.forms.select.custom.js
@@ -413,6 +413,7 @@
var $this = $( this ),
$parent = $this.parent(),
text = $this.getEncodedText(),
+ value = $this.val(),
anchor = ""+ text +"",
classes = [],
extraAttrs = [];
@@ -429,8 +430,8 @@
}
// Find placeholder text
- // TODO: Are you sure you want to use getAttribute? ^RW
- if ( !this.getAttribute( "value" ) || text.length == 0 || $this.jqmData( "placeholder" ) ) {
+ // First confirm that data-placeholder wasn't explicitly set to false, then check if the value or text is blank
+ if ( $this.jqmData( "placeholder" ) !== false && ( value.length == 0 || text.length == 0 || $this.jqmData( "placeholder" ) ) ) {
if ( o.hidePlaceholderMenuItems ) {
classes.push( "ui-selectmenu-placeholder" );
}