select.setAttribute('size', foo) should respect the specified string |
||||
Issue description
Chrome Version: 61 canary
OS: All but iOS
What steps will reproduce the problem?
(1) Open the following URL
data:text/html;charset=utf-8,<select size=foo><script>alert(document.querySelector('select').getAttribute('size'));</script>
What is the expected result?
A dialog shows "foo".
What happens instead?
A dialog shows "0".
Please use labels and text to provide additional information.
Edge, Firefox, and Safari work correctly.
HTMLSelectElement.cpp has the following code:
// Set the attribute value to a number.
// This is important since the style rules for this attribute can
// determine the appearance property.
unsigned size = params.new_value.GetString().ToUInt();
AtomicString attr_size = AtomicString::Number(size);
if (attr_size != params.new_value) {
// FIXME: This is horribly factored.
if (Attribute* size_attribute =
EnsureUniqueElementData().Attributes().Find(sizeAttr))
size_attribute->SetValue(attr_size);
}
The comment is obsolete. We don't need such process now because we have :-internal-list-box pseudo selector.
WPT: http://w3c-test.org/html/dom/reflection-forms.html
,
Jul 18 2017
> Shall i start work on this bug? Please go ahead.
,
Aug 3 2017
sujiths.s@ looks not to work on this. I have stated this.
,
Aug 3 2017
tkent@, already uploaded the patch, currently WIP https://chromium-review.googlesource.com/c/582049
,
Aug 3 2017
> already uploaded the patch, currently WIP > https://chromium-review.googlesource.com/c/582049 Oh, it's too late, and your code change isn't correct. Today I uploaded my CL, and it was already reviewed. I'm landing it. https://chromium-review.googlesource.com/c/598763
,
Aug 4 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8de8f952cde5da47147368a7ddca24053056e3a0 commit 8de8f952cde5da47147368a7ddca24053056e3a0 Author: Kent Tamura <tkent@chromium.org> Date: Fri Aug 04 03:53:49 2017 SELECT element: Do not normalize |size| content attribute value. We normalized |size| content attribute value to a number in order to write the UA stylesheet easier. We introduced :-internal-list-box a few years ago, and this normalization isn't necessary now. This CL does: - Do not normalize |size| attribute value in HTMLSelectElement:: ParseAttribute(). - Use the standard reflection code for |size| IDL attribute. Bug: 745316 Change-Id: Ifcd3b2b55762f49b72c49900ab89a4fe78fb9b78 Reviewed-on: https://chromium-review.googlesource.com/598763 Commit-Queue: Kent Tamura <tkent@chromium.org> Reviewed-by: Keishi Hattori <keishi@chromium.org> Cr-Commit-Position: refs/heads/master@{#491933} [modify] https://crrev.com/8de8f952cde5da47147368a7ddca24053056e3a0/third_party/WebKit/LayoutTests/external/wpt/html/dom/reflection-forms-expected.txt [modify] https://crrev.com/8de8f952cde5da47147368a7ddca24053056e3a0/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp [modify] https://crrev.com/8de8f952cde5da47147368a7ddca24053056e3a0/third_party/WebKit/Source/core/html/HTMLSelectElement.h [modify] https://crrev.com/8de8f952cde5da47147368a7ddca24053056e3a0/third_party/WebKit/Source/core/html/HTMLSelectElement.idl
,
Aug 4 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by sujith...@samsung.com
, Jul 18 2017