@@ -127,8 +127,9 @@ widgetHold child0 newChild = do
127widgetHoldInternal :: MonadWidget t m => m a -> Event t (m b) -> m (a, Event t b)
127widgetHoldInternal :: MonadWidget t m => m a -> Event t (m b) -> m (a, Event t b)
128widgetHoldInternal child0 newChild = do
128widgetHoldInternal child0 newChild = do
129 startPlaceholder <- text' ""
129 startPlaceholder <- text' ""
130− p <- askParent
130+ (result0, childVoidAction0) <- do
131− (result0, childVoidAction0) <- subWidgetWithVoidActions p child0
132+ subWidgetWithVoidActions p child0
132 endPlaceholder <- text' ""
133 endPlaceholder <- text' ""
133 (newChildBuilt, newChildBuiltTriggerRef) <- newEventWithTriggerRef
134 (newChildBuilt, newChildBuiltTriggerRef) <- newEventWithTriggerRef
134 performEvent_ $ fmap (const $ return ()) newChildBuilt --TODO: Get rid of this hack
135 performEvent_ $ fmap (const $ return ()) newChildBuilt --TODO: Get rid of this hack
@@ -141,12 +142,8 @@ widgetHoldInternal child0 newChild = do
141 (result, postBuild, voidActions) <- runWidget df c
142 (result, postBuild, voidActions) <- runWidget df c
142 runFrameWithTriggerRef newChildBuiltTriggerRef (result, voidActions)
143 runFrameWithTriggerRef newChildBuiltTriggerRef (result, voidActions)
143 postBuild
144 postBuild
144− mp <- liftIO $ nodeGetParentNode endPlaceholder
145+ mp' <- liftIO $ nodeGetParentNode endPlaceholder
146− Nothing -> return () --TODO: Is this right?
148− _ <- liftIO $ nodeInsertBefore p (Just df) (Just endPlaceholder)
146+ forM_ mp' $ \p' -> liftIO $ nodeInsertBefore p' (Just df) (Just endPlaceholder)
150 return ()
147 return ()
151 addVoidAction $ ffor newChild $ \c -> do
148 addVoidAction $ ffor newChild $ \c -> do
152 liftIO $ deleteBetweenExclusive startPlaceholder endPlaceholder
149 liftIO $ deleteBetweenExclusive startPlaceholder endPlaceholder
@@ -156,7 +153,7 @@ widgetHoldInternal child0 newChild = do
156diffMapNoEq :: (Ord k) => Map k v -> Map k v -> Map k (Maybe v)
153diffMapNoEq :: (Ord k) => Map k v -> Map k v -> Map k (Maybe v)
157diffMapNoEq olds news = flip Map.mapMaybe (align olds news) $ \case
154diffMapNoEq olds news = flip Map.mapMaybe (align olds news) $ \case
158 This _ -> Just Nothing
155 This _ -> Just Nothing
159− These old new -> Just $ Just new
156+ These _ new -> Just $ Just new
160 That new -> Just $ Just new
157 That new -> Just $ Just new
162applyMap :: Ord k => Map k v -> Map k (Maybe v) -> Map k v
159applyMap :: Ord k => Map k v -> Map k (Maybe v) -> Map k v
@@ -187,7 +184,7 @@ listWithKeyShallowDiff :: (Ord k, MonadWidget t m) => Map k v -> Event t (Map k
187listWithKeyShallowDiff initialVals valsChanged mkChild = do
184listWithKeyShallowDiff initialVals valsChanged mkChild = do
188 let childValChangedSelector = fanMap $ fmap (Map.mapMaybe id) valsChanged
185 let childValChangedSelector = fanMap $ fmap (Map.mapMaybe id) valsChanged
189 sentVals <- foldDyn (flip applyMap) Map.empty $ fmap (fmap (fmap (\_ -> ()))) valsChanged
186 sentVals <- foldDyn (flip applyMap) Map.empty $ fmap (fmap (fmap (\_ -> ()))) valsChanged
190− let relevantDiff diff cur = case diff of
187+ let relevantDiff diff _ = case diff of
191 Nothing -> Just Nothing -- Even if we let a Nothing through when the element doesn't already exist, this doesn't cause a problem because it is ignored
188 Nothing -> Just Nothing -- Even if we let a Nothing through when the element doesn't already exist, this doesn't cause a problem because it is ignored
192 Just _ -> Nothing -- We don't want to let spurious re-creations of items through
189 Just _ -> Nothing -- We don't want to let spurious re-creations of items through
193 listHoldWithKey initialVals (attachWith (flip (Map.differenceWith relevantDiff)) (current sentVals) valsChanged) $ \k v ->
190 listHoldWithKey initialVals (attachWith (flip (Map.differenceWith relevantDiff)) (current sentVals) valsChanged) $ \k v ->
@@ -669,7 +666,7 @@ class HasDomEvent t a | a -> t where
669 domEvent :: EventName en -> a -> Event t (EventResultType en)
666 domEvent :: EventName en -> a -> Event t (EventResultType en)
671instance Reflex t => HasDomEvent t (El t) where
668instance Reflex t => HasDomEvent t (El t) where
672− domEvent en el = fmap unEventResult $ select (_el_events el) (WrapArg en)
669+ domEvent en e = fmap unEventResult $ select (_el_events e) (WrapArg en)
674linkClass :: MonadWidget t m => String -> String -> m (Link t)
671linkClass :: MonadWidget t m => String -> String -> m (Link t)
675linkClass s c = do
672linkClass s c = do