W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2007

[whatwg] Anchor target-attribute extension to enable dom targeting

From: Georges MARZIN <gmarzin@club-internet.fr>
Date: Sun, 08 Apr 2007 23:22:20 +0200
Message-ID: <1176067340.5509.1.camel@localhost>
Le dimanche 08 avril 2007 ? 20:27 +0100, Kornel Lesinski a ?crit :
> On Sun, 08 Apr 2007 19:17:55 +0100, Georges MARZIN  
> <gmarzin at club-internet.fr> wrote:
> 
> >      <a href="inc/foo.frg" target="#main_area">
> >          Click here to dynamicaly load a text/html piece of code
into
> > the "main_area" identified dom node
> >      </a>
> >
> >      <!-- somewhere in the same document -->
> >      <div id="main_area"></div>
> >
> > The content of inc/foo.frg is not a complete html page but only a
well
> > formed xhtml piece of code like :
> >
> >     <div>
> >        this content is dynamically loaded into a dom node, like
ajax,
> >        but with a html extended syntax of the target property.
> >     </div>
> 
> IMHO it isn't much better than:
> 
> <a href="inc/foo.frg" target="main_area">
> <iframe name="main_area"></iframe>
> 
> It's still as evil as frames - subpages can't be used as standalone  
> documents (thus bookmarked, returned by search engines, etc), because
they  
> lack proper navigation menus and in your example they're not even
proper  
> documents.
> 
> I think that much better and more powerful solution are ID overlays.
The  
> idea is to merge documents instead of completly including one into  
> another. XUL has something like that:
> http://developer.mozilla.org/en/docs/XUL_Tutorial:Overlays
> 

When using iframe, the content is treated like a complete and separate
html page. So you have in your document a second page completely
different from the main document. So, if you want for this sub-page the
same comportment and appearance as the main page, you need to write a
complete head section with scripts and css, and to be careful to have
compatibility with the main page head section.

With iframe, again, you need to set width and height and the content is
usually displayed with scroll-bars, and it is awful. 

If you just need to modify a small part of your document like displaying
pictures or response coming back a form php script, the iframe solution
is a heavy and ugly solution.

It's why I thought about another way with a very small modification of
the syntaxe of the target attribute : why not specify a dom id with a
"#", so it is easy to read and to understand. The "#" symbol mean id in
css stylesheet. There is no possible confusion with targeting names of
frames or targeting _blank or _top...

The small html fragment can be a seperate static file, or contextual php
results, like :

<div id="response">The response is : </div>
<a href="answer.php?question=something&param=someparam"
target="#response">click!</a>

When the response will arrive, css rules will apply to the new content,
and the result will be smart.

Usually to do this you must use onclick and xmlHttpRequest. You have to
define functions to create the object, choose GET or POST, define a
callback function, and so on..

With the syntaxe I propose it is really easier. (a have write a small
script which implement this syntaxe. The html code is quite simpler with
it).

A demo is (in french) at this address : http://lomago.com/xhtarget 

I am interested with your solution of xul-like id overlay for merging
documents. But I know this for xul, but not for html. How can it work ?

Thank you very much, and read you soon...
Received on Sunday, 8 April 2007 14:22:20 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:34 UTC