diff options
Diffstat (limited to 'src/main')
3 files changed, 23 insertions, 8 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt index ab4f7e13..0030cf9d 100644 --- a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt +++ b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt @@ -30,6 +30,7 @@ import com.github.snabbdom.eventListenersModule import com.github.snabbdom.propsModule import com.github.snabbdom.styleModule import pl.treksoft.kvision.core.Component +import pl.treksoft.kvision.utils.isIE11 import kotlin.browser.document import kotlin.dom.clear @@ -136,16 +137,20 @@ internal object KVManager { @Suppress("UnsafeCastFromDynamic") internal fun setResizeEvent(component: Component, callback: () -> Unit) { - component.getElement()?.let { - elementResizeEvent(it, callback) + if (!isIE11()) { + component.getElement()?.let { + elementResizeEvent(it, callback) + } } } @Suppress("UnsafeCastFromDynamic") internal fun clearResizeEvent(component: Component) { - if (component.getElement()?.asDynamic()?.__resizeTrigger__?.contentDocument != null) { - component.getElement()?.let { - elementResizeEvent.unbind(it) + if (!isIE11()) { + if (component.getElement()?.asDynamic()?.__resizeTrigger__?.contentDocument != null) { + component.getElement()?.let { + elementResizeEvent.unbind(it) + } } } } diff --git a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt index 7aa77bdf..5f4a243d 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/text/AbstractTextInput.kt @@ -135,9 +135,12 @@ abstract class AbstractTextInput( * Internal function */ protected open fun refreshState() { - value?.let { - getElementJQuery()?.`val`(it) - } ?: getElementJQueryD()?.`val`(null) + val v = (getElementJQuery()?.`val`() as? String) + if (v != value && !(v.isNullOrEmpty() && value == null)) { + value?.let { + getElementJQuery()?.`val`(it) + } ?: getElementJQueryD()?.`val`(null) + } } /** diff --git a/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt b/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt index 335e0415..a25d8e06 100644 --- a/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt +++ b/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt @@ -26,6 +26,7 @@ package pl.treksoft.kvision.utils import pl.treksoft.kvision.KVManager import pl.treksoft.kvision.core.CssSize import pl.treksoft.kvision.core.UNIT +import kotlin.browser.window import kotlin.js.Date /** @@ -192,3 +193,9 @@ fun String.toDateF(format: String = "YYYY-MM-DD HH:mm:ss"): Date { fun Date.toStringF(format: String = "YYYY-MM-DD HH:mm:ss"): String { return KVManager.fecha.format(this, format) } + +/** + * Utility function to detect Internet Explorer 11. + * @return true if the current browser is IE11 + */ +fun isIE11(): Boolean = window.navigator.userAgent.matches("Trident\\/7\\.") |