Skip to content

Commit

Permalink
Backwards-incompatible change: pseudo-classes handling simplified (dr…
Browse files Browse the repository at this point in the history
…opping IE6)
  • Loading branch information
ilinsky committed Dec 24, 2013
1 parent bdb015f commit d86850b
Show file tree
Hide file tree
Showing 32 changed files with 77 additions and 140 deletions.
8 changes: 4 additions & 4 deletions ample/languages/chart/elements/map.js

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

8 changes: 4 additions & 4 deletions ample/languages/xhtml/elements/datepicker.js
Expand Up @@ -347,10 +347,10 @@ cXHTMLElement_datepicker.$getTagDays = function(oInstance, oDate) {
bDateDisabled = (oInstance.min && oDateCurrent < oInstance.min) || (oInstance.max && oDateCurrent > oInstance.max);
aHtml.push(' <td align="center" valign="center">\
<div type="button"\
class="datepicker-day' +(nWeekDay > 4 ? " datepicker-weekend" : '') + (oInstance.value && oDateCurrent.getTime() == oInstance.value.getTime() ? ' datepicker-day_selected' : '') + '\
' + (oDateToday.getDate() == oDateCurrent.getDate() && oDateToday.getMonth() == oDateCurrent.getMonth() && oDateToday.getFullYear() == oDateCurrent.getFullYear() ? ' datepicker-day_today' : '') + '\
' + (bDateDisabled ? ' datepicker-day_disabled' : '" onclick="ample.$instance(this)._onSelectDay(' + nIndex + ')') + '"\
onmouseover="this.className += \' datepicker-day_hover\'" onmouseout="this.className = this.className.replace(\' datepicker-day_hover\', \'\')"\
class="datepicker-day' +(nWeekDay > 4 ? " datepicker-weekend" : '') + (oInstance.value && oDateCurrent.getTime() == oInstance.value.getTime() ? ' selected' : '') + '\
' + (oDateToday.getDate() == oDateCurrent.getDate() && oDateToday.getMonth() == oDateCurrent.getMonth() && oDateToday.getFullYear() == oDateCurrent.getFullYear() ? ' today' : '') + '\
' + (bDateDisabled ? ' disabled' : '" onclick="ample.$instance(this)._onSelectDay(' + nIndex + ')') + '"\
onmouseover="this.className += \' hover\'" onmouseout="this.className = this.className.replace(/\\shover\\b/, \'\')"\
>' + nIndex + '</div>\
</td>');
if ((nWeekDay == 6) && (nIndex < nDays)) {
Expand Down
2 changes: 1 addition & 1 deletion ample/languages/xhtml/elements/forms/optgroup.js
Expand Up @@ -40,7 +40,7 @@ cXHTMLElement_optgroup.prototype.$getTagOpen = function() {
var sClassName = (this.prefix ? this.prefix + '-' : '') + this.localName;
return '<div class="' + sClassName +
(this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '')+
(this.hasAttribute("disabled") ? ' ' + sClassName + '_disabled' : '')+
(this.hasAttribute("disabled") ? ' ' + 'disabled' : '')+
'">\
<div class="' + sClassName + '--gap" style="height:1em;float:left"></div>\
<div class="' + sClassName + '--value">' +(this.getAttribute("label") || '')+ '</div>\
Expand Down
2 changes: 1 addition & 1 deletion ample/languages/xhtml/elements/forms/option.js
Expand Up @@ -69,7 +69,7 @@ cXHTMLElement_option.prototype.$getTagOpen = function() {
var sClassName = (this.prefix ? this.prefix + '-' : '') + this.localName;
return '<div class="' + sClassName +
(this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '')+
(this.hasAttribute("disabled") ? ' ' + sClassName + '_disabled' : '')+
(this.hasAttribute("disabled") ? ' ' + 'disabled' : '')+
'">\
<div class="' + sClassName + '--gap" style="height:1em;float:left"></div>\
<div class="' + sClassName + '--gateway">' +(this.getAttribute("label") || '');
Expand Down
4 changes: 2 additions & 2 deletions ample/languages/xhtml/elements/forms/select.js
Expand Up @@ -131,8 +131,8 @@ cXHTMLElement_select.prototype.$getTagOpen = function() {
bPopupMode = bMultiple;
return '<span class="' + sClassName + ' ' + (bMultiple ? sClassName + '-multiple-' : '') +
(this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '')+
(this.hasAttribute("required") ? ' ' + sClassName + '_required' : '')+
(this.hasAttribute("disabled") ? ' ' + sClassName + '_disabled' : '')+
(this.hasAttribute("required") ? ' ' + 'required' : '')+
(this.hasAttribute("disabled") ? ' ' + 'disabled' : '')+
'">\
<div style="position:absolute;margin-top:-2px;white-space:nowrap" class="' + sClassName + '--placeholder">' +(this.hasAttribute("placeholder") ? ample.$encodeXMLCharacters(this.getAttribute("placeholder")) : '')+ '</div>\
<div class="' + sClassName + '--field" style="position:relative;' + (bPopupMode ? 'display:none' : '') + '">\
Expand Down
2 changes: 1 addition & 1 deletion ample/languages/xhtml/elements/spinbuttons.js
Expand Up @@ -74,7 +74,7 @@ cXHTMLElement_spinbuttons.prototype.spin = function(bForward) {

// Element Render: open
cXHTMLElement_spinbuttons.prototype.$getTagOpen = function() {
return '<div class="spinbuttons' + (!this.$isAccessible() ? ' spinbuttons_disabled' : '')+ '" onmousedown="return false" onselectstart="return false">\
return '<div class="spinbuttons' + (!this.$isAccessible() ? ' disabled' : '')+ '" onmousedown="return false" onselectstart="return false">\
<div class="spinbuttons--button-up" onmouseover="if (ample.$instance(this).$isAccessible()) ample.$instance(this).$setPseudoClass(\'hover\', true, \'button-up\')" onmouseout="if (ample.$instance(this).$isAccessible()) ample.$instance(this).$setPseudoClass(\'hover\', false, \'button-up\')"><br/></div>\
<div class="spinbuttons--button-down" onmouseover="if (ample.$instance(this).$isAccessible()) ample.$instance(this).$setPseudoClass(\'hover\', true, \'button-down\')" onmouseout="if (ample.$instance(this).$isAccessible()) ample.$instance(this).$setPseudoClass(\'hover\', false, \'button-down\')"><br/></div>\
</div>';
Expand Down
18 changes: 9 additions & 9 deletions ample/languages/xhtml/themes/default/forms.css
Expand Up @@ -234,26 +234,26 @@ select:focus {
border-width: 2px;
}

input[type=file].input_focus,
input[type=checkbox].input_focus,
input[type=radio].input_focus,
input[type=range].input_focus {
input[type=file].input:focus,
input[type=checkbox].input:focus,
input[type=radio].input:focus,
input[type=range].input:focus {
background: none;
border-style: solid;
border-width: 1px;
border-radius: 2px;
}

button.button_focus,
input[type=button].input_focus,
input[type=submit].input_focus,
input[type=reset].input_focus {
button.button:focus,
input[type=button].input:focus,
input[type=submit].input:focus,
input[type=reset].input:focus {
background: none;
border: none;
margin: 1px;
}

input[type=range].input_focus {
input[type=range].input:focus {
margin-top: 5px;
margin-bottom: 5px;
}
Expand Down
2 changes: 1 addition & 1 deletion ample/languages/xul/elements/checkbox.js
Expand Up @@ -59,7 +59,7 @@ cXULElement_checkbox.prototype.$mapAttribute = function(sName, sValue) {
cXULElement_checkbox.prototype.$getTagOpen = function() {
var bChecked = this.getAttribute("checked") == "true",
bDisabled = !this.$isAccessible();
return '<div class="xul-checkbox' + (this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '') + (bDisabled ? " xul-checkbox_disabled" : "") + (bChecked ? " xul-checkbox_checked" : "") + (bChecked && bDisabled ? " xul-checkbox_checked_disabled xul-checkbox_disabled_checked" : "") + '">\
return '<div class="xul-checkbox' + (this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '') + (bDisabled ? " disabled" : "") + (bChecked ? " checked" : "") + '">\
<div class="xul-checkbox--input"><br /></div>\
<div class="xul-checkbox--label">' + (this.hasAttribute("label") ? ample.$encodeXMLCharacters(this.getAttribute("label")) : '') + '</div>';
};
Expand Down
2 changes: 1 addition & 1 deletion ample/languages/xul/elements/colorpicker.js
Expand Up @@ -122,7 +122,7 @@ cXULElement_colorpicker.prototype.$mapAttribute = function(sName, sValue) {

// Element Render: open
cXULElement_colorpicker.prototype.$getTagOpen = function() {
return '<div class="xul-colorpicker' + (this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '') + (!this.$isAccessible() ? " xul-colorpicker_disabled" : "") + '">\
return '<div class="xul-colorpicker' + (this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '') + (!this.$isAccessible() ? " disabled" : "") + '">\
<div class="xul-colorpicker--field">\
<div class="xul-colorpicker--button"><br /></div>\
<input class="xul-colorpicker--input" type="text" autocomplete="off" value="' + this.getAttribute("value") + '"' + (!this.$isAccessible() ? ' disabled="true"' : '') +' maxlength="7" onchange="ample.$instance(this)._onChange(event)" style="border:0px solid white;width:100%;" onselectstart="event.cancelBubble=true;" />\
Expand Down
8 changes: 4 additions & 4 deletions ample/languages/xul/elements/datepicker-pane.js
Expand Up @@ -318,10 +318,10 @@ cXULElement_datepicker_pane.$getTagDays = function(oInstance, oDate) {
bDateDisabled = (oInstance.min && oDateCurrent < oInstance.min) || (oInstance.max && oDateCurrent > oInstance.max);
aHtml.push(' <td align="center" valign="center">\
<div type="button"\
class="xul-datepicker-pane-day' +(nWeekDay > 4 ? " xul-datepicker-pane-weekend" : '') + (oInstance.value && oDateCurrent.getTime() == oInstance.value.getTime() ? ' xul-datepicker-pane-day_selected' : '') + '\
' + (oDateToday.getDate() == oDateCurrent.getDate() && oDateToday.getMonth() == oDateCurrent.getMonth() && oDateToday.getFullYear() == oDateCurrent.getFullYear() ? ' xul-datepicker-pane-day_today' : '') + '\
' + (bDateDisabled ? ' xul-datepicker-pane-day_disabled' : '" onclick="ample.$instance(this)._onSelectDay(' + nIndex + ')') + '"\
onmouseover="this.className += \' xul-datepicker-pane-day_hover\'" onmouseout="this.className = this.className.replace(\' xul-datepicker-pane-day_hover\', \'\')"\
class="xul-datepicker-pane-day' +(nWeekDay > 4 ? " xul-datepicker-pane-weekend" : '') + (oInstance.value && oDateCurrent.getTime() == oInstance.value.getTime() ? ' selected' : '') + '\
' + (oDateToday.getDate() == oDateCurrent.getDate() && oDateToday.getMonth() == oDateCurrent.getMonth() && oDateToday.getFullYear() == oDateCurrent.getFullYear() ? ' today' : '') + '\
' + (bDateDisabled ? ' disabled' : '" onclick="ample.$instance(this)._onSelectDay(' + nIndex + ')') + '"\
onmouseover="this.className += \' hover\'" onmouseout="this.className = this.className.replace(/\\shover\\b/, \'\')"\
>' + nIndex + '</div>\
</td>');
if ((nWeekDay == 6) && (nIndex < nDays)) {
Expand Down
2 changes: 1 addition & 1 deletion ample/languages/xul/elements/datepicker.js
Expand Up @@ -123,7 +123,7 @@ cXULElement_datepicker.prototype.$mapAttribute = function(sName, sValue) {

// component renderers
cXULElement_datepicker.prototype.$getTagOpen = function() {
return '<div class="xul-datepicker' + (this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '') + (!this.$isAccessible() ? " xul-datepicker_disabled" : "") + '"' + (this.hasAttribute("style") ? ' style="' + this.getAttribute("style") + '"' : '')+ '>\
return '<div class="xul-datepicker' + (this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '') + (!this.$isAccessible() ? " disabled" : "") + '"' + (this.hasAttribute("style") ? ' style="' + this.getAttribute("style") + '"' : '')+ '>\
<div class="xul-datepicker--field">\
<div class="xul-datepicker--button"><br /></div>\
<input class="xul-datepicker--input" type="text" maxlength="10" value="' + this.getAttribute("value") + '"' + (!this.$isAccessible() ? ' disabled="true"' : "") +' style="border:0px solid white;width:100%;" />\
Expand Down
32 changes: 16 additions & 16 deletions ample/languages/xul/elements/editor.js
Expand Up @@ -465,19 +465,19 @@ cXULElement_editor.updateButtons = function(oInstance) {
if (sCommand != "indent" && sCommand != "outdent" && sCommand != "createlink" && sCommand != "unlink" && sCommand != "undo" && sCommand != "redo") {
// Command executed
if (oDOMDocument.queryCommandState(sCommand)) {
if (!oButton.className.match(/ xul-button_active/))
oButton.className += " xul-button_active";
if (!oButton.className.match(/\sactive\b/))
oButton.className += " active";
}
else
oButton.className = oButton.className.replace(/ xul-button_active/, '');
oButton.className = oButton.className.replace(/\sactive\b/, '');
}
// Command enabled
if (!oDOMDocument.queryCommandEnabled(sCommand)) {
if (!oButton.className.match(/ xul-button_disabled/))
oButton.className += " xul-button_disabled";
if (!oButton.className.match(/\sdisabled\b/))
oButton.className += " disabled";
}
else
oButton.className = oButton.className.replace(/ xul-button_disabled/, '');
oButton.className = oButton.className.replace(/\sdisabled\b/, '');
}
// Lists
sValue = String(oDOMDocument.queryCommandValue("fontname")).replace(/^'|'$/g, '');
Expand Down Expand Up @@ -507,9 +507,9 @@ cXULElement_editor.resetButtons = function(oInstance) {
for (var nIndex = 0; nIndex < cXULElement_editor.commands[nGroup].length; nIndex++) {
oButton = oToolBar.getElementsByTagName("p")[nGroup].getElementsByTagName("button")[nIndex];
sCommand= cXULElement_editor.commands[nGroup][nIndex][0];
oButton.className = oButton.className.replace(/ xul-button_active/, '');
if (!oButton.className.match(/ xul-button_disabled/))
oButton.className += " xul-button_disabled";
oButton.className = oButton.className.replace(/\sactive\b/, '');
if (!oButton.className.match(/\sdisabled\b/))
oButton.className += " disabled";
}
oInstance._elementFontName.setAttribute("disabled", "true");
oInstance._elementFontSize.setAttribute("disabled", "true");
Expand All @@ -518,19 +518,19 @@ cXULElement_editor.resetButtons = function(oInstance) {

// presentation
cXULElement_editor.prototype.$getTagOpen = function() {
return '<div class="xul-editor' + (this.getAttribute("disabled") == "true" ? ' xul-editor_disabled' : '') + (this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '')+ '"' + (this.hasAttribute("style") ? ' style="' + this.getAttribute("style") + '"' : '')+ '>\
return '<div class="xul-editor' + (this.getAttribute("disabled") == "true" ? ' disabled' : '') + (this.hasAttribute("class") ? ' ' + this.getAttribute("class") : '')+ '"' + (this.hasAttribute("style") ? ' style="' + this.getAttribute("style") + '"' : '')+ '>\
<div class="xul-editor--toolbar" style="position:relative" xonmousedown="return false">\
<div>'+
(function(){
var aHtml = [];
for (var nGroup = 0; nGroup < 5; nGroup++) {
aHtml.push('<p class="xul-editor-buttonbar" style="display:inline' + (navigator.userAgent.match(/MSIE ([\d\.]+)/) && RegExp.$1 < 8 ? '' : '-block') + '">');
for (var nIndex = 0; nIndex < cXULElement_editor.commands[nGroup].length; nIndex++)
aHtml.push('<button class="xul-button ' + cXULElement_editor.commands[nGroup][nIndex][0] + ' xul-button_disabled" \
aHtml.push('<button class="xul-button ' + cXULElement_editor.commands[nGroup][nIndex][0] + ' disabled" \
title="' + cXULElement_editor.commands[nGroup][nIndex][2] + '"\
onclick="ample.$instance(this)._onButtonClick(\'' + cXULElement_editor.commands[nGroup][nIndex][0] + '\')"\
onmouseover="if (ample.$instance(this).$isAccessible()) this.className += \' xul-button_hover\'"\
onmouseout="if (ample.$instance(this).$isAccessible()) this.className = this.className.replace(/ xul-button_hover/, \'\')"\
onmouseover="if (ample.$instance(this).$isAccessible()) this.className += \' hover\'"\
onmouseout="if (ample.$instance(this).$isAccessible()) this.className = this.className.replace(/\\shover\\b/, \'\')"\
></button>');
aHtml.push('</p>');
}
Expand All @@ -543,11 +543,11 @@ cXULElement_editor.prototype.$getTagOpen = function() {
for (var nGroup = 5; nGroup < cXULElement_editor.commands.length; nGroup++) {
aHtml.push('<p class="xul-editor-buttonbar" style="display:inline' + (navigator.userAgent.match(/MSIE ([\d\.]+)/) && RegExp.$1 < 8 ? '' : '-block') + '">');
for (var nIndex = 0; nIndex < cXULElement_editor.commands[nGroup].length; nIndex++)
aHtml.push('<button class="xul-button ' + cXULElement_editor.commands[nGroup][nIndex][0] + ' xul-button_disabled" \
aHtml.push('<button class="xul-button ' + cXULElement_editor.commands[nGroup][nIndex][0] + ' disabled" \
title="' + cXULElement_editor.commands[nGroup][nIndex][2] + '"\
onclick="ample.$instance(this)._onButtonClick(\'' + cXULElement_editor.commands[nGroup][nIndex][0] + '\')"\
onmouseover="if (ample.$instance(this).$isAccessible()) this.className += \' xul-button_hover\'"\
onmouseout="if (ample.$instance(this).$isAccessible()) this.className = this.className.replace(/ xul-button_hover/, \'\')"\
onmouseover="if (ample.$instance(this).$isAccessible()) this.className += \' hover\'"\
onmouseout="if (ample.$instance(this).$isAccessible()) this.className = this.className.replace(/\\shover\\b/, \'\')"\
></button>');
aHtml.push('</p>');
}
Expand Down
2 changes: 1 addition & 1 deletion ample/languages/xul/elements/listbox.js
Expand Up @@ -148,7 +148,7 @@ cXULElement_listbox.sort = function(oInstance, nCell, bDir) {
cXULElement_listbox.prototype.$getTagOpen = function() {
var sHeight = this.getAttribute("height"),
sWidth = this.getAttribute("width");
return '<div class="xul-listbox' + (this.hasAttribute("class") ? " " + this.getAttribute("class") : "") + (!this.$isAccessible() ? " xul-listbox_disabled" : "") + '" style="' + (sHeight ? 'height:' + (sHeight * 1 == sHeight ? sHeight + "px" : sHeight) + ';' : '') + (sWidth ? 'width:' + (sWidth * 1 == sWidth ? sWidth + "px" : sWidth) + ';' : '') + (this.getAttribute("style") || '') + '">\
return '<div class="xul-listbox' + (this.hasAttribute("class") ? " " + this.getAttribute("class") : "") + (!this.$isAccessible() ? " disabled" : "") + '" style="' + (sHeight ? 'height:' + (sHeight * 1 == sHeight ? sHeight + "px" : sHeight) + ';' : '') + (sWidth ? 'width:' + (sWidth * 1 == sWidth ? sWidth + "px" : sWidth) + ';' : '') + (this.getAttribute("style") || '') + '">\
<div style="position:relative;height:100%;top:0;padding-bottom:inherit;">\
<div class="xul-listbox--resizer" style="height:100%;position:absolute;top:0px;display:none;z-index:1"></div>\
<table cellpadding="0" cellspacing="0" border="0" height="100%" width="100%" style="position:absolute">\
Expand Down

0 comments on commit d86850b

Please sign in to comment.