Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 26th, 2005, 09:35 AM
Forrest
Guest
 
Posts: n/a
Default the canonical structure of links in lists?

A certain person thinks this format is acceptable:

<ul>
<a href="http://foo.com"><li>Foo</a>
<a href="http://bar.com"><li>Bar</a>
</ul>

This happens to fail to display properly in KHTML, i.e. Konqueror and
probably Safari.

I suggest it should be thus:

<ul>
<li><a href="http://foo.com">Foo</a>
<li><a href="http://bar.com">Bar</a>
</ul>

He disagrees.

Is there any technical reason to prefer the latter to the former?



.................................................. ...............
Posted via TITANnews - Uncensored Newsgroups Access[color=blue][color=green][color=darkred]
>>>> at http://www.TitanNews.com <<<<[/color][/color][/color]
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-

  #2  
Old July 26th, 2005, 10:05 AM
Philip Ronan
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

"Forrest" wrote:
[color=blue]
> [Re "<ul><a href="http://foo.com"><li>Foo</a>..."
> vs. "<ul><li><a href="http://foo.com">Foo</a>..."]
>
> Is there any technical reason to prefer the latter to the former?[/color]

According to the HTML DTD (document type definition), a UL element can only
contain one or more LI elements, while an LI element can contain a mixture
of block and inline elements (that's what "%flow" represents)

<!ELEMENT UL - - (LI)+ -- unordered list -->
<!ELEMENT LI - O (%flow;)* -- list item -->

So that means the hyperlinks should be *inside* the LI elements (i.e.,
"<li><a>", not "<a><li>" (a closing "</li>" tag is implied).

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/


  #3  
Old July 27th, 2005, 01:25 AM
David Ross
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

Forrest wrote:[color=blue]
>
> A certain person thinks this format is acceptable:
>
> <ul>
> <a href="http://foo.com"><li>Foo</a>
> <a href="http://bar.com"><li>Bar</a>
> </ul>
>
> This happens to fail to display properly in KHTML, i.e. Konqueror and
> probably Safari.
>
> I suggest it should be thus:
>
> <ul>
> <li><a href="http://foo.com">Foo</a>
> <li><a href="http://bar.com">Bar</a>
> </ul>
>
> He disagrees.
>
> Is there any technical reason to prefer the latter to the former?
>[/color]

Have this person complete the page. Then have him or her test it
at <URL:http://validator.w3.org/>. This can be done via an upload
of a local file; it doesn't have to be installed on a Web server.

By the way, since Safari uses an HTML engine based on Gecko, any
problem with Safari likely affects Mozilla and Firefox, too.

--

David E. Ross
<URL:http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <URL:http://www.mozilla.org/>.
  #4  
Old July 27th, 2005, 02:25 AM
Spartanicus
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

David Ross <nobody@nowhere.not> wrote:
[color=blue]
>By the way, since Safari uses an HTML engine based on Gecko[/color]

Wrong, Safari is KHTML based.

--
Spartanicus
  #5  
Old July 27th, 2005, 04:25 PM
Forrest
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

Philip Ronan wrote:
[color=blue]
> According to the HTML DTD (document type definition), a UL element can only
> contain one or more LI elements[/color]

Grazie. I thought that was the case, but didn't grasp the W3C's
techiest pages.



.................................................. ...............
Posted via TITANnews - Uncensored Newsgroups Access[color=blue][color=green][color=darkred]
>>>> at http://www.TitanNews.com <<<<[/color][/color][/color]
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-

  #6  
Old July 27th, 2005, 04:25 PM
Forrest
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

David Ross wrote:
[color=blue]
> Have this person complete the page. Then have him or her test it
> at <URL:http://validator.w3.org/>.[/color]

[webpause]

It fails, but I think he's keeping the format for philosophical reasons.

Thank you.



.................................................. ...............
Posted via TITANnews - Uncensored Newsgroups Access[color=blue][color=green][color=darkred]
>>>> at http://www.TitanNews.com <<<<[/color][/color][/color]
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-

  #7  
Old July 27th, 2005, 04:55 PM
Alan J. Flavell
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

On Wed, 27 Jul 2005, Forrest wrote:
[color=blue]
> Philip Ronan wrote:
>[color=green]
> > According to the HTML DTD (document type definition), a UL element
> > can only contain one or more LI elements[/color]
>
> Grazie. I thought that was the case, but didn't grasp the W3C's
> techiest pages.[/color]

A formal validator (such as the one at the W3C) easily answers such
questions, whether or not one is able to read a DTD.

And the answer will be more reliable than the typical answer that one
would get from usenet (present company excepted, of course ;-)

best regards
  #8  
Old July 27th, 2005, 09:25 PM
Blinky the Shark
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

Forrest wrote:[color=blue]
> David Ross wrote:[/color]
[color=blue][color=green]
>> Have this person complete the page. Then have him or her test it
>> at <URL:http://validator.w3.org/>.[/color][/color]
[color=blue]
> [webpause][/color]
[color=blue]
> It fails, but I think he's keeping the format for philosophical reasons.[/color]

Philosophical reasons?

--
Blinky Linux Registered User 297263
Killing all Usenet posts from Google Groups
Info: http://blinkynet.net/comp/uip5.html
*ALSO contains links for access to the NON-BETA GG archive interface*
  #9  
Old July 28th, 2005, 03:05 AM
RobG
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

Blinky the Shark wrote:[color=blue]
> Forrest wrote:[/color]
[...][color=blue]
>[color=green]
>>It fails, but I think he's keeping the format for philosophical reasons.[/color]
>
>
> Philosophical reasons?
>[/color]

Probably the philosophy that users will be impressed to see different
representations of the page depending on how their UA decides to
untangle the mess.

Or that 'it works in /some_browser/ so it must be right'


--
Rob
  #10  
Old July 28th, 2005, 05:55 AM
Stan Brown
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

On Tue, 26 Jul 2005 04:31:09 -0400, Forrest
<gmauslander@hotmail.com> wrote:
[color=blue]
>A certain person thinks this format is acceptable:
>
><ul>
> <a href="http://foo.com"><li>Foo</a>
> <a href="http://bar.com"><li>Bar</a>
></ul>
>
>This happens to fail to display properly in KHTML, i.e. Konqueror and
>probably Safari.
>
>I suggest it should be thus:
>
><ul>
> <li><a href="http://foo.com">Foo</a>
> <li><a href="http://bar.com">Bar</a>
></ul>
>
>He disagrees.
>
>Is there any technical reason to prefer the latter to the former?[/color]

Sure -- the latter is correct HTML, and the former is not.

A <ul> can contain only <li> elements, not bare text.


--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
  #11  
Old July 31st, 2005, 12:15 AM
Forrest
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

RobG wrote:
[color=blue][color=green][color=darkred]
>>> It fails, but I think he's keeping the format for philosophical reasons.[/color][/color][/color]
[color=blue][color=green]
>> Philosophical reasons?[/color][/color]
[color=blue]
> Probably the philosophy that users will be impressed to see different
> representations of the page depending on how their UA decides to
> untangle the mess.[/color]

Apparently putting the anchor outside the list item is the only way to
get the list item icon (bullet, etc.) to be clickable.

When the validator calls doing so an error, it's a flaw in the validator
and, simultaneously, a well-known, tacitly acknowledged oversight in the
specification.

Also, browsers that don't render the code as intended are the problem:
by so failing they are unforgivably, dangerously, hacker-exploitably
flawed. Which is why (I guess) one shouldn't use an unsymboled list
style and put the bullets in the list items by hand.



.................................................. ...............
Posted via TITANnews - Uncensored Newsgroups Access[color=blue][color=green][color=darkred]
>>>> at http://www.TitanNews.com <<<<[/color][/color][/color]
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-

  #12  
Old July 31st, 2005, 03:45 AM
RobG
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

Forrest wrote:[color=blue]
> RobG wrote:
>[color=green][color=darkred]
>>>> It fails, but I think he's keeping the format for philosophical
>>>> reasons.[/color][/color]
>
>[color=green][color=darkred]
>>> Philosophical reasons?[/color][/color]
>
>[color=green]
>> Probably the philosophy that users will be impressed to see different
>> representations of the page depending on how their UA decides to
>> untangle the mess.[/color]
>
>
> Apparently putting the anchor outside the list item is the only way to
> get the list item icon (bullet, etc.) to be clickable.[/color]

Thank you for explaining the intention of the markup - I didn't
realise that was the reason.
[color=blue]
>
> When the validator calls doing so an error, it's a flaw in the validator[/color]

Not at all. The validator's job is to rigidly test against a DTD and
report the results, nothing more.
[color=blue]
> and, simultaneously, a well-known, tacitly acknowledged oversight in the
> specification.[/color]

Now that may be closer to the point - that you'd like the bullet
symbol included in the link. I guess UI specialists can argue the
pros and cons of that one long and hard. I'll just point out that a
label element can be used to make the label of a radio or checkbox
'clickable', but rarely is it employed (in my limited experience of
course).
[color=blue]
>
> Also, browsers that don't render the code as intended are the problem:[/color]

The only means of communication you have with a browser is source code
(ignoring scripting), the languages you have are HTML & CSS, so you
must convey your intentions via those media. If they are lacking,
then that is a problem with either the languages or your ability to
use them, not the browser.

I don't think you can deride a browser that shows invalid markup
differently to how some other browser may wish to show it - you can
only observe that they chose to do different things with it.
[color=blue]
> by so failing they are unforgivably, dangerously, hacker-exploitably
> flawed.[/color]

I can't see how not displaying invalid markup makes a browser
'dangerously, hacker-exploitably flawed'. Where's the exploit?
[color=blue]
> Which is why (I guess) one shouldn't use an unsymboled list
> style and put the bullets in the list items by hand.[/color]

I would think the only issue with hand-coded bullets is code bloat -
but that shouldn't be too much of an issue if a symbol is used rather
than an image of the symbol.

<ul>
<li><a href="#">&bull;&nbsp;apple
<li><a href="#">&bull;&nbsp;pear
<li><a href="#">&bull;&nbsp;orange
</ul>

There is an excellent resource at:

<URL:http://www.cs.tut.fi/~jkorpela/chars.html>




--
Rob
  #13  
Old July 31st, 2005, 03:55 AM
RobG
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

RobG wrote:[color=blue]
> Forrest wrote:
>[color=green]
>> RobG wrote:
>>[color=darkred]
>>>>> It fails, but I think he's keeping the format for philosophical
>>>>> reasons.[/color]
>>
>>
>>[color=darkred]
>>>> Philosophical reasons?[/color]
>>
>>
>>[color=darkred]
>>> Probably the philosophy that users will be impressed to see different
>>> representations of the page depending on how their UA decides to
>>> untangle the mess.[/color]
>>
>>
>>
>> Apparently putting the anchor outside the list item is the only way to
>> get the list item icon (bullet, etc.) to be clickable.[/color]
>
>
> Thank you for explaining the intention of the markup - I didn't realise
> that was the reason.
>[color=green]
>>
>> When the validator calls doing so an error, it's a flaw in the validator[/color]
>
>
> Not at all. The validator's job is to rigidly test against a DTD and
> report the results, nothing more.
>[color=green]
>> and, simultaneously, a well-known, tacitly acknowledged oversight in
>> the specification.[/color]
>
>
> Now that may be closer to the point - that you'd like the bullet symbol
> included in the link. I guess UI specialists can argue the pros and
> cons of that one long and hard. I'll just point out that a label
> element can be used to make the label of a radio or checkbox
> 'clickable', but rarely is it employed (in my limited experience of
> course).
>[color=green]
>>
>> Also, browsers that don't render the code as intended are the problem:[/color]
>
>
> The only means of communication you have with a browser is source code
> (ignoring scripting), the languages you have are HTML & CSS, so you must
> convey your intentions via those media. If they are lacking, then that
> is a problem with either the languages or your ability to use them, not
> the browser.
>
> I don't think you can deride a browser that shows invalid markup
> differently to how some other browser may wish to show it - you can only
> observe that they chose to do different things with it.
>[color=green]
>> by so failing they are unforgivably, dangerously, hacker-exploitably
>> flawed.[/color]
>
>
> I can't see how not displaying invalid markup makes a browser
> 'dangerously, hacker-exploitably flawed'. Where's the exploit?
>[color=green]
>> Which is why (I guess) one shouldn't use an unsymboled list
>> style and put the bullets in the list items by hand.[/color]
>
>
> I would think the only issue with hand-coded bullets is code bloat - but
> that shouldn't be too much of an issue if a symbol is used rather than
> an image of the symbol.[/color]

Ooops, forgot to insert:

<style type="text/css">
ul { list-style: none; }
</style>

....
[color=blue]
>
> <ul>
> <li><a href="#">&bull;&nbsp;apple
> <li><a href="#">&bull;&nbsp;pear
> <li><a href="#">&bull;&nbsp;orange
> </ul>
>
> There is an excellent resource at:
>
> <URL:http://www.cs.tut.fi/~jkorpela/chars.html>
>
>
>
>[/color]
  #14  
Old July 31st, 2005, 08:55 AM
Spartanicus
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

Forrest <gmauslander@hotmail.com> wrote:
[color=blue]
>Apparently putting the anchor outside the list item is the only way to
>get the list item icon (bullet, etc.) to be clickable.[/color]

http://homepage.ntlworld.com/spartanicus/temp.htm

Works in a proper browser such as Opera, and IE.
[color=blue]
>When the validator calls doing so an error, it's a flaw in the validator[/color]

Bshit, if a document conforms to the DTD, it's valid.
[color=blue]
>and, simultaneously, a well-known, tacitly acknowledged oversight in the
>specification.[/color]

Well-known amongst the ignorant perhaps.
[color=blue]
>Also, browsers that don't render the code as intended are the problem:[/color]

There is only one benchmark: rendering as per the w3c specifications.
"Rendering as intended" is often used to mean "as the author intended",
which is something IE is often guilty of, breaking spec compliant
behaviour in the process.

--
Spartanicus
  #15  
Old July 31st, 2005, 12:35 PM
Lachlan Hunt
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

Spartanicus wrote:[color=blue]
> Forrest <gmauslander@hotmail.com> wrote:[color=green]
>>Apparently putting the anchor outside the list item is the only way to
>>get the list item icon (bullet, etc.) to be clickable.[/color]
>
> http://homepage.ntlworld.com/spartanicus/temp.htm
>
> Works in a proper browser such as Opera, and IE.[/color]

Something like this works a little better in FF:

ul li { list-style-type: none; }
ul li a { display: list-item; list-style-type: disc;
list-style-position: inside; }

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
  #16  
Old July 31st, 2005, 11:05 PM
Blinky the Shark
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

Spartanicus wrote:
[color=blue]
> Bshit, if a document conforms to the DTD, it's valid.[/color]

Deprecated. Use <shit class="bull">

--
Blinky Linux Registered User 297263

Killing All Posts from GG: http://blinkynet.net/comp/uip5.html
End Of The Good GG Archive GUI: http://blinkynet.net/comp/gggui.html
  #17  
Old August 1st, 2005, 02:25 PM
Forrest
Guest
 
Posts: n/a
Default Re: the canonical structure of links in lists?

Spartanicus wrote:
[color=blue]
> http://homepage.ntlworld.com/spartanicus/temp.htm
>
> Works in a proper browser such as Opera, and IE.[/color]

Interestingly enough, when the other fellow starts using the HTML 4
link-close tag, his code will render correctly on Konqueror -- just as
yours does.
[color=blue]
> There is only one benchmark: rendering as per the w3c specifications.[/color]

Sounds right to me...



.................................................. ...............
Posted via TITANnews - Uncensored Newsgroups Access[color=blue][color=green][color=darkred]
>>>> at http://www.TitanNews.com <<<<[/color][/color][/color]
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles