[whatwg] Attributes vs. Elements

On Mon, 12 Mar 2007, carmen wrote:
> >
> > Finally, I'd like to conclude with this reductio ad absurdum of the 
> > XHTML2 approach. If assigning behavior and semantics to attributes is 
> > so much better, why not just have a single <elt> element:
> > 
> > <elt role="paragraph">My cat is really cute: <elt 
> > src="mycat.jpeg">picture of my cat</elt>. Check out <elt 
> > href="story.html">this <elt role="emphasis">hilarious</elt> story 
> > about her</elt>.</elt>
> 
> this is a valid approach. the next step is to factor out <elt> and 
> simplify the syntax, preferably reusing JSON or the Relax-NG compact 
> syntax. then it would be more readable than either suggestion here.

Let's try to simplify it to XML, since XML is so popular. First, we
have to make the example a bit more explicit about what it is doing,
because right now it doesn't say what kind of link the src="" and
href="" attributes are creating (are they linking script? stylesheets?
a permalink for the page?):

  <elt role="paragraph">My cat is really cute: <elt rel="image"
  src="mycat.jpeg">picture of my cat</elt>. Check out <elt
  rel="hyperlink" href="story.html">this <elt
  role="emphasis">hilarious</elt> story about her</elt>.</elt>

Now let's see what we can do about making it simpler...

   <elt role="paragraph"> could be <p>
   <elt rel="image" src="..."> could be <img src="...">
   <elt rel="hyperlink" href="..."> could be <a href="...">
   <elt role="emphasis"> could be <em>

...so we now have:

   <p>My cat is really cute: <img src="mycat.jpeg">picture of my
   cat</img>. Check out <a href="story.html">this <em>hilarious</em>
   story about her</a>.</p>

...and we're nearly back to HTML!


> i also think its important that userdefined elements can inherit
> from other elements via the normal ECMAscript prototype idioms, so
> that one can eg, <time>.property("dc:date").prototype = <span>,
> we'll always have semantic ambiguity and shoehorning of semantics
> into classnames and other attributes until theres the equivalent of
> the stylesheet providing referencable URIs describing any element -
> unless we want to stick to the boring world where theres only the
> elements that enough people could agree upon.

I really don't understand what you're proposing here. What is the
problem you are trying to solve?

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

Received on Monday, 12 March 2007 14:22:40 UTC