4

Besides adding semantics, I find the new HTML output element pretty pointless. From the specification, it says:

The for content attribute allows an explicit relationship to be made between the result of a calculation and the elements that represent the values that went into the calculation or that otherwise influenced the calculation. The for attribute, if specified, must contain a string consisting of an unordered set of unique space-separated tokens that are case-sensitive, each of which must have the value of an ID of an element in the same Document.

The calculation of the value in the output is still being done via javascript. Since the for attribute is not used in the derivation of the result, what is the purpose of specifying it?

Question Overflow
  • 10,925
  • 18
  • 72
  • 110
  • 1
    It's in the first sentence of your quotation. – BoltClock Dec 20 '13 at 09:43
  • 2
    "Besides adding semantics..." Why is that not good enough reason? – JJJ Dec 20 '13 at 09:46
  • 1
    You could ask: what's the point of the output element - aside for semantics ! – Danield Dec 20 '13 at 09:47
  • 1
    @all, I could specify anything in the for attribute and the output still works. It just looks something extra to me. – Question Overflow Dec 20 '13 at 09:48
  • 1
    This discussion ("what's the purpose of semantics") has been discussed over and over again. There *is* value in semantics even if you don't use the information yourself. Perhaps someone wants to write a browser plugin that uses those values and the for attribute tells it where to find them, for example. – JJJ Dec 20 '13 at 09:50
  • While, I don’t agree that the output element is pretty pointless, I think it’s still a good question and the commenters and the closer appear to have missed the point. The output element is part of the `form.elements` collection, so you you can unify your form processing code. It doesn’t do anything magical other than that, and you still need to do whatever you would have had to do in JavaScript. As for the `for` attribute, it appears to be mainly informative rather than functional. – Manngo Jul 14 '23 at 07:28

0 Answers0