Permalink
Browse files

* Added a bunch of extra features

  • Loading branch information...
1 parent 15b9967 commit dbb9b8afa3a68dc9e17b1ad3a6dc75f3eae363b2 @spockz spockz committed Dec 8, 2011
@@ -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'
@@ -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
@@ -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

0 comments on commit dbb9b8a

Please sign in to comment.