[whatwg] Attribute for holding private data for scripting

I can think of two possibilities.

One would be to allow the param element as a child of any element (or any
block level element?)
http://www.whatwg.org/specs/web-apps/current-work/#param

And then make an attribute of HTMLElement called params
 readonly attribute HTMLCollection params;

Where params is a collection of HTMLParamElements that are children (not
further descendants) of that element.

That would make this:
<div id="foo"><param name="answer" value="42">Some more content</div>

easy to access via JavaScript:
var foo = document.getElementById("foo");
if(foo.params['answer'] == 42) {
 // it is!!
}

The only other possibility I can think of would be an HTML attribute called
"params" that would be a list of tokenized name value pairs, but that sounds
even hairier to implement.

This would have simplified something I did last week involving the Google
Maps API, where I did, as mentioned, make up a fake attribute.  There may be
better ways to do this.

On 4/9/07, ddailey <ddailey at zoominternet.net> wrote:
>
> Henri, thanks for the link to PPK's suggestions -- I rather like many of
> them.
>
> Henri Sivonen wrote:
>
> > At http://www.quirksmode.org/blog/archives/2007/04/html_5.html PPK
> > suggests having an attribute for storing private data for scripts.
> >
>
> I'm having a hard time seeing what you're talking about here. When PPK
> says
> "This attribute [to store data for unobtrusive scripts] should be valid
> for
> all HTML elements. " I'm rather sure I've lost you.
>
> Sometimes, I'll stick a long string inside an invisible textarea just so
> as
> to give JavaScript something to chew on -- then I can use string.split to
> pull the data apart. Is that what you mean? I rather doubt it.
>
> By "private" you don't really mean inaccessible to end users do you?
>
> I think I need an example to understand.
>
> regards,
> David
>
>
>


-- 
Jon Barnett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20070409/6db9a86e/attachment.htm>

Received on Monday, 9 April 2007 12:37:31 UTC