RESOLVED FIXED 16309
HTML5: The third execCommand argument for insert{un}orderedlist should be ignored
https://bugs.webkit.org/show_bug.cgi?id=16309
Summary HTML5: The third execCommand argument for insert{un}orderedlist should be ign...
Johan "Spocke" Sörlin
Reported 2007-12-05 09:50:43 PST
When you create list elements in a contentEditable area the id of the new list will have the value false. The result is: <ol id="false">... when it should be a normal list like <ol>.... Steps to reproduce this bug: 1. Open the attached URL. 2. Press the test link. 3. Observe the incorrect result with a list element with a strange id attribute.
Attachments
patch (10.65 KB, patch)
2009-02-16 19:26 PST, Justin Garcia
mrowe: review+
David Kilzer (:ddkilzer)
Comment 1 2007-12-06 06:58:38 PST
Justin Garcia
Comment 2 2007-12-11 00:15:14 PST
The originator wrote: "When you create list elements in a contentEditable area the id of the new list will have the value false. The result is: <ol id="false">... when it should be a normal list like <ol>...." The test case does: document.execCommand('InsertUnorderedList', false, false); The third argument for this command is "optional and specifies an id attribute for the unordered list. [It] may be set to null or omitted" according to the MSDN documentation. The boolean false as a string is "false" so it makes since to me that you would see a list with id="false". If you want an id-less list you should omit the third argument or pass null for it. I sent an email to Johan about this. I'll leave this open until I hear back from him.
Johan "Spocke" Sörlin
Comment 3 2007-12-11 04:53:03 PST
The arguments can not be omitted in Firefox and using false as the last argument works fine in IE, FF and Opera so it's only Safari who has a problem with it but I guess we could simply start using null instead will go though the code to use that then.
Mark Rowe (bdash)
Comment 4 2007-12-11 12:29:58 PST
Justin, the MSDN documentation suggests that IE supports the third argument being used as the id, but my testing shows that it doesn't insert id="false" in this case. Shouldn't we match that behaviour?
Justin Garcia
Comment 5 2007-12-11 14:02:47 PST
(In reply to comment #3) > The arguments can not be omitted in Firefox and using false as the last > argument works fine in IE, FF and Opera so it's only Safari who has a problem > with it but I guess we could simply start using null instead will go though the > code to use that then. FireFox and Opera don't appear to support the ability to set an id with the third argument at all so I don't think they are a fair comparison. IE6 doesn't either for that matter, unless I'm missing something. Here's my testcase: <body contenteditable="true"> <script> document.body.focus(); document.execCommand("InsertUnorderedList", false, "hello"); alert(document.getElementsByTagName("ul")[0].id); <script> </body> >
Mark Rowe (bdash)
Comment 6 2007-12-11 14:04:50 PST
That's fair enough then :)
Ian 'Hixie' Hickson
Comment 7 2008-08-19 14:45:54 PDT
Shouldn't this bug be reopened then? If nobody else does anything with that third argument, regardless of what MSDN says, we shouldn't be adding an id. HTML5 says to ignore the third argument for insertUnorderedList.
Justin Garcia
Comment 8 2008-08-19 15:36:55 PDT
(In reply to comment #7) > Shouldn't this bug be reopened then? If nobody else does anything with that > third argument, regardless of what MSDN says, we shouldn't be adding an id. > > HTML5 says to ignore the third argument for insertUnorderedList. Fair enough. I noticed a typo at: http://www.w3.org/TR/html5/editing.html The second "insertOrderedList" should be "insertUnorderedList".
Justin Garcia
Comment 9 2009-02-16 17:02:42 PST
This bug blocks 6627 not the other way around.
Justin Garcia
Comment 10 2009-02-16 19:26:50 PST
Mark Rowe (bdash)
Comment 11 2009-02-16 19:28:46 PST
Comment on attachment 27716 [details] patch r=me
Justin Garcia
Comment 12 2009-02-16 19:37:09 PST
Note You need to log in before you can comment on or make changes to this bug.