Per http://www.w3.org/TR/html5/common-input-element-attributes.html#attr-input-size: attribute is limited to only non-negative numbers greater than zero and has a default value of 20: If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead. Setting attribute to 5147483649, 0, and -1 does not return 20 for property value.
Duplicate of bug 44886?
Getting input.size has the wrong value when the content attribute is missing/negative/out-of-range. That's bug 44886, and also seems to be what comment #0 is talking about (comment #0 does not provide any test-case I can use to check). The only further bug I see in input.size is that it should throw when set to 0, per spec, but doesn't in Chrome 13 dev. My reflection tests cover this: http://dvcs.w3.org/hg/html/raw-file/e24159ebba83/tests/submission/AryehGregor/reflection/reflection-original.html The following test shows that IE9 and Firefox 5.0a2 throw when you set input.size to 0, Chrome 13 dev and Opera 11.10 don't: http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!doctype%20html%3E%0A%3Cscript%3E%0Atry%20%7B%0Adocument.createElement(%22input%22).size%20%3D%200%3B%0Aw(%22No%20exception%22)%3B%0A%7D%20catch(e)%20%7B%20w(e)%20%7D%0A%3C%2Fscript%3E
Created attachment 167035 [details] Patch
Comment on attachment 167035 [details] Patch Attachment 167035 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/14152382
Comment on attachment 167035 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=167035&action=review > Source/WebCore/ChangeLog:3 > + <input> size attribute does not return default when attribute outofrange This is the bug title, but it doesn't match what you will fix. It seems the original issue was already fixed, and you'll fix Comment #2, right? If so, we should change the bug title. > Source/WebCore/html/HTMLInputElement.h:210 > - void setSize(unsigned); > + void setSize(unsigned, ExceptionCode&); Unfortunately Objective-C binding needs setSize(unsigned). We should have both. > LayoutTests/ChangeLog:11 > + * fast/forms/input-size-expected.txt: Added. > + * fast/forms/input-size.html: Added. We already have fast/dom/HTMLInputElement/input-size-attribute.html. Would you add your test case to it please?
Comment on attachment 167035 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=167035&action=review > Source/WebCore/ChangeLog:11 > + According to the spec, the size IDL attribute of input elements is limited > + to only non-negative numbers greater than zero. It should throw INDEX_SIZE_ERR > + exception when set to 0. > + Spec: http://www.w3.org/TR/html5/common-input-element-attributes.html#the-size-attribute good explanation. It would be better if you add behavior of other browsers.
Created attachment 167243 [details] Patch 2
Thank you for the comments. Updated the patch reflecting your comments. It also fixes fast/forms/number/number-size.html. Please take another look.
Comment on attachment 167035 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=167035&action=review >> Source/WebCore/ChangeLog:3 >> + <input> size attribute does not return default when attribute outofrange > > This is the bug title, but it doesn't match what you will fix. > It seems the original issue was already fixed, and you'll fix Comment #2, right? If so, we should change the bug title. I've changed this summary line in the new patch. How can we change the bug title on bugzilla as well?
(In reply to comment #9) > I've changed this summary line in the new patch. How can we change the bug title on bugzilla as well? I think you don't have a EditBug permission. I'll update it.
Comment on attachment 167243 [details] Patch 2 View in context: https://bugs.webkit.org/attachment.cgi?id=167243&action=review > Source/WebCore/ChangeLog:19 > + * html/HTMLInputElement.cpp: > + (WebCore::HTMLInputElement::setSize): > + * html/HTMLInputElement.h: > + (HTMLInputElement): > + * html/HTMLInputElement.idl: You had better add per-file / per-function comments as possible.
Comment on attachment 167243 [details] Patch 2 Clearing flags on attachment: 167243 Committed r130469: <http://trac.webkit.org/changeset/130469>
All reviewed patches have been landed. Closing bug.