RESOLVED FIXED 99336
Web Inspector: [Elements] Double-click to live edit style tags changes text to 'undefined' in some situations
https://bugs.webkit.org/show_bug.cgi?id=99336
Summary Web Inspector: [Elements] Double-click to live edit style tags changes text t...
Alexander Pavlov (apavlov)
Reported 2012-10-15 09:04:08 PDT
1. load a page with an inline style tag inside of a div (http://jsfiddle.net/show) 2. open the inspector 3. expand the div, double click on the body styles inside of the style tag Upstreaming http://code.google.com/p/chromium/issues/detail?id=152973
Attachments
Patch (2.09 KB, patch)
2012-10-15 09:11 PDT, Alexander Pavlov (apavlov)
no flags
Patch (2.12 KB, patch)
2012-10-16 02:48 PDT, Alexander Pavlov (apavlov)
no flags
Patch (22.31 KB, patch)
2012-10-16 06:52 PDT, Alexander Pavlov (apavlov)
vsevik: review+
Alexander Pavlov (apavlov)
Comment 1 2012-10-15 09:11:36 PDT
Eric Seidel (no email)
Comment 2 2012-10-15 12:44:54 PDT
Comment on attachment 168728 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=168728&action=review > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:1327 > + container.innerText = textNode._originalContent || container.innerText; textContent is the new hotness. Why innerText (which is an IE extension) instead?
Alexander Pavlov (apavlov)
Comment 3 2012-10-15 13:06:01 PDT
(In reply to comment #2) > (From update of attachment 168728 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=168728&action=review > > > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:1327 > > + container.innerText = textNode._originalContent || container.innerText; > > textContent is the new hotness. Why innerText (which is an IE extension) instead? Thanks for the hint; it's legacy code. Is textContent far better than innerText (from the client's PoV) and is it worth migrating to the former? AFAIK, the only tangible difference is whitespace handling, unless I'm missing something...
Alexander Pavlov (apavlov)
Comment 4 2012-10-16 02:33:52 PDT
(In reply to comment #2) > (From update of attachment 168728 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=168728&action=review > > > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:1327 > > + container.innerText = textNode._originalContent || container.innerText; > > textContent is the new hotness. Why innerText (which is an IE extension) instead? After double-checking, I made sure innerText is there not without reason. Setting textContent collapses all whitespace and, what's most important, newlines, so that multiline text nodes all occur on a single line. We had a bug for that a while ago, and most likely it was fixed by using innerText rather than textContent in this snippet.
Alexander Pavlov (apavlov)
Comment 5 2012-10-16 02:48:14 PDT
Pavel Feldman
Comment 6 2012-10-16 02:59:14 PDT
Comment on attachment 168903 [details] Patch We should never use innerText. Also, this change needs a test.
Alexander Pavlov (apavlov)
Comment 7 2012-10-16 06:52:53 PDT
Vsevolod Vlasov
Comment 8 2012-10-16 07:24:06 PDT
Comment on attachment 168939 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=168939&action=review > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:1326 > + var node = this.representedObject; I would rename textNode to textNodeElement and node to textNode. > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:1331 > var config = new WebInspector.EditingConfig(this._textNodeEditingCommitted.bind(this), this._editingCancelled.bind(this)); You should bind textNode parameter for _textNodeEditingCommitted to avoid duplicating the code in _textNodeEditingCommitted.
Alexander Pavlov (apavlov)
Comment 9 2012-10-16 07:53:03 PDT
Note You need to log in before you can comment on or make changes to this bug.