summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-08-31 15:10:46 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-08-31 15:10:46 -0400
commit9b46fe70de9d0e7b625649fcdde53f5b91bbb114 (patch)
tree0a53a34c90d6e618ec331c9b5b3bc231f3a10553 /ext/fg/js
parentad0dca7bb12d13545b559e9c738fcc0767ba20d5 (diff)
Fix imposter issues with <input type="text">
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/document.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index e6a16bd5..1a49521b 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -30,7 +30,7 @@ function docOffsetCalc(elementRect) {
return {top, left};
}
-function docImposterCreate(element) {
+function docImposterCreate(element, isTextarea) {
const styleProps = window.getComputedStyle(element);
const stylePairs = [];
for (const key of styleProps) {
@@ -49,8 +49,14 @@ function docImposterCreate(element) {
imposter.style.opacity = 0;
imposter.style.zIndex = 2147483646;
imposter.style.margin = '0';
- if (element.nodeName === 'TEXTAREA' && styleProps.overflow === 'visible') {
- imposter.style.overflow = 'auto';
+ if (isTextarea) {
+ if (styleProps.overflow === 'visible') {
+ imposter.style.overflow = 'auto';
+ }
+ } else {
+ imposter.style.overflow = 'hidden';
+ imposter.style.whiteSpace = 'nowrap';
+ imposter.style.lineHeight = styleProps.height;
}
document.body.appendChild(imposter);
@@ -79,8 +85,10 @@ function docRangeFromPoint(point) {
case 'BUTTON':
return new TextSourceElement(element);
case 'INPUT':
+ imposter = docImposterCreate(element, false);
+ break;
case 'TEXTAREA':
- imposter = docImposterCreate(element);
+ imposter = docImposterCreate(element, true);
break;
}
}