Making the selected text bold:
document.execCommand('bold', null, null);
When the user selects that piece of text again (or a part of it), how can you know that it has been made bold?
Bold is just an example. The commandName
could be underline
, heading
, createLink
, ...
execCommand() is completely dead because some parts of it still work fine. Unfortunately the primary issue for me was that browsers use a lot of different code to generate those styles which are not recognized by screen readers used by those who are blind or nearly so.
HTML DOM Document execCommand() The applets property returns an empty HTMLCollection in all new browsers. The <applet> element is not supported in HTML5.
document.queryCommandState
Determines whether the given command has been executed on the current selection.
Source: http://blog.whatwg.org/the-road-to-html-5-contenteditable#how
Apparently I didn't search well enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With