[whatwg] [WA1] The a element could be empty

Matthew Raymond mattraymond at earthlink.net
Sat Sep 3 00:10:17 PDT 2005

Jim Ley wrote:
> On 9/2/05, Matthew Raymond <mattraymond at earthlink.net> wrote:
>>1) Why wouldn't you want the content in the element to be inserted by
>>Javascript when the page loads when you can just include the content in
>>markup and hide it using CSS?
> Not particularly wanting to support the OP's issue - I don't see a
> problem with the change to the content model of a to require content,
> it's a good thing.  However styling a link to print away is not a good
> idea, as it means those without css get a link which does nothing,

   Nothing in a print out does anything. If you're using events like
|onbeforeprint| and |onafterprint|, CSS is still good as a fallback for
browsers that support CSS but not the events. Then again, the user could
just do this:

| // Code to prepare the DOM for printing.
| window.print();
| // Code to restore the DOM after printing.

   That's, of course, assuming that window.print() halts the script
until it's complete. Then again, if the browser is printing from a
static copy of the DOM rather than the DOM itself, it may not matter. I
guess it depends on how window.print() is defined and what the
implementation does.

> of
> course it's still possible with the method in the OP's post that the
> user gets a nothing link, but that doesn't mean the link existing in
> the source is a good idea.

   How many user agents support Javascript but not CSS1? Does Lynx or
some other text-mode browser support Javascript? I'll have to look into

>>3) How does your original example even prevent the content from being
>>viewed when printing?
> I don't think that's the purpose, I think the purpose is to ensure
> there's not content in the page which is purely behavioural and does
> nothing when script is not available.

   Makes sense. Personally, I'm wondering why you want to print from a
link at all unless you want to perform a special print operation.

More information about the whatwg mailing list