[OpenLayers-Users] Best practices: windows.onload or <body onload="init()">

Eric Lemoine eric.lemoine at camptocamp.com
Sun Dec 9 11:52:04 PST 2012


On Sat, Dec 8, 2012 at 6:34 PM, Thomas Gratier
<osgeo.mailinglist at gmail.com> wrote:
> Hello,
>
> I'm a bit curious about OpenLayers examples
>
> They rely on
>
>  <body onload="init()">
>
> but Unobtrusive JavaScript principles
> (http://en.wikipedia.org/wiki/Unobtrusive_JavaScript) tell you to use
> something like
>
> windows.onload = function() { init(); }
>
> So, why Openlayers examples are using the first syntax?

Hysterical Raisins
(http://www.catb.org/jargon/html/H/hysterical-reasons.html). I agree
that using windows.onload is more in line with the "Separation of
behavior from markup" practice described in
<http://en.wikipedia.org/wiki/Unobtrusive_JavaScript>.

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 94
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list