New issue
Advanced search Search tips
Starred by 3 users

Issue metadata

Status: Fixed
Closed: May 2016
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug

Sign in to add a comment

document.queryCommandState isn't working well with <sub> and <sup> [contenteditable, blink]

Reported by, Jan 28 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.13 Safari/537.36

Steps to reproduce the problem:
1. demo
2. see the queried states in console for each case

What is the expected behavior?
first case <sub>|<i>veniam</i>|</sub>  (| is the selection)
document.queryCommandState('subscript') is false, which is bad I think

second case is the opposite: <i>|<sub>veniam</sub>|</i>
document.queryCommandState('italic') returns true, subscript too, it's correct

What went wrong?
document.queryCommandState('subscript') is false, when the tag is outside selection

Did this work before? N/A 

Chrome version: 49.0.2623.13  Channel: n/a
OS Version: 10.0
Flash Version: Shockwave Flash 20.0 r0
Labels: Needs-Feedback
Could you please help us providing a screen cast/screen shot of the expected result.
Currently it displays as attached on Win 7,Mac 10.11.3 and Ubuntu 14.04 using stable 48.0.2564.109 and canary 50.0.2647.0. as attached.
3.6 KB View Download
sorry I wasn't clear, I have this output also, but Firefox gives:

true true
true true

and I think it makes sense, if you are like this <sub>|<i>veniam</i>|</sub> you should be able to know that you're subscripted

Components: Blink>Editing

Comment 4 by, Feb 25 2016

Components: -Blink>Editing Blink>Editing>Command
Status: Available (was: Unconfirmed)

Comment 5 by, May 17 2016

I'm fixing this bug:
Project Member

Comment 6 by, May 31 2016

The following revision refers to this bug:

commit dfe3d34820670521568ca7dfe681f701da94325b
Author: joone.hur <>
Date: Tue May 31 00:48:24 2016

Apply vertical-align style of <sub> and <sup> to child elements.

If the selected element has <sub> or <sup> ancestor element,
apply the corresponding style(vertical-align) to it so that
document.queryCommandState() works fine on the selected element.

<sub> and <sup> tags are represented with CSS vertical-align
property but they are not inherited. Therefore, we need to apply the
property to child elements because <sub> and <sup> tag can have
child elements such as <i> or <b> tag.

BUG= 582225 

Cr-Commit-Position: refs/heads/master@{#396763}


Comment 7 by, May 31 2016

Status: Fixed (was: Available)
Project Member

Comment 8 by, May 31 2016

The following revision refers to this bug:

commit 4cbb231ee8d27b7e411bc88b9c935999c0b54619
Author: joone.hur <>
Date: Tue May 31 10:03:45 2016

Test the default editing behavior in queryCommandState-04.html

queryCommandState-04.html was added in
We also need to test the default editing behavior in the test.

BUG= 582225 

Cr-Commit-Position: refs/heads/master@{#396809}


Comment 9 by, Oct 19 2016


Sign in to add a comment