f



"Universal HTML"

  When one wants to write HTML that can be displayed in a wide
  range of browsers, including very old ones and HTML5 browsers,
  what should one observe?

  One can try to omit all element types that are only available
  under some versions: <tt> is not in HTML5, <section> is not in
  HTML 4.01.

  But what about the start of the document? Will the following
  start be acceptable for even very old browsers and HTML5
  browsers at the same time?:

<!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
<head><meta charset="UTF-8" /><title>Beispiel</title><style type="text/css">
</style></head><body>

  ? Of course, I could try it out all by myself, but I wonder 
  whether there is already some discussion about this topic,
  some attempt to find a common subset of all HTML versions that
  one can use for such purposes? Maybe someone already has 
  investigated this and has coined a phrase, such as �universal
  HTML�, for such a modest intersection.

  When one does not want to use any fancy stuff (videos, forms,
  frames, audio, animation, interaction), but just want to 
  display text with the most common markup (headings and text
  in italics), why should one bind oneself to a specific version
  of HTML (which then must be updated every decade or so)?

  Or can one safely assume that web browsers will �always�
  support HTML 4.01 (�always� = for the next decades) and thus
  use HTML 4.01 as that �eternal HTML�?

0
ram
4/6/2016 8:22:02 PM
comp.authoring.html 7078 articles. 0 followers. Post Follow

10 Replies
564 Views

Similar Articles

[PageSpeed] 3

6.4.2016, 23:22, Stefan Ram wrote:

>    When one wants to write HTML that can be displayed in a wide
>    range of browsers, including very old ones and HTML5 browsers,
>    what should one observe?

That�s a rather broad question. I will try to address the more specific 
questions asked.

>    One can try to omit all element types that are only available
>    under some versions: <tt> is not in HTML5, <section> is not in
>    HTML 4.01.

<tt> is still supported by �HTML5 browsers.� The HTML5 spec more or less 
recommends this, and even if it didn�t, the browser vendors would win 
nothing (and would lose something) by removing the support.

The <section> and </section> tags are ignored by old browsers. It is 
usually impossible to detect the difference between this and �support� 
to the <section> element. There is no requirement on any particular 
handling of that element, except that it is a block element, but even 
this does not matter in most contexts (since line breaks will be caused 
by other elements anyway).

It�s a different story if you set some styles on <section>. Then old 
versions of IE will ignore them, as it does not support styling any 
element that it does not know. There is a simple cure to this: just say 
�IE, meet <section>�:
<script>
document.createElement('section');
</script>

>    But what about the start of the document?

The doctype does not matter, except in the sense of triggering 
�standards� vs. �quirks� mode.

> <!DOCTYPE HTML>

This triggers �standards� mode in any browser that has one.

> <html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">

It really does not matter, except to those rare user agents that 
recognize and use the lang attribute.

> <head><meta charset="UTF-8" /><title>Beispiel</title><style type="text/css">
> </style></head><body>

What about that? I see no problem here. The <meta charset="UTF-8"> trick 
(or <meta charset="UTF-8" /> if you play XHTML) was specifically 
invented according to observed browser behavior. Due to certain parsing 
oddities, it works well in old browsers, too.

>    Or can one safely assume that web browsers will �always�
>    support HTML 4.01 (�always� = for the next decades) and thus
>    use HTML 4.01 as that �eternal HTML�?

No browser ever supported HTML 4.01, though most browsers currently in 
use support almost all of the HTML 4.01 features that are actually used 
by HTML authors.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/
0
Jukka
4/6/2016 8:53:52 PM
In article <nedqnn$ts8$1@dont-email.me>, jkorpela@cs.tut.fi says...
> 
> 10.4.2016, 15:58, Adam H. Kerman wrote:
> 
> > Jukka K. Korpela <jkorpela@cs.tut.fi> wrote:
> >
> >> . . . The doctype does not matter, except in the sense of triggering
> >> standards vs. quirks mode. . . .
> >
> > I assumed the purpose of the declaration was to allow a browser
> > to render tagged text according to a specific standard to allow for
> > the possibility of no backwards compatibility.
> 
> That?s a common but completely wrong assumption.
> 
> The doctype thing was introduced into HTML just because the designers of 
> HTML specifications wanted to retrofit HTML, an existing but not 
> formally defined markup language, into the framework of SGML. In SGML, a 
> doctype declaration has uses of its own, but none of that ever mattered 
> in web browsers. They did not not implement HTML as an SGML application.
> 
> The doctype string has later been taken into use in triggering one of 
> two or three browser modes, but these do not relate to HTML versions; 
> instead, they reflect different levels of adherence to the 
> specifications of various CSS and some HTML features. In one mode, the 
> CSS declaration width: 100 is ignored (as it must be according to all 
> CSS specs); in another mode, it is taken as width: 100px (which is what 
> the author most probably meant). This has absolutely nothing to do with 
> HTML versions, and still less with Document Type Definitions (which is 
> what doctype declarations refer to in SGML).
> 
> >> No browser ever supported HTML 4.01, though most browsers currently in
> >> use support almost all of the HTML 4.01 features that are actually used
> >> by HTML authors.
> >
> > May I have more information? 4.01 is from 1999. I thought you meant it
> > wasn't implemented immediately.
> 
> No, I meant literally that it was never implemented.
> 
> To begin with, try
> 
> <em/Hello world/
> 
> It is valid HTML 4.01 and equivalent to <em>Hello word</em> but browsers 
> choke on it.
> 
> To take an example from a different level, the align="char" attribute 
> was never implemented. It would be crucial for proper formatting of 
> numerical tables with decimal numbers. (And, while it?s not relevant to 
> the topic, it?s really no excuse that the attribute has a counterpart in 
> CSS, since that counterpart has not been implemented either.)

JKK is one contributor whose posts I invariably read, and invariably 
learn something useful from.
:-)


-- 

Phil, London
0
Philip
4/10/2016 1:01:01 AM
Jukka K. Korpela wrote:

> It’s a different story if you set some styles on <section>. Then old
> versions of IE will ignore them, as it does not support styling any
> element that it does not know. There is a simple cure to this: just say
> “IE, meet <section>”:
> <script>
> document.createElement('section');
> </script>

The “simple cure” introduces a dependency on another technique, client-side 
scripting.  Therefore, it is better to not style purely structural HTML5 
elements if “old versions of IE” are to be considered.
 
>> <!DOCTYPE HTML>
> 
> This triggers “standards” mode in any browser that has one.

It triggers Compatibility Mode in older IEs.
 
>> <html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
> 
> It really does not matter, except to those rare user agents that
> recognize and use the lang attribute.

The “lang” attribute can be used to trigger language-specific behavior in 
other user agents, too.  For example, it can be used and is used to apply 
stylesheet rules only in the context of a specific (group of) language(s), 
and it can be used and is used for selecting content for A/B tests with 
Optimizely.  BTDT.
 
>>    Or can one safely assume that web browsers will »always«
>>    support HTML 4.01 (»always« = for the next decades) and thus
>>    use HTML 4.01 as that »eternal HTML«?
> 
> No browser ever supported HTML 4.01, […]

Nonsense.


PointedEars
-- 
When all you know is jQuery, every problem looks $(olvable).
0
Thomas
4/10/2016 11:56:53 AM
Jukka K. Korpela wrote:

> It’s a different story if you set some styles on <section>. Then old
> versions of IE will ignore them, as it does not support styling any
> element that it does not know. There is a simple cure to this: just say
> “IE, meet <section>”:
> <script>
> document.createElement('section');
> </script>

The “simple cure” introduces a dependency on another technology, client-side 
scripting, needlessly.  Therefore, it is better to not style purely 
structural HTML5 elements if “old versions of IE” are to be considered.
 
>> <!DOCTYPE HTML>
> 
> This triggers “standards” mode in any browser that has one.

It triggers Compatibility Mode in older IEs.
 
>> <html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
> 
> It really does not matter, except to those rare user agents that
> recognize and use the lang attribute.

The “lang” attribute can be used to trigger language-specific behavior in 
other user agents, too.  For example, it can be used and is used to apply 
stylesheet rules only in the context of a specific (group of) language(s), 
and it can be used and is used for selecting content for A/B tests with 
Optimizely.  BTDT.
 
>>    Or can one safely assume that web browsers will »always«
>>    support HTML 4.01 (»always« = for the next decades) and thus
>>    use HTML 4.01 as that »eternal HTML«?
> 
> No browser ever supported HTML 4.01, […]

Nonsense.


PointedEars
-- 
When all you know is jQuery, every problem looks $(olvable).
0
Thomas
4/10/2016 11:57:45 AM
Jukka K. Korpela <jkorpela@cs.tut.fi> wrote:

>. . . The doctype does not matter, except in the sense of triggering 
>standards vs. quirks mode. . . . 

I assumed the purpose of the declaration was to allow a browser
to render tagged text according to a specific standard to allow for
the possibility of no backwards compatibility.

>No browser ever supported HTML 4.01, though most browsers currently in 
>use support almost all of the HTML 4.01 features that are actually used 
>by HTML authors.

May I have more information? 4.01 is from 1999. I thought you meant it
wasn't implemented immediately. What are examples of 4.01 features that
can't be rendered by the browser in a standard way?
0
Adam
4/10/2016 12:58:56 PM
10.4.2016, 15:58, Adam H. Kerman wrote:

> Jukka K. Korpela <jkorpela@cs.tut.fi> wrote:
>
>> . . . The doctype does not matter, except in the sense of triggering
>> standards vs. quirks mode. . . .
>
> I assumed the purpose of the declaration was to allow a browser
> to render tagged text according to a specific standard to allow for
> the possibility of no backwards compatibility.

That�s a common but completely wrong assumption.

The doctype thing was introduced into HTML just because the designers of 
HTML specifications wanted to retrofit HTML, an existing but not 
formally defined markup language, into the framework of SGML. In SGML, a 
doctype declaration has uses of its own, but none of that ever mattered 
in web browsers. They did not not implement HTML as an SGML application.

The doctype string has later been taken into use in triggering one of 
two or three browser modes, but these do not relate to HTML versions; 
instead, they reflect different levels of adherence to the 
specifications of various CSS and some HTML features. In one mode, the 
CSS declaration width: 100 is ignored (as it must be according to all 
CSS specs); in another mode, it is taken as width: 100px (which is what 
the author most probably meant). This has absolutely nothing to do with 
HTML versions, and still less with Document Type Definitions (which is 
what doctype declarations refer to in SGML).

>> No browser ever supported HTML 4.01, though most browsers currently in
>> use support almost all of the HTML 4.01 features that are actually used
>> by HTML authors.
>
> May I have more information? 4.01 is from 1999. I thought you meant it
> wasn't implemented immediately.

No, I meant literally that it was never implemented.

To begin with, try

<em/Hello world/

It is valid HTML 4.01 and equivalent to <em>Hello word</em> but browsers 
choke on it.

To take an example from a different level, the align="char" attribute 
was never implemented. It would be crucial for proper formatting of 
numerical tables with decimal numbers. (And, while it�s not relevant to 
the topic, it�s really no excuse that the attribute has a counterpart in 
CSS, since that counterpart has not been implemented either.)

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/
0
Jukka
4/10/2016 3:19:29 PM
Jukka K. Korpela <jkorpela@cs.tut.fi> wrote:

>That's a common but completely wrong assumption. . . . 

Thank you for the information.
0
Adam
4/10/2016 4:56:39 PM
On 10/04/2016 18:19, Jukka K. Korpela wrote:
> 10.4.2016, 15:58, Adam H. Kerman wrote:
>
>> Jukka K. Korpela <jkorpela@cs.tut.fi> wrote:
>>> No browser ever supported HTML 4.01, though most browsers currently in
>>> use support almost all of the HTML 4.01 features that are actually used
>>> by HTML authors.
>>
>> May I have more information? 4.01 is from 1999. I thought you meant it
>> wasn't implemented immediately.
>
> No, I meant literally that it was never implemented.

I was under the same impression, but after reviewing the examples you 
give, now I'm not so sure anymore, at least if the following applies:

browser support === conforming user agent

> To begin with, try
>
> <em/Hello world/
>
> It is valid HTML 4.01 and equivalent to <em>Hello word</em> but browsers
> choke on it.

IINM, this would be an SGML construct (SGML SHORTTAG) and documents that 
use them would be conforming SGML documents, but ISTM that there is no 
requirement for HTML conformance, as the spec says:

"SGML systems conforming to [ISO8879] are expected to recognize a number 
of features that aren't widely supported by HTML user agents. We 
recommend that authors avoid using all of these features."

Considering that:

"HTML document is an SGML document that meets the constraints of this 
specification."

Coupled with:

"A conforming user agent for HTML 4 is one that observes the mandatory 
conditions ("must") set forth in this specification..."

Coupled with the syntax for EM:

Start tag: required, End tag: required.

> To take an example from a different level, the align="char" attribute
> was never implemented.

On this the spec says:

"If a user agent doesn't support character alignment, behavior in the 
presence of this value is unspecified."

And later on the char attribute:

"User agents are not required to support this attribute."

But, maybe I'm missing something obvious, as usual :)

-- 
Best wishes, Osmo
0
Osmo
4/11/2016 3:29:46 PM
11.4.2016, 18:29, Osmo Saarikumpu wrote:
> On 10/04/2016 18:19, Jukka K. Korpela wrote:
� �
>> To begin with, try
>>
>> <em/Hello world/
>>
>> It is valid HTML 4.01 and equivalent to <em>Hello word</em> but browsers
>> choke on it.
>
> IINM, this would be an SGML construct (SGML SHORTTAG) and documents that
> use them would be conforming SGML documents, but ISTM that there is no
> requirement for HTML conformance,

Clause 4.2 says: �HTML 4 is an SGML application conforming to 
International Standard ISO 8879 -- Standard Generalized Markup Language 
SGML�. Since processing HTML documents is what a user agent does, by 
definition, it is clearly a requirement that SGML rules be obeyed.

> "SGML systems conforming to [ISO8879] are expected to recognize a number
> of features that aren't widely supported by HTML user agents. We
> recommend that authors avoid using all of these features."

That�s the realistic part, but not part of user agent conformance.

> Coupled with the syntax for EM:
>
> Start tag: required, End tag: required.

That�s non-normative prose � such parts of the syntax are normatively 
defined in the DTDs. But that�s not the point here. The point is that in 
my example, the second slash �/� is by definition an end tag (called nul 
end-tag, NET, in SGML).

>> To take an example from a different level, the align="char" attribute
>> was never implemented.
>
> On this the spec says:
>
> "If a user agent doesn't support character alignment, behavior in the
> presence of this value is unspecified."
>
> And later on the char attribute:
>
> "User agents are not required to support this attribute."

Good point, but it means that lack of support to align="." does not make 
a browser non-conforming. It however means that it does not support (all 
of) HTML 4.01.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/
0
Jukka
4/11/2016 5:08:23 PM
Adam H. Kerman wrote:

> Jukka K. Korpela <jkorpela@cs.tut.fi> wrote:
>> That's a common but completely wrong assumption. . . .
> 
> Thank you for the information.

s/in/misin/

Ask him for references that support his humble opinion.


PointedEars
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann
0
Thomas
4/11/2016 6:20:29 PM
Reply: