Diff
Modified: trunk/LayoutTests/ChangeLog (120157 => 120158)
--- trunk/LayoutTests/ChangeLog 2012-06-13 04:47:01 UTC (rev 120157)
+++ trunk/LayoutTests/ChangeLog 2012-06-13 04:50:42 UTC (rev 120158)
@@ -1,3 +1,13 @@
+2012-06-12 Edaena Salinas Jasso <eda...@apple.com>
+
+ Can't set el.type on a <button> element
+ https://bugs.webkit.org/show_bug.cgi?id=14439
+
+ Reviewed by Darin Adler.
+
+ * fast/dom/HTMLButtonElement/change-type-expected.txt: Added.
+ * fast/dom/HTMLButtonElement/change-type.html: Added.
+
2012-06-12 Dominic Cooney <domin...@chromium.org>
[Chromium] Unreviewed: Update expectations for http/tests/media/media-source/webm/video-media-source-seek.html
Added: trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type-expected.txt (0 => 120158)
--- trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type-expected.txt 2012-06-13 04:50:42 UTC (rev 120158)
@@ -0,0 +1,43 @@
+Tests for bug 14439. Button type should be set using el.type.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS btn.type = 'submit'; btn.type is 'submit'
+PASS btn.getAttribute('type') is 'submit'
+PASS btn.type = 'reset'; btn.type is 'reset'
+PASS btn.getAttribute('type') is 'reset'
+PASS btn.type = 'button'; btn.type is 'button'
+PASS btn.getAttribute('type') is 'button'
+PASS btn.type = 'reset'; btn.type is 'reset'
+PASS btn.getAttribute('type') is 'reset'
+PASS btn.type = 'suBmiT'; btn.type is 'submit'
+PASS btn.getAttribute('type') is 'suBmiT'
+PASS btn.type = ''; btn.type is 'submit'
+PASS btn.getAttribute('type') is ''
+PASS btn.type = 'b'; btn.type is 'submit'
+PASS btn.getAttribute('type') is 'b'
+PASS btn.type = 'RESET'; btn.type is 'reset'
+PASS btn.getAttribute('type') is 'RESET'
+PASS btn.type = ''; btn.type is 'submit'
+PASS btn.getAttribute('type') is ''
+PASS btn.type = '/'; btn.type is 'submit'
+PASS btn.getAttribute('type') is '/'
+PASS btn.type = ' '; btn.type is 'submit'
+PASS btn.getAttribute('type') is ' '
+PASS btn.type = 'button '; btn.type is 'submit'
+PASS btn.getAttribute('type') is 'button '
+PASS btn.type = ' b u t t o n '; btn.type is 'submit'
+PASS btn.getAttribute('type') is ' b u t t o n '
+PASS btn.type = null; btn.type is 'submit'
+PASS btn.getAttribute('type') is null + ''
+PASS btn.type = undefined; btn.type is 'submit'
+PASS btn.getAttribute('type') is undefined + ''
+PASS btn.type = 'reset'; txt.value = 'hello'; btn.click(); txt.value is ''
+PASS didSubmit is false
+PASS btn.type = 'button'; txt.value = 'hello'; btn.click(); txt.value is 'hello'
+PASS btn.type = 'submit'; btn.click(); didSubmit is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type.html (0 => 120158)
--- trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type.html (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLButtonElement/change-type.html 2012-06-13 04:50:42 UTC (rev 120158)
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body _onload_="runTests()">
+<script>
+
+description("Tests for <a href="" \
+bug 14439</a>. Button type should be set using el.type.");
+
+var didSubmit = false;
+var btn;
+var txt;
+
+function testTypeValue()
+{
+ btn = document.getElementById("b");
+
+ shouldBe("btn.type = 'submit'; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "'submit'");
+
+ shouldBe("btn.type = 'reset'; btn.type", "'reset'");
+ shouldBe("btn.getAttribute('type')", "'reset'");
+
+ shouldBe("btn.type = 'button'; btn.type", "'button'");
+ shouldBe("btn.getAttribute('type')", "'button'");
+
+ shouldBe("btn.type = 'reset'; btn.type", "'reset'");
+ shouldBe("btn.getAttribute('type')", "'reset'");
+
+ shouldBe("btn.type = 'suBmiT'; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "'suBmiT'");
+
+ shouldBe("btn.type = ''; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "''");
+
+ shouldBe("btn.type = 'b'; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "'b'");
+
+ shouldBe("btn.type = 'RESET'; btn.type", "'reset'");
+ shouldBe("btn.getAttribute('type')", "'RESET'");
+
+ shouldBe("btn.type = ''; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "''");
+
+ shouldBe("btn.type = '/'; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "'/'");
+
+ shouldBe("btn.type = ' '; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "' '");
+
+ shouldBe("btn.type = 'button '; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "'button '");
+
+ shouldBe("btn.type = ' b u t t o n '; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "' b u t t o n '");
+
+ shouldBe("btn.type = null; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "null + ''");
+
+ shouldBe("btn.type = undefined; btn.type", "'submit'");
+ shouldBe("btn.getAttribute('type')", "undefined + ''");
+}
+
+function testTypeBehavior()
+{
+ btn = document.getElementById("b");
+ txt = document.getElementById("t");
+
+ btn.type = "submit";
+ txt.value = "hello";
+
+ shouldBe("btn.type = 'reset'; txt.value = 'hello'; btn.click(); txt.value", "''");
+ shouldBe("didSubmit", "false");
+ shouldBe("btn.type = 'button'; txt.value = 'hello'; btn.click(); txt.value", "'hello'");
+}
+
+function testSubmitBehavior()
+{
+ shouldBe("btn.type = 'submit'; btn.click(); didSubmit", "true");
+ didSubmit = false;
+ txt.value = "";
+}
+
+function formWasSubmitted()
+{
+ didSubmit = true;
+}
+
+function runTests()
+{
+ testTypeValue();
+ testTypeBehavior();
+ testSubmitBehavior();
+
+ wasPostTestScriptParsed = true;
+
+ if (window.jsTestIsAsync) {
+ if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+ if (window.wasFinishJSTestCalled)
+ finishJSTest();
+ } else
+ finishJSTest();
+ }
+</script>
+<form id="f" action="" _onsubmit_="formWasSubmitted();">
+ <input id="t" type="text" />
+ <button id="b"></button>
+</form>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (120157 => 120158)
--- trunk/Source/WebCore/ChangeLog 2012-06-13 04:47:01 UTC (rev 120157)
+++ trunk/Source/WebCore/ChangeLog 2012-06-13 04:50:42 UTC (rev 120158)
@@ -1,3 +1,20 @@
+2012-06-12 Edaena Salinas Jasso <eda...@apple.com>
+
+ Can't set el.type on a <button> element
+ https://bugs.webkit.org/show_bug.cgi?id=14439
+
+ Reviewed by Darin Adler.
+
+ Test: fast/dom/HTMLButtonElement/change-type.html
+
+ * bindings/objc/PublicDOMInterfaces.h:
+ * html/HTMLButtonElement.cpp:
+ (WebCore::HTMLButtonElement::setType): Added implementation of setType method.
+ (WebCore):
+ * html/HTMLButtonElement.h:
+ (HTMLButtonElement): Added setType method.
+ * html/HTMLButtonElement.idl: Removed readonly restriction to the type variable.
+
2012-06-12 Kenichi Ishibashi <ba...@chromium.org>
[Chromium] Implement font shaping with font-feature-settings on Mac
Modified: trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h (120157 => 120158)
--- trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h 2012-06-13 04:47:01 UTC (rev 120157)
+++ trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h 2012-06-13 04:50:42 UTC (rev 120158)
@@ -410,7 +410,7 @@
@property(readonly, retain) DOMHTMLFormElement *form;
@property BOOL disabled;
@property(copy) NSString *name;
-@property(readonly, copy) NSString *type;
+@property(copy) NSString *type;
@property(copy) NSString *value;
@property BOOL autofocus AVAILABLE_IN_WEBKIT_VERSION_4_0;
@property(readonly) BOOL willValidate AVAILABLE_IN_WEBKIT_VERSION_4_0;
Modified: trunk/Source/WebCore/html/HTMLButtonElement.cpp (120157 => 120158)
--- trunk/Source/WebCore/html/HTMLButtonElement.cpp 2012-06-13 04:47:01 UTC (rev 120157)
+++ trunk/Source/WebCore/html/HTMLButtonElement.cpp 2012-06-13 04:50:42 UTC (rev 120158)
@@ -53,6 +53,11 @@
return adoptRef(new HTMLButtonElement(tagName, document, form));
}
+void HTMLButtonElement::setType(const String& type)
+{
+ setAttribute(typeAttr, type);
+}
+
RenderObject* HTMLButtonElement::createRenderer(RenderArena* arena, RenderStyle*)
{
return new (arena) RenderButton(this);
Modified: trunk/Source/WebCore/html/HTMLButtonElement.h (120157 => 120158)
--- trunk/Source/WebCore/html/HTMLButtonElement.h 2012-06-13 04:47:01 UTC (rev 120157)
+++ trunk/Source/WebCore/html/HTMLButtonElement.h 2012-06-13 04:50:42 UTC (rev 120158)
@@ -32,6 +32,8 @@
public:
static PassRefPtr<HTMLButtonElement> create(const QualifiedName&, Document*, HTMLFormElement*);
+ void setType(const String&);
+
String value() const;
private:
Modified: trunk/Source/WebCore/html/HTMLButtonElement.idl (120157 => 120158)
--- trunk/Source/WebCore/html/HTMLButtonElement.idl 2012-06-13 04:47:01 UTC (rev 120157)
+++ trunk/Source/WebCore/html/HTMLButtonElement.idl 2012-06-13 04:50:42 UTC (rev 120158)
@@ -30,7 +30,7 @@
attribute [Reflect] boolean formNoValidate;
attribute [Reflect] DOMString formTarget;
attribute [Reflect] DOMString name;
- readonly attribute DOMString type;
+ attribute DOMString type;
attribute [Reflect] DOMString value;
readonly attribute boolean willValidate;