[whatwg] input type=hidden outside phrasing content

Mike Wilson mikewse at hotmail.com
Thu Oct 16 14:08:32 PDT 2008


Kristof Zelechovski wrote:
> Why is FORM INPUT[type="hidden"] not enough?

Hi Chris, I'm sorry I don't follow your comment. My suggestion
is about <input type="hidden"> currently not being allowed in
all locations in a document. Could you elaborate?
(Maybe the followups below will make things clearer anyway.)


Anne van Kesteren wrote:
> Where is it currently not allowed that you would like to 
> allow it? It's  
> pretty much allowed anywhere already as far as I can tell.

Yes, maybe it is? Reading the spec again, I realize I had 
missed the sentence "All phrasing content is also flow 
content". (I was mainly on the lookout for DTD-like info.)
I have included a couple of the cases I'm thinking of below 
(that are invalid in HTML4). But some of them may already be
ok in HTML5?

<form ...>
  <input type="hidden" ...>
</form>

<blockquote>
  <input type="hidden" ...>
</blockquote>

<table>
  <input type="hidden" ...>
</table>

<table>
  <tr>
    <input type="hidden" ...>
    <td></td>
  </tr>
</table>

<ul/ol/dl>
  <input type="hidden" ...>
</ul/ol/dl>


Tab Atkins Jr. wrote:
> For arbitrary state accessible to in-page scripting (like 
> javascript), html5 defines the data-* family of attributes 
> on all elements.  These can have any name (as long as it 
> starts with "data-") and can hold arbitrary data.

Yes, I'm aware of them and they actually have an interesting
property in that they introduce "page state" in a way
orthogonal to the element structure, as they allow data 
binding without introducing a new element or enforcing a
certain element structure.
(My focus this time is on POSTable state so the data- props 
won't do, but it would be interesting if hidden POSTable data
could be added orthogonally to the element structure in a 
fashion similar to data-.)

> For POSTable state, the state needs to be within the 
> <form> that's being submitted in any case, so being able 
> to place the hidden state outside of the form wouldn't get 
> you much.  Can you elaborate on what you're proposing?

Certainly, and no it is not outside the <form> I'm seeking
but rather the odd cases above (imagine an outer form on all 
examples but the first).


Best regards
Mike Wilson


> -----Original Message-----
> From: whatwg-bounces at lists.whatwg.org
> [mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Mike Wilson
> Sent: Wednesday, October 15, 2008 9:40 PM
> To: whatwg at lists.whatwg.org
> Subject: [whatwg] input type=hidden outside phrasing content
> 
> Would it be possible to have HTML5 allow the insertion of
>   <input type="hidden" ...>
> (or something with the same effect) anywhere in the document?
> 
> This would f ex relieve cases like server-side templating
> wanting to attach hidden state to its generated markup, and
> not having to use complex algorithms to find a suitable spot.
> 
> As this type of element is non-visual this suggestion 
> shouldn't cause any layout problems, but I guess having
> different placement rules for different settings on the same
> element type is, so maybe using <input> is not possible.
> Could HTML5 support adding hidden POSTable state in another 
> way, that wouldn't be subject to placement rules for visual
> content?
> 
> Best regards
> Mike Wilson




More information about the whatwg mailing list