Closed
Bug 456798
Opened 15 years ago
Closed 12 years ago
queryCommandSupported throws errors in Firefox 3.0.1
Categories
(Core :: DOM: Editor, enhancement)
Core
DOM: Editor
Tracking
()
RESOLVED
FIXED
mozilla9
People
(Reporter: linda167, Assigned: kaze)
References
Details
(Keywords: dev-doc-complete)
Attachments
(2 files, 1 obsolete file)
3.43 KB,
text/html
|
Details | |
195.88 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 Build Identifier: Mozilla/5.0, Firefox 3.0.1, OS: Mac OS X 10.5 and Windows NT 5.2 queryCommandSupported(sCmd) throws errors on all commands in Firefox. This method works fine in IE7 and Safari 3.1.2. I have not found a command that it will not throw an error on. Here's the list of commands that I've tested: Bold Italic Underline Strikethrough JustifyLeft JustifyCenter JustifyRight InsertUnorderedList InsertOrderedList Outdent Indent ForeColor RemoveFormat InsertHorizaontalRule Undo Redo CreateLink Unlink Superscript Subscript Reproducible: Always Steps to Reproduce: 1. Call queryCommandSupported(sCmd) on any command supported by Mozilla's execCommand Actual Results: Error Expected Results: No error Function should return true or false.
Comment 1•15 years ago
|
||
queryCommandSupported() isn't implemented yet, it's throwing an NS_ERROR_NOT_IMPLEMENTED exception.
Blocks: 424615
Severity: normal → enhancement
Comment 2•15 years ago
|
||
This enumerates return values/exceptions thrown in queryCommandSupported(). Based on similar testcase from bug 408231.
Comment 3•13 years ago
|
||
Reproducible for me (with Firefox 3.6 and Firefox 4b7). Every other browser I tested (Safari, Chrome, Opera, IE6-9) supports it correctly. Is there any known workaround to see whether a certain command is supported?
Assignee | ||
Comment 4•12 years ago
|
||
Bug confirmed with the latest trunk, `queryCommandSupported' is not implemented. As Firefox raises an NS_ERROR_NOT_IMPLEMENTED exception on `queryCommandEnabled("foo")', an easy workaround would be to use a try…catch around a `queryCommandEnabled' call: var enabled, supported; try { enabled = document.queryCommandEnabled(sCmd); supported = document.queryCommandSupported(sCmd); } catch(e) {} Implementing `queryCommandSupported' would be neat. I’d suggest to fix both behaviors at the same time: • document.queryCommandSupported('foo') should return `false'; • document.queryCommandEnabled('foo') should return `false' without raising any exception — FWIW, that’s what Chromium does.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 5•12 years ago
|
||
(In reply to Fabien Cazenave (:kazé) from comment #4) > Implementing `queryCommandSupported' would be neat. I’d suggest to fix both > behaviors at the same time: > • document.queryCommandSupported('foo') should return `false'; > • document.queryCommandEnabled('foo') should return `false' without raising > any exception — FWIW, that’s what Chromium does. Please! :-)
Assignee: nobody → kaze
Keywords: dev-doc-needed
Assignee | ||
Comment 6•12 years ago
|
||
Rationale: a command is supported if it can be converted to an internal Midas command. This gives us +43 points on the Browserscope tests (+3.3%) — we’re reaching 50%! OK, that’s still far from Chrome’s 80% and Safari’s 66%… The browserscope status (currentStatus.js) has been updated accordingly. I don’t think we need more tests for this patch but I can write some if you wish.
Attachment #553448 -
Flags: review?(ehsan)
Assignee | ||
Comment 7•12 years ago
|
||
Finally got the TryServer results. I’m afraid I have to submit another patch: 56355 ERROR TEST-UNEXPECTED-FAIL | /tests/content/html/content/test/test_bug408231.html | queryCommandEnabled(not-a-command) result=false expected=exception Working on it. :-/
Status: NEW → ASSIGNED
Assignee | ||
Comment 8•12 years ago
|
||
fixes content/html/content/test/test_bug408231.html so that `document.queryCommandSupported("not-a-command")' is expected to return `false' instead of raising an exception.
Attachment #553448 -
Attachment is obsolete: true
Attachment #553525 -
Flags: review?(ehsan)
Attachment #553448 -
Flags: review?(ehsan)
Comment 9•12 years ago
|
||
Comment on attachment 553525 [details] [diff] [review] patch proposal Looks great, thanks!
Attachment #553525 -
Flags: review?(ehsan) → review+
Comment 10•12 years ago
|
||
Pushed to inbound.
Comment 11•12 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/be37d0418129
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
Comment 12•12 years ago
|
||
Documented, other than needing an example. If someone would like to add one, that would be fantastic: https://developer.mozilla.org/en/DOM/document.queryCommandSupported Mentioned on Firefox 9 for developers.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•