W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2009

[whatwg] Adding a src attribute to all elements

From: Nils Dagsson Moskopp <nils-dagsson-moskopp@dieweltistgarnichtso.net>
Date: Wed, 4 Nov 2009 03:49:00 +0100
Message-ID: <20091104034900.4c137cd3@desudesudesu>
Am Tue, 03 Nov 2009 21:05:26 -0500
schrieb Curtiss Grymala <curtiss at ten-321.com>:

> I would like to propose that a src attribute be added to the spec for
> all HTML elements. The content of the file referenced in the src
> attribute would then replace the contents of the element that contains
> the src attribute. The src attribute would then be interpreted
> differently, depending on the type of file referenced in that src
> attribute.

A perfectly good way to go confuse people, if you ask me.

> For instance, if I create a level 1 header that looks like:
> <h1 src="/example.png">This is a header</h1>
> The text "This is a header" would be replaced with the image that's
> located at /example.png. However, if /example.png returns a 404 error,
> the text would be displayed instead.

How is that different than this example ?
<h1><img src="/example.png" alt="Header Image"/></h1>

> If, however, I create a div that looks like:
> <div src="/example.txt">This is some other text</div>
> The text content of /example.txt would replace the text "This is some
> other text" within the div that I created. Again, though,
> if /example.txt returned a 404 error, then "This is some other text"
> would show up inside the div instead.

<iframe> and <object> elements are fine too.

> The contents of the file referenced in the src attribute would need to
> be parsed and rendered prior to replacing the initial content of the
> element. For instance, if I reference a PHP file in the src
> attribute, I would expect the PHP to be parsed before it shows up in
> my document.

I would suggest learning the semantics of the <iframe> element.
Also, PHP is server side, HTML is client side.

> I'm not sure if this is at all feasible, but I personally think it
> would be a great addition to the spec. Thank you.

What would be the use case for this ?

Nils Dagsson Moskopp // erlehmann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20091104/8fdf4934/attachment.pgp>
Received on Tuesday, 3 November 2009 18:49:00 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:18 UTC