Setting 3 attributes on an html element:
<input id=good x=morning value=hn>
Then logging 3 properties with the same names: <script>
e = document.querySelector('input');
console.log(e.id);
console.log(e.x);
console.log(e.value);
</script>
Will output good
undefined
hn
I'm not sure why. The article says it's because "Element has an id getter & setter that 'reflects' the id attribute". Which sounds logical. But MDN does not mention a getter function for "value" for example:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/in...
It even calls "value" a property AND an attribute: "...access the respective HTMLInputElement object's value property. The value attribute is always..."
And HTMLInputElement lists "value" under "properties":
https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputEl...
So maybe it's not as easy. Maybe <element some=thing> sometimes sets a property and sometimes sets an attribute.