[whatwg] Suggestion: <ignore> element.

Ian Hickson ian at hixie.ch
Wed Jul 7 06:35:30 PDT 2004


On Mon, 5 Jul 2004, Matthew Raymond wrote:
> Mike Shaver wrote:
>> I like it, and I think that future-proofing it via a version or
>> unless="webforms2" attribute, like was done for <script
>> language="JavaScript1.1"> would make it even better.
>
> Dave Hodder wrote:
>> Sounds good to me, although quite what is being <ignore>d seems a
>> little ambiguous from the name of the element.  It seems very similar
>> to the various <noscript>, <noembed>, <noframes> type tags -- so
>> perhaps it could have a more descriptive name, e.g.
>> <nowebforms version="2.0"> or <nowebforms2> or similar?
>>
>> (Just a thought.)
>
> It was explained to me by Ian that you can't depend on the user
> agent to correctly report what standards it supports. Therefore, putting
> in an attribute with specific values for standards won't work, nor will
> using standard-specific tags.

Right -- per-feature versioning doesn't work, as shown by DOM's
hasFeature(); doesn't scale, as shown by SVG's feature strings; and it
would be hard for UAs to decide whether they should claim support or not,
as shown by CSS.

And indeed it doesn't if the syntax is an attribute or an element, the
same problems apply.

The only time it can really work is when the feature is very easy to
determine support for, like frames or scripts. Either you do or you don't,
it's pretty obvious which. That's why <noframes> and <noscript> work. Or
at least sort-of work. Even they have problems, and I'm not convinced
they are good design.


> However, the following might be a better idea:
>
> <ignore if="WF2Compliant()">
>    ...Content...
> </ignore>
>
> The value of the |if| attribute would be a script that would return a
> true or false value. The default for |if| would be "true". In this
> manner, people can come up with their own scripts to determine if the
> contents of the element should be ignored. Also, if methods of detecting
> standards support become more reliable in the future, it can simply be
> coded into a Javascript function called by the |if| attribute.

We can do that now. Just put the content you want in there, then, using
script, delete it if it isn't. As in, instead of the above, do:

   <div id="x">
      ...Content...
   </div>
   <script type="text/javascript">
      if (!WF2Compliant()) {
         var x = document.getElementById('x');
         x.parentNode.removeChild(x);
      }
   </script>

You can also do the opposite, indeed it is very common practice to
document.write() document fragments like this.


I'm still not convinced there is a use case here, anyway. Why are we
wanting to ignore content?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list