New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
H1 toggle endlessly grows text if in <ol>/<ul> #53
Comments
Will this be a situation where we have to resort to browser checks and direct DOM manipulation? I hope not, but here is a PR that works for my chrome https://github.com/CanopyTax/bandicoot/pull/54/files. This is intended strictly for discussion and proof of concept. |
I'll leave a comment on #54 for this |
Firefox(Each line is a click to h1 with cursor on <li><h1>awef</h1></li>
<li><div>awef</div></li>
<li><div><h1>awef</h1></div></li>
<li><div><h1>awef</h1></div></li>
<li><div><h1>awef</h1></div></li> (it stops changing) |
Safari appears to mimic Chrome behavior |
wrote note in docs for this |
Chrome 75
Given
Invoking
formatBlock()
and thusperformCommandWithValue()
with param"h1"
results in expected:On second click, we'll fall (as expected) into
and on the resulting execution of
document.execCommand('formatBlock', 'div')
we get a div wrapped by h1:This behavior is unexpected to me especially given formatBlock's description:
Adds an HTML block-level element around the line containing the current selection, replacing the block element containing the line if one exists
.Another click replaces the div with an h1:
and
<h1>
s all the way downWhy is
<ol>
breakingformatBlock
behavior? Is there a way to detect if current line is<ol>
?Interestingly, even though
<ol>
is indeed a block level element, it is not detected bydocument.queryCommandValue('formatBlock')
(I get an empty string).The text was updated successfully, but these errors were encountered: