Skip to content

Commit

Permalink
* Added a bunch of extra features
Browse files Browse the repository at this point in the history
  • Loading branch information
spockz committed Dec 8, 2011
1 parent 15b9967 commit dbb9b8a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions uhc-jscript/src/Language/UHC/JScript/JQuery/JQuery.hs
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,23 @@ onDocumentReady f = do document <- jQuery "document"

foreign import jscript "%1.ready(%2)"
_ready :: JQuery -> JSFunPtr (IO ()) -> IO ()

-------------------------------------------------------------------------------
-- DOM Manipulation

append :: JQuery -> JQuery -> IO ()
append = _append

foreign import jscript "%1.append(%*)"
_append :: JQuery -> JQuery -> IO ()


-------------------------------------------------------------------------------
-- Dynamic loading

loadSrcFile :: String -> IO ()
loadSrcFile src = do let src' = toJS src :: JSString
scriptTag <- jQuery "<script>"
scriptTag' <- setAttr "src" src' scriptTag
body <- jQuery "body"
append body scriptTag'
4 changes: 4 additions & 0 deletions uhc-jscript/src/Language/UHC/JScript/W3C/HTML5.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module Language.UHC.JScript.W3C.HTML5
)
where

import Language.UHC.JScript.Primitives
import Language.UHC.JScript.ECMA.Array
import Language.UHC.JScript.ECMA.String

Expand Down Expand Up @@ -86,6 +87,9 @@ foreign import jscript "%1.getElementsByName(%*)"

foreign import jscript "%1.getElementsByTagName(%*)"
documentGetElementsByTagName :: Document -> JSString -> IO (NodeList Node)

foreign import jscript "%1.createElement(%*)"
documentCreateElement :: Document -> JSString -> IO Node

data AnchorPtr
type Anchor = JSPtr AnchorPtr
Expand Down

0 comments on commit dbb9b8a

Please sign in to comment.