on master help sign in
* fix for script position

Added a second (private) function widgetBody which does not insert the Dispatcher.initialize(); function. This is a necessary change to allow the generated Javascript code to reside in the body tag instead of the head tag.

commit09ac4efb592b2e9723d2b975b7bc18b37cdce1ec authorVincent Ambo <v.ambo@me.com> dateSat 2 Jun 2012, 21:56 (14 years ago) parent38b4894
3 files changed+10−5
elm/Elm.cabal+2−2 elm/src/GenerateHtml.hs+7−2 elm/src/Language/Elm.hs+1−1
elm/Elm.cabal+2−2
@@ -1,6 +1,6 @@
11
22Name: Elm
3−Version: 0.1.2
3+Version: 0.1.2.1
44Synopsis: The Elm language module.
55Description: Elm aims to make client-side web-development more pleasant.
66 It is a statically/strongly typed, functional reactive
@@ -31,7 +31,7 @@ source-repository head
3131Library
3232 exposed-modules: Language.Elm,
3333 Language.Elm.Quasi
34− ghc-options: -O2 -Wall
34+ ghc-options: -O2
3535 Hs-Source-Dirs: src, src/Parse, src/Types
3636 other-modules: Ast,
3737 CompileToJS,
elm/src/GenerateHtml.hs+7−2
@@ -1,5 +1,5 @@
11{-# LANGUAGE OverloadedStrings #-}
2−module GenerateHtml (generateHtml, body, css) where
2+module GenerateHtml (generateHtml, body, css, widgetBody) where
33
44import Text.Blaze (preEscapedToMarkup)
55import Text.Blaze.Html (Html)
@@ -51,4 +51,9 @@ body noscript = do
5151 H.div ! A.id "widthChecker" ! A.style "width:100%; height:1px; position:absolute; top:-1px;" $ ""
5252 H.span ! A.id "content" $ ""
5353 H.script ! A.type_ "text/javascript" $ "Dispatcher.initialize()"
54− H.noscript $ preEscapedToMarkup noscript
54+ H.noscript $ preEscapedToMarkup noscript
55+
56+widgetBody noscript = do
57+ H.div ! A.id "widthChecker" ! A.style "width:100%; height:1px; position:absolute; top:-1px;" $ ""
58+ H.span ! A.id "content" $ ""
59+ H.noscript $ preEscapedToMarkup noscript
elm/src/Language/Elm.hs+1−1
@@ -70,4 +70,4 @@ toPartsHelper :: String -> (Html, Html, String)
7070toPartsHelper source = (html, css, js)
7171 where expr = initialize source
7272 js = compileToJS expr
73− html = body $ either id extract expr
73+ html = widgetBody $ either id extract expr