Open Bug 1246519 Opened 5 years ago Updated 2 years ago
.query Command Value doesn't reflect the change after executing back Color [contenteditable, exec Command]
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Build ID: 20160205030204 Steps to reproduce: demo: http://jsfiddle.net/crl/mL5y8ehw/ after executing backColor, in console, we see no changes in document.queryCommandValue('backColor'); I guess maybe it's because the selection is oustide the span |<span style="">...</span>| (similar issue https://bugzilla.mozilla.org/show_bug.cgi?id=1183844) Actual results: no changes in commandValue('backColor') Expected results: it should be updated (it works for foreColor) (attached screen capture, on the left Chrome, on the right FF)
After applying the 'backColor' command, the selected range is updated to start from the end of the text node just before the colored span and end at the end of the text node that is in the colored span. The code that queries the background color  checks the color at the start of the selected range which is not inside the span and thus does not return the color you are expecting. A possible fix could be to update the selected range to be entirely within the inline style when an exec command applies an inline style. Another simpler fix could to be check the color at the end of the selected range.  https://dxr.mozilla.org/mozilla-central/rev/584870f1cbc5d060a57e147ce249f736956e2b62/editor/libeditor/nsHTMLEditor.cpp#1767
You need to log in before you can comment on or make changes to this bug.