Bug 16074: execCommand("InsertHorizontalRule", false, "") results in id="" being inserted
For consistency with InsertOrderedList and InsertUnorderedList a value parameter of "" should
not result in an id being set.
Reviewed by Sam Weinig.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27931
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-11-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Tests for http://bugs.webkit.org/show_bug.cgi?id=16074
+ Bug 16074: execCommand("InsertHorizontalRule", false, "") results in id="" being inserted
+
+ * editing/execCommand/arguments-combinations-expected.txt:
+ * editing/execCommand/arguments-combinations.html:
+
2007-11-20 Lars Knoll <lars@trolltech.com>
Reviewed by Simon.
PASS <hr></hr> is <hr></hr>
PASS <hr id="foo"></hr> is <hr id="foo"></hr>
PASS <hr id="foo"></hr> is <hr id="foo"></hr>
-PASS <hr id=""></hr> is <hr id=""></hr>
+PASS <hr></hr> is <hr></hr>
PASS <hr></hr> is <hr></hr>
PASS <hr></hr> is <hr></hr>
PASS <hr id="0"></hr> is <hr id="0"></hr>
// Test with 4 arguments. (should ignore the fourth argument silently)
test('document.execCommand("InsertHorizontalRule", false, "foo", "bar")', '<hr id="foo"></hr>');
- // Test empty String 3rd parameter. (adds emprty id value)
- test('document.execCommand("InsertHorizontalRule", false, "")', '<hr id=""></hr>');
+ // Test empty String 3rd parameter. (should not add an empty id value)
+ test('document.execCommand("InsertHorizontalRule", false, "")', '<hr></hr>');
// Test null 3rd parameter. (should treat as if only two arguments were passed, same as undefined)
test('document.execCommand("InsertHorizontalRule", false, null)', '<hr></hr>');
+2007-11-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix http://bugs.webkit.org/show_bug.cgi?id=16074
+ Bug 16074: execCommand("InsertHorizontalRule", false, "") results in id="" being inserted
+
+ For consistency with InsertOrderedList and InsertUnorderedList a value parameter of "" should
+ not result in an id being set.
+
+ * editing/JSEditor.cpp: Don't set the id attribute if value is empty.
+
2007-11-20 Dan Bernstein <mitz@apple.com>
Reviewed by Adam Roben.
bool execInsertHorizontalRule(Frame* frame, bool userInterface, const String& value)
{
RefPtr<HTMLElement> hr = new HTMLElement(hrTag, frame->document());
- hr->setId(value);
+ if (!value.isEmpty())
+ hr->setId(value);
RefPtr<DocumentFragment> fragment = new DocumentFragment(frame->document());
ExceptionCode ec = 0;
fragment->appendChild(hr, ec);