Commit f947c860 authored by Aryeh Gregor's avatar Aryeh Gregor
Browse files

Bug 316447 - execCommand("insertHorizontalRule") should not set height/width; r=ehsan

parent 4cf57b30
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -2937,16 +2937,7 @@ nsHTMLEditor::CreateElementWithDefaults(const nsAString& aTagName, nsIDOMElement
  newElement->SetAttribute(NS_LITERAL_STRING("_moz_dirty"), EmptyString());

  // Set default values for new elements
  if (TagName.EqualsLiteral("hr"))
  {
    // Note that we read the user's attributes for these from prefs (in InsertHLine JS)
    res = SetAttributeOrEquivalent(newElement, NS_LITERAL_STRING("width"),
                                   NS_LITERAL_STRING("100%"), true);
    NS_ENSURE_SUCCESS(res, res);
    res = SetAttributeOrEquivalent(newElement, NS_LITERAL_STRING("size"),
                                   NS_LITERAL_STRING("2"), true);
  } else if (TagName.EqualsLiteral("table"))
  {
  if (TagName.EqualsLiteral("table")) {
    res = newElement->SetAttribute(NS_LITERAL_STRING("cellpadding"),NS_LITERAL_STRING("2"));
    NS_ENSURE_SUCCESS(res, res);
    res = newElement->SetAttribute(NS_LITERAL_STRING("cellspacing"),NS_LITERAL_STRING("2"));
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ _TEST_FILES = \
		green.png \
		test_bug290026.html \
		test_bug291780.html \
		test_bug316447.html \
		test_bug332636.html \
		test_bug332636.html^headers^ \
		test_bug372345.html \
+16 −0
Original line number Diff line number Diff line
<!DOCTYPE html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=316447
-->
<title>Test for Bug 316447</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=316447">Mozilla Bug 316447</a>
<div contenteditable><br></div>
<script>
/** Test for Bug 316447 **/

getSelection().selectAllChildren(document.querySelector("div"));
document.execCommand("inserthorizontalrule");
is(document.querySelector("div").innerHTML, "<hr>", "Wrong innerHTML");
</script>