Re: [whatwg] Adding a src attribute to all elements

2009-12-10 Thread Ian Hickson
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.pngThis 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.txtThis 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.txtThis is some other text/object

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


Re: [whatwg] Adding a src attribute to all elements

2009-11-04 Thread Markus Ernst

Tab Atkins Jr. schrieb:

On Tue, Nov 3, 2009 at 8:21 PM, Michael A. Puls II shadow2...@gmail.com wrote:

On Tue, 03 Nov 2009 21:05:26 -0500, Curtiss Grymala curt...@ten-321.com
wrote:

For instance, if I create a level 1 header that looks like:
h1 src=/example.pngThis 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.

Opera supports this with css extensions.


This is supported in the CSS specs properly, via the content property.

*[src] {
  content: attr(src,url);
}


If I understand things correctly, your example seems a little bit 
confusing to me. The *[src] selector selects elements with a src 
attribute specified, which does not apply to h1 (if valid HTML5). 
Maybe abusing another attribute could work then? (I apologize if the 
example is stupid - I spent some time studying CSS3 now, but am not 
really familiar with the recommendations yet.)


h1 {
  content: attr(title,url);
}

And the HTML:
h1 title=pix/aheadline.gifA headline/h1

Looks quite ugly, if it would work at all. To match Curtiss' suggestion 
with CSS you would possibly rather use the style attribute, something like:


h1 style=content: url(pix/aheadline.gif)A headline/h1


Re: [whatwg] Adding a src attribute to all elements

2009-11-04 Thread Michael A. Puls II

On Wed, 04 Nov 2009 05:03:49 -0500, Markus Ernst derer...@gmx.ch wrote:


Tab Atkins Jr. schrieb:
On Tue, Nov 3, 2009 at 8:21 PM, Michael A. Puls II  
shadow2...@gmail.com wrote:

On Tue, 03 Nov 2009 21:05:26 -0500, Curtiss Grymala curt...@ten-321.com
wrote:
For instance, if I create a level 1 header that looks like:
h1 src=/example.pngThis 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.
Opera supports this with css extensions.
 This is supported in the CSS specs properly, via the content property.
 *[src] {
  content: attr(src,url);
}
 If I understand things correctly, your example seems a little bit  
confusing to me. The *[src] selector selects elements with a src  
attribute specified, which does not apply to h1 (if valid HTML5)


*[data-my-src] {}
h1 data-my-src=

--
Michael


Re: [whatwg] Adding a src attribute to all elements

2009-11-04 Thread Tab Atkins Jr.
On Wed, Nov 4, 2009 at 2:03 AM, Markus Ernst derer...@gmx.ch wrote:
 Tab Atkins Jr. schrieb:
 *[src] {
  content: attr(src,url);
 }

 If I understand things correctly, your example seems a little bit confusing
 to me. The *[src] selector selects elements with a src attribute specified,
 which does not apply to h1 (if valid HTML5). Maybe abusing another
 attribute could work then? (I apologize if the example is stupid - I spent
 some time studying CSS3 now, but am not really familiar with the
 recommendations yet.)

 h1 {
  content: attr(title,url);
 }

 And the HTML:
 h1 title=pix/aheadline.gifA headline/h1

 Looks quite ugly, if it would work at all. To match Curtiss' suggestion with
 CSS you would possibly rather use the style attribute, something like:

 h1 style=content: url(pix/aheadline.gif)A headline/h1

Yes, it's using the invalid @src attribute, simply because that's what
was asked for by the OP.  Using a valid attribute like @title, or
better yet a new attribute like @data-my-src suggested by Puls, would
work equally well.  CSS just doesn't care about HTML's attribute
validity requirements.

~TJ


[whatwg] Adding a src attribute to all elements

2009-11-03 Thread Curtiss Grymala
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.

For instance, if I create a level 1 header that looks like:
h1 src=/example.pngThis 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.

If, however, I create a div that looks like:
div src=/example.txtThis 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.

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




Curtiss Grymala
curt...@ten-321.com




Re: [whatwg] Adding a src attribute to all elements

2009-11-03 Thread Remco
On Wed, Nov 4, 2009 at 03:05, Curtiss Grymala curt...@ten-321.com 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.

I tried to do something similar: I tried to get the alt attribute on
all elements with external content. That would have made the HTML
specification more consistent. But I think we have to accept that HTML
is not a beautiful streamlined well-designed language. Everything you
add to the specification needs to be implemented by all browsers. They
all need to see the merit of it. Can you think of a good use case for
this? What problem would it solve? If you can convince people that
they have a problem which you solve, then you're in business.

 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.

Minor nitpick: HTML does not influence that. A PHP file is translated
into HTML on the server and then that HTML is served to the browser.
The browser always only sees HTML. The .php extension has no meaning.
It could just as well be .html or .foobar.

-- 
Remco


Re: [whatwg] Adding a src attribute to all elements

2009-11-03 Thread Nils Dagsson Moskopp
Am Tue, 03 Nov 2009 21:05:26 -0500
schrieb Curtiss Grymala curt...@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.pngThis 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 ?
h1img src=/example.png alt=Header Image//h1

 If, however, I create a div that looks like:
 div src=/example.txtThis 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
http://dieweltistgarnichtso.net


signature.asc
Description: PGP signature


Re: [whatwg] Adding a src attribute to all elements

2009-11-03 Thread Michael A. Puls II
On Tue, 03 Nov 2009 21:05:26 -0500, Curtiss Grymala curt...@ten-321.com  
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.

For instance, if I create a level 1 header that looks like:
h1 src=/example.pngThis 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.


Opera supports this with css extensions.

For example:

!DOCTYPE html
style
*[src] {
-o-replace: attr(src);
width: attr(width);
height: attr(height);
display: inline-block;
border: 1px solid black;
}
*[href] {
-o-link: attr(href);
-o-link-source: current;
display: inline;
text-decoration: underline;
color: blue;
}
/* in XML */
image_link[src] {
-o-link: attr(src) !important;
-o-link-source: current;
-o-replace: attr(src);
display: inline-block;
border: 1px solid blue;
text-decoration: underline;
color: blue;
}
/style
h1 src=http://www.google.com/images/logo.gif; width=300  
height=150fallback/h1

div href=http://hardocp.com/;test/a
image_link  
src=http://www.google.com/images/logo.gif;fallback/image_link


However, -o-replace seems broken, -o-link doesn't always work right,  
attr() doesn't always work right, you can't specify the type/unit of what  
attr() returns (although I think there's a spec for that that no vendor  
follows) and using -o-link with -o-replace probably wouldn't work if  
-o-replace worked right. You can try in Opera 8.x maybe. It might work  
better there.


So, the support is all broken and limited. However, I've always loved the  
idea of it and even like that it's done via CSS. Whether it's more  
semantic to use img inside something and a around something or not  
doesn't really matter to me.


So, I think the end result of having all elements support @src and @href  
(not necessarily with css like above) would be cool. Yet, vendor devs have  
said that it'd be a pain and or annoying to implement, so...


I don't feel super strongly about it though. I just think it'd be  
nice/cool.


--
Michael


Re: [whatwg] Adding a src attribute to all elements

2009-11-03 Thread Nils Dagsson Moskopp
Am Tue, 03 Nov 2009 23:21:35 -0500
schrieb Michael A. Puls II shadow2...@gmail.com:

 I don't feel super strongly about it though. I just think it'd be  
 nice/cool.
 
And I want a Pony !! ;)

-- 
Nils Dagsson Moskopp // erlehmann
http://dieweltistgarnichtso.net


Re: [whatwg] Adding a src attribute to all elements

2009-11-03 Thread Tab Atkins Jr.
On Tue, Nov 3, 2009 at 8:21 PM, Michael A. Puls II shadow2...@gmail.com wrote:
 On Tue, 03 Nov 2009 21:05:26 -0500, Curtiss Grymala curt...@ten-321.com
 wrote:
 For instance, if I create a level 1 header that looks like:
 h1 src=/example.pngThis 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.

 Opera supports this with css extensions.

This is supported in the CSS specs properly, via the content property.

*[src] {
  content: attr(src,url);
}

Done.  (Doesn't work yet anywhere I believe, but it will.)

~TJ


Re: [whatwg] Adding a src attribute to all elements

2009-11-03 Thread Michael A. Puls II
On Tue, 03 Nov 2009 23:50:43 -0500, Tab Atkins Jr. jackalm...@gmail.com  
wrote:


On Tue, Nov 3, 2009 at 8:21 PM, Michael A. Puls II  
shadow2...@gmail.com wrote:
On Tue, 03 Nov 2009 21:05:26 -0500, Curtiss Grymala  
curt...@ten-321.com

wrote:

For instance, if I create a level 1 header that looks like:
h1 src=/example.pngThis 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.


Opera supports this with css extensions.


This is supported in the CSS specs properly, via the content property.

*[src] {
  content: attr(src,url);
}

Done.  (Doesn't work yet anywhere I believe, but it will.)


Cool. Thanks

--
Michael