Created attachment 279878 [details] bug_demo When using the attribute 'contenteditable=true' on an element, if said element in underlined and no selection is made, a call to execCommand('underline') will not result in the value returned by 'queryCommandState('underline')' to be 'toggled' from true to false and vice versa; this behavior is inconsistent with the behavior of 'execCommand('bold')', 'execCommand('italic')' for example, where the relevant command states are in fact toggled. The attached demo will behave differently in chrome when compared to safari. (clicking toggle underline does toggled the state in chrome). I believe this bug to be the inverse of this bug: https://bugs.webkit.org/show_bug.cgi?id=17594 As far as I'm aware this is a bug, but please forgive me if it's desired behavior? Bug is at least present on IOS 9.2 and Safari 9 on Mac. I have not had time to test other platforms.
Created attachment 280058 [details] Reduction Adding a reduction. The behaviors of queryCommandState('underline') and queryCommandState('bold') are inconsistent.
Created attachment 340958 [details] Fixes the bug
Comment on attachment 340958 [details] Fixes the bug This has been requesting review for more than one year. If this is still needed, please rebase and re-request review.