[whatwg] Suggestion: "context" attribute

For clarity, I'm reposting my sample code:

------------------------------------------------------------

<div id="myPopup" repeat="template">
<p>Random popup stuff</p>
</div>

<input type="text" value="some text" context="myPopup">

------------------------------------------------------------

Martin Kutschker wrote:
 > Why abuse an attribute? I like the general idea, but would
 > favour either a new element instead of div or another new attribute.

    And exactly how would that work? Like this?:

------------------------------------------------------------

<popup id="myPopup">
   <p>Random popup stuff</p>
</popup>

<haspopup value="myPopup">
   <input type="text" value="some text">
</haspopup>

------------------------------------------------------------

    I have the following problems with this approach:

1) If you avoid the WF2 template model, it requires new two new tags, 
not one, as you can see. The repeat attribute already exists in WF2, so 
why not use it?

2) It doesn't fix any of the problems from my previous example. The 
content inside the tag is still rendered in legacy UAs. Worse, at least 
with a <div> you could set the CSS property "display" to "none". If you 
try doing that with an undefined element in IE, the contents of the tag 
are still displayed.

3) You could make it to where the contents of <popup> solely consist of 
a new set of elements that create menus (such as the XUL Basic 
"Keymaster" elements), but that's far less powerful, and the contents of 
<popup> becomes useless for simple Javascript. This would force the use 
a WF2 emulation layer in order for IE to use the contents of <popup>. 
Either that or implement two completely separate and redundant popup 
implementations, in which case you might as well drop <popup> all 
together and just go with a custom Javascript solution.

4) The context attribute already exists in XUL, and my solution only 
adds a single attribute. Why is this single attribute, which takes 
advantage of a preexisting WF2 feature, so offensive to you?

    I think I have a solution for the template problem, though. Stay tuned.

Received on Friday, 25 June 2004 13:16:37 UTC