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.
<rdar://problem/5632920>
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.
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.
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?
(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> >
That's fair enough then :)
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.
(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".
This bug blocks 6627 not the other way around.
Created attachment 27716 [details] patch
Comment on attachment 27716 [details] patch r=me
http://trac.webkit.org/changeset/41034