DT does not count a whitespace character in the variables-view
Reported by
stefan.r...@gmail.com,
Mar 14 2016
|
|
Issue description
UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Steps to reproduce the problem:
1. Create a contenteditable div
2. Place span element with content "asd"
3. Having focus on said span, on the KeyDown event, inspect the actual content of the span according to the HTML code and print out the length of this content.
4. See that the output prints the content was of length 4 but that the variable view shows just 3 characters "asd" and not "asd "
What is the expected behavior?
See "other comments" below
What went wrong?
Developer Tool does not show correct values or leaves out whitespace characters.
Did this work before? N/A
Chrome version: 48.0.2564.116 Channel: n/a
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 21.0 r0
I am not sure if this isn't a Chrome issue but here we go:
Let tokenWrapper be a InlineLabel containing "asd" as String. Said InlineLabel lives inside a contenteditable panel div.
I am listening to he KeyDown event and capture the spacebar key-down. Since tokenWrapper has the focus at that time, it is correct that it now has 4 characters "*asd *" as content.
Inspecting the HTML code in Chrome shows:
<span class="gwt-InlineLabel" id="tokenwrap-gwt-uid-32">asd​#&8203</span>
Where the Unicode character is highlighted gray; This might indicate that this is a current change.
Inspecting the current values in the developer tool shows me this:
innerTest: "asd"
right: ""
But the actual code:
String innerText = tokenWrapper.getInnerText();
String left = innerText.substring(0, cursorPosition);
String right = innerText.substring(cursorPosition, innerText.length());
GWT.log("start..");
if(left.isEmpty() == true) {
GWT.log("Adding whitespace before: " + tokenWrapper.getId());
parentRow.insertBefore(getWhitespace(), tokenWrapper);
return;
}
if(right.isEmpty() == true) {
GWT.log("Adding whitespace after: " + tokenWrapper.getId());
Element whitespace = getWhitespace();
parentRow.insertAfter(whitespace, tokenWrapper);
return;
}
GWT.log("innerText: '" + innerText + "' len: " + innerText.length());
GWT.log("right: '" + right + "' len: " + right.length());
Outputs
start..
innertext: 'asd' len: 4
right: '' len: 1
,
Mar 16 2016
Oh. Stupid me. I guess this issue can be removed then. Thanks for the quick reply! :) |
|
►
Sign in to add a comment |
|
Comment 1 by caseq@chromium.org
, Mar 14 2016Labels: -OS-Windows Needs-Feedback OS-All
Status: WontFix (was: Unconfirmed)