Summary: | Web Inspector: caret moves past prompt in javascript console | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Pavel Feldman <pfeldman> | ||||||||
Component: | Web Inspector (Deprecated) | Assignee: | Alexander Pavlov (apavlov) <apavlov> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | adele, commit-queue, joepeck, justin.garcia, timothy | ||||||||
Priority: | P3 | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||
Hardware: | All | ||||||||||
OS: | All | ||||||||||
Attachments: |
|
Description
Pavel Feldman
2009-06-22 02:47:56 PDT
The style on the console-prompt is: -webkit-user-modify: read-write-plaintext-only; min-height: 16px; padding: 1px 22px 1px 24px; position: relative; white-space: pre-wrap; So there is always 24px of padding on the left. I'm guessing that the proprietary "-webkit-user-modify: read-write-plaintext-only" could be causing the problem by incorrectly working with backspace and padding? Attempting to change to margin-left didn't work either. This smells like an editing bug. I actually hit this today doing a demo. Created attachment 51022 [details]
[PATCH] Proposed solution
Can you explain how this fixes the bug in the ChangeLog? Created attachment 51037 [details]
[PATCH] Manual removal of empty Text nodes
Comment on attachment 51037 [details] [PATCH] Manual removal of empty Text nodes > + var sibling = this.element.firstChild; > + while (sibling) { > + var nextSibling = sibling.nextSibling; > + if (sibling.nodeName === "#text" && sibling.nodeValue === "") > + sibling.parentNode.removeChild(sibling); > + sibling = nextSibling; > + } > + > prefixTextNode.parentNode.insertBefore(this.autoCompleteElement, prefixTextNode.nextSibling); What prevent prefixTextNode from being one of the pruned nodes? Maybe this can be put into a helper function in utilities. Is this the only place it needs to be called? Comment on attachment 51037 [details] [PATCH] Manual removal of empty Text nodes > + if (sibling.nodeName === "#text" && sibling.nodeValue === "") Use nodeType === Node.TEXT_NODE instead. Created attachment 51042 [details]
[PATCH] Comments addressed, explanation added to ChangeLog
(In reply to comment #6) > (From update of attachment 51037 [details]) > > + var sibling = this.element.firstChild; > > + while (sibling) { > > + var nextSibling = sibling.nextSibling; > > + if (sibling.nodeName === "#text" && sibling.nodeValue === "") > > + sibling.parentNode.removeChild(sibling); > > + sibling = nextSibling; > > + } > > + > > prefixTextNode.parentNode.insertBefore(this.autoCompleteElement, prefixTextNode.nextSibling); > > What prevent prefixTextNode from being one of the pruned nodes? Maybe this can (a) we never show completions for an empty prefix, (b) an empty prefix can either be there from the outset (which is not the case) or after a deletion of succeeding characters (which is the case we already sanitize) > be put into a helper function in utilities. A good idea, done. > Is this the only place it needs to be called? Added a pruning call next to the other deleteContents(), to be on the safe side. Comment on attachment 51042 [details] [PATCH] Comments addressed, explanation added to ChangeLog Clearing flags on attachment: 51042 Committed r56280: <http://trac.webkit.org/changeset/56280> All reviewed patches have been landed. Closing bug. |