[whatwg] Adding a src attribute to all elements

On Tue, 3 Nov 2009, Curtiss Grymala wrote:
>
> 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.

What's the use case?


> 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.

This seems like a presentational concern, and thus should be handled by 
CSS. And indeed, it is; CSS3 has a 'content' property for this.


> 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.

Isn't <object> adequate for this? As in:

   <object src="/example.txt">This is some other text</object>

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

Received on Thursday, 10 December 2009 05:29:54 UTC