mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 05:59:21 +03:00
Cleanup KnockoutJS a bit
This commit is contained in:
parent
4cd5774257
commit
bc6a2b67c0
4 changed files with 55 additions and 65 deletions
|
|
@ -9,7 +9,7 @@ ko.selectExtensions = {
|
|||
switch (element.nodeName) {
|
||||
case 'OPTION':
|
||||
return (element[hasDomDataExpandoProperty] === true)
|
||||
? ko.utils.domData.get(element, ko.bindingHandlers.options.optionValueDomDataKey)
|
||||
? ko.utils.domData.get(element, ko.bindingHandlers['options'].optionValueDomDataKey)
|
||||
: element.value;
|
||||
case 'SELECT':
|
||||
return element.selectedIndex >= 0
|
||||
|
|
@ -24,13 +24,13 @@ ko.selectExtensions = {
|
|||
switch (element.nodeName) {
|
||||
case 'OPTION':
|
||||
if (typeof value === "string") {
|
||||
ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, undefined);
|
||||
ko.utils.domData.set(element, ko.bindingHandlers['options'].optionValueDomDataKey, undefined);
|
||||
delete element[hasDomDataExpandoProperty];
|
||||
element.value = value;
|
||||
}
|
||||
else {
|
||||
// Store arbitrary object using DomData
|
||||
ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, value);
|
||||
ko.utils.domData.set(element, ko.bindingHandlers['options'].optionValueDomDataKey, value);
|
||||
element[hasDomDataExpandoProperty] = true;
|
||||
|
||||
// Special treatment of numbers is just for backward compatibility. KO 1.2.1 wrote numerical values to element.value.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue