Bug 487250 - 'empty' attribute for textboxes with emptytext conflicts with xul templates. r=enn

This commit is contained in:
Dão Gottwald 2009-04-23 08:57:38 +02:00
Родитель fc1e6ae42b
Коммит abb52edb29
10 изменённых файлов: 22 добавлений и 26 удалений

Просмотреть файл

@ -38,7 +38,7 @@ toolbar[printpreview="true"] {
#urlbar[pageproxystate="invalid"] > #urlbar-icons > :not(#go-button) , #urlbar[pageproxystate="invalid"] > #urlbar-icons > :not(#go-button) ,
#urlbar[pageproxystate="valid"] > #urlbar-icons > #go-button , #urlbar[pageproxystate="valid"] > #urlbar-icons > #go-button ,
#urlbar[empty="true"] > #urlbar-icons > #go-button { #urlbar[isempty="true"] > #urlbar-icons > #go-button {
visibility: collapse; visibility: collapse;
} }

Просмотреть файл

@ -1352,7 +1352,7 @@ richlistitem[selected="true"][current="true"] > hbox > .ac-result-type-bookmark,
color: inherit; color: inherit;
} }
#editBMPanel_tagsField[empty="true"] { #editBMPanel_tagsField[isempty="true"] {
color: #bbb !important; color: #bbb !important;
} }

Просмотреть файл

@ -138,10 +138,6 @@
background-image: url("chrome://browser/skin/urlbar/endcap-focused-graphite-rtl.png"); background-image: url("chrome://browser/skin/urlbar/endcap-focused-graphite-rtl.png");
} }
#searchbar[empty="true"] .search-go-button {
visibility: hidden;
}
.search-go-button { .search-go-button {
padding: 1px; padding: 1px;
list-style-image: url("chrome://browser/skin/Search.png"); list-style-image: url("chrome://browser/skin/Search.png");

Просмотреть файл

@ -29,7 +29,7 @@ function doTests() {
var t1 = $("t1"); var t1 = $("t1");
t1.emptyText = 1; t1.emptyText = 1;
ok(t1.hasAttribute("empty"), "emptyText but no value => 'empty' attribute is present"); ok(t1.hasAttribute("isempty"), "emptyText but no value => 'isempty' attribute is present");
ok("1" === t1.label, "emptyText exposed as label"); ok("1" === t1.label, "emptyText exposed as label");
ok("" === t1.value, "emptyText not exposed as value"); ok("" === t1.value, "emptyText not exposed as value");
@ -38,7 +38,7 @@ function doTests() {
ok("1" === t1.emptyText, "emptyText persists after setting label"); ok("1" === t1.emptyText, "emptyText persists after setting label");
t1.value = 3; t1.value = 3;
ok(!t1.hasAttribute("empty"), "value present => 'empty' attribute not present"); ok(!t1.hasAttribute("isempty"), "value present => 'isempty' attribute not present");
ok("3" === t1.value, "value setter/getter works while emptyText is present"); ok("3" === t1.value, "value setter/getter works while emptyText is present");
ok("1" === t1.emptyText, "emptyText persists after setting value"); ok("1" === t1.emptyText, "emptyText persists after setting value");

Просмотреть файл

@ -12,20 +12,20 @@ html|*.textbox-textarea {
text-shadow: inherit; text-shadow: inherit;
} }
textbox[empty="true"] html|*.textbox-input , textbox[isempty="true"] html|*.textbox-input ,
textbox[empty="true"] html|*.textbox-textarea { textbox[isempty="true"] html|*.textbox-textarea {
text-align: left; text-align: left;
direction: ltr; direction: ltr;
} }
textbox[empty="true"][chromedir="rtl"] html|*.textbox-input , textbox[isempty="true"][chromedir="rtl"] html|*.textbox-input ,
textbox[empty="true"][chromedir="rtl"] html|*.textbox-textarea { textbox[isempty="true"][chromedir="rtl"] html|*.textbox-textarea {
text-align: right; text-align: right;
direction: rtl; direction: rtl;
} }
textbox[empty="true"] html|*.textbox-input[emptytextdelay="true"] , textbox[isempty="true"] html|*.textbox-input[emptytextdelay="true"] ,
textbox[empty="true"] html|*.textbox-textarea[emptytextdelay="true"] { textbox[isempty="true"] html|*.textbox-textarea[emptytextdelay="true"] {
color: transparent !important; color: transparent !important;
} }

Просмотреть файл

@ -55,7 +55,7 @@
</property> </property>
<property name="value" <property name="value"
onget="return this.hasAttribute('empty') ? '' : this.inputField.value;"> onget="return this.hasAttribute('isempty') ? '' : this.inputField.value;">
<setter><![CDATA[ <setter><![CDATA[
if (val) { if (val) {
// clear the emptyText _before_ setting a new non-empty value // clear the emptyText _before_ setting a new non-empty value
@ -129,7 +129,7 @@
<property name="controllers" readonly="true" onget="return this.inputField.controllers"/> <property name="controllers" readonly="true" onget="return this.inputField.controllers"/>
<property name="textLength" readonly="true" <property name="textLength" readonly="true"
onget="return this.hasAttribute('empty') ? onget="return this.hasAttribute('isempty') ?
0 : this.inputField.textLength;"/> 0 : this.inputField.textLength;"/>
<property name="selectionStart" onset="this.inputField.selectionStart = val; return val;" <property name="selectionStart" onset="this.inputField.selectionStart = val; return val;"
onget="return this.inputField.selectionStart;"/> onget="return this.inputField.selectionStart;"/>
@ -168,8 +168,8 @@
!this.value && !this.value &&
this.emptyText) { this.emptyText) {
if (!this.hasAttribute("empty")) { if (!this.hasAttribute("isempty")) {
this.setAttribute("empty", "true"); this.setAttribute("isempty", "true");
// Hide the emptytext for a bit, in case the textbox will be focused subsequently // Hide the emptytext for a bit, in case the textbox will be focused subsequently
this.inputField.setAttribute("emptytextdelay", "true"); this.inputField.setAttribute("emptytextdelay", "true");
@ -189,7 +189,7 @@
<method name="_clearEmptyText"> <method name="_clearEmptyText">
<body><![CDATA[ <body><![CDATA[
if (this.hasAttribute("empty")) { if (this.hasAttribute("isempty")) {
this.inputField.value = ""; this.inputField.value = "";
try { try {
var transactionManager = this.editor.transactionManager; var transactionManager = this.editor.transactionManager;
@ -200,7 +200,7 @@
transactionManager.numberOfRedoItems == 0) transactionManager.numberOfRedoItems == 0)
transactionManager.clear(); transactionManager.clear();
} catch (e) {} } catch (e) {}
this.removeAttribute("empty"); this.removeAttribute("isempty");
} }
]]></body> ]]></body>
</method> </method>
@ -323,7 +323,7 @@
onset="this.setAttribute('timeout', val); return val;" onset="this.setAttribute('timeout', val); return val;"
onget="return parseInt(this.getAttribute('timeout')) || 0;"/> onget="return parseInt(this.getAttribute('timeout')) || 0;"/>
<property name="value" <property name="value"
onget="return this.hasAttribute('empty') ? '' : this.inputField.value;"> onget="return this.hasAttribute('isempty') ? '' : this.inputField.value;">
<setter><![CDATA[ <setter><![CDATA[
if (val) { if (val) {
// clear the emptyText _before_ setting a new non-empty value // clear the emptyText _before_ setting a new non-empty value
@ -408,7 +408,7 @@
]]></setter> ]]></setter>
</property> </property>
<property name="value" <property name="value"
onget="return this.hasAttribute('empty') ? '' : this.inputField.value;"> onget="return this.hasAttribute('isempty') ? '' : this.inputField.value;">
<setter><![CDATA[ <setter><![CDATA[
if (val) { if (val) {
// clear the emptyText _before_ setting a new non-empty value // clear the emptyText _before_ setting a new non-empty value

Просмотреть файл

@ -60,7 +60,7 @@ textbox {
color: -moz-FieldText; color: -moz-FieldText;
} }
textbox[empty="true"] { textbox[isempty="true"] {
color: GrayText; color: GrayText;
} }

Просмотреть файл

@ -64,7 +64,7 @@ textbox {
color: -moz-FieldText; color: -moz-FieldText;
} }
textbox[empty="true"] { textbox[isempty="true"] {
color: GrayText; color: GrayText;
} }

Просмотреть файл

@ -1,5 +1,5 @@
%include textbox.css %include textbox.css
textbox[empty="true"]:-moz-system-metric(windows-default-theme) { textbox[isempty="true"]:-moz-system-metric(windows-default-theme) {
font-style: italic; font-style: italic;
} }

Просмотреть файл

@ -60,7 +60,7 @@ textbox {
color: -moz-FieldText; color: -moz-FieldText;
} }
textbox[empty="true"] { textbox[isempty="true"] {
color: GrayText; color: GrayText;
} }