packages feed

haste-perch 0.1.0.8 → 0.1.0.9

raw patch · 3 files changed

+25/−3 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Haste.App.Perch: outer :: Perch -> Perch -> Perch
+ Haste.App.Perch: replace :: Elem -> Elem -> IO Elem
+ Haste.Perch: outer :: Perch -> Perch -> Perch
+ Haste.Perch: replace :: Elem -> Elem -> IO Elem

Files

Haste/App/Perch.hs view
@@ -255,7 +255,7 @@ src= atr "src"
 
 
----------------- DOM Tree navigation
+---------------- DOM Tree navigation and edition
 
 -- | return the current node
 this :: Perch
@@ -268,6 +268,17 @@   p <- liftIO  $ parent e
   e2 <- build pe' p
   return e2
+
+-- | replace the current node with a new one
+outer ::  Perch -> Perch -> Perch
+outer olde  newe= Perch $ \e'' -> do
+   e  <- build olde e''
+   e' <- build newe e''
+   liftIO $ replace e e'
+
+replace :: Elem -> Elem -> IO Elem
+replace= ffi $ toJSString "(function(e,e1){var par=  e.parentNode;par.replaceChild(e1,e);return e1;})"
+
 
 -- | delete the current node. Return the parent
 delete :: Perch
Haste/Perch.hs view
@@ -265,7 +265,7 @@ src= atr "src"
 
 
----------------- DOM Tree navigation
+---------------- DOM Tree navigation and edition
 
 -- | return the current node
 this :: Perch
@@ -289,6 +289,17 @@ -- | delete the children of the current node.
 clear :: Perch
 clear= Perch $ \e -> clearChildren e >> return e
+
+-- | replace the current node with a new one
+outer ::  Perch -> Perch -> Perch
+outer olde  newe= Perch $ \e'' -> do
+   e  <- build olde e''
+   e' <- build newe e''
+   replace e e'
+
+replace :: Elem -> Elem -> IO Elem
+replace= ffi  "(function(e,e1){var par=  e.parentNode;par.replaceChild(e1,e);return e1;})"
+
 
 
 parent :: Elem -> IO Elem
haste-perch.cabal view
@@ -1,5 +1,5 @@ name: haste-perch
-version: 0.1.0.8
+version: 0.1.0.9
 cabal-version: >=1.10
 build-type: Simple
 license: GPL-3