Closed
Bug 1420308
Opened 8 years ago
Closed 8 years ago
document.getElementById("someid").getAttribute('value') nonexistent
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: jmichae3, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
Build ID: 20171112125346
Steps to reproduce:
document.getElementById("someid").getAttribute('value')
document.getElementById("someid").setAttribute('value','q')
then try
document.getElementById("someid").value
document.getElementById("someid").value='q'
Actual results:
document.getElementById("someid").getAttribute('value') nonexistent for textarea element and input boxes.
.setAttribute("value","q") doesn't work either.
only .value stuff works
Expected results:
all these should work.
Comment 1•8 years ago
|
||
As always, please provide a testcase.
Comment 2•8 years ago
|
||
(In reply to Jim Michaels from comment #0)
> User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101
> Firefox/57.0
> Build ID: 20171112125346
>
> Steps to reproduce:
>
> document.getElementById("someid").getAttribute('value')
> document.getElementById("someid").setAttribute('value','q')
> then try
> document.getElementById("someid").value
> document.getElementById("someid").value='q'
>
>
>
> Actual results:
>
> document.getElementById("someid").getAttribute('value') nonexistent for
> textarea element and input boxes.
> .setAttribute("value","q") doesn't work either.
> only .value stuff works
>
There's difference b/w element.value and element.getAttribute(value)/setAttribute(value).
This stackoverflow article could be a reference.
https://stackoverflow.com/questions/6003819/what-is-the-difference-between-properties-and-attributes-in-html
According to https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element, it's expected that getAttribute('value') for a textarea is nonexistent as there's no "value" attribute spec'd. Per https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute#Notes, it's expected that 'null' is returned.
For input field (I tested with type=text), getAttribute('value') and seAttribute('value') worked as expected for me, per https://html.spec.whatwg.org/multipage/input.html#the-input-element
Closing as INVALID.
>
> Expected results:
>
> all these should work.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
Updated•8 years ago
|
Keywords: testcase-wanted
You need to log in
before you can comment on or make changes to this bug.
Description
•