mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-24 12:22:27 +03:00
Add another HTML printing test case and handle lazy HTML nodes nested under keyed nodes.
This commit is contained in:
parent
18a5d20ccf
commit
abc91541e2
@ -8,6 +8,7 @@ import Head
|
||||
import Head.Seo as Seo
|
||||
import Html.Styled as Html exposing (..)
|
||||
import Html.Styled.Attributes as Attr
|
||||
import Html.Styled.Keyed as HtmlKeyed
|
||||
import Html.Styled.Lazy as HtmlLazy
|
||||
import Pages.Msg
|
||||
import Pages.PageUrl exposing (PageUrl)
|
||||
@ -101,5 +102,22 @@ view maybeUrl sharedModel static =
|
||||
-- lazy and non-lazy versions render the same output
|
||||
, Html.text static.data
|
||||
, HtmlLazy.lazy (.data >> text) static
|
||||
, [ 1 ]
|
||||
|> List.indexedMap
|
||||
(\index _ ->
|
||||
( String.fromInt index
|
||||
, HtmlLazy.lazy2
|
||||
(\_ _ ->
|
||||
li []
|
||||
[ Html.text <|
|
||||
"This is number "
|
||||
++ String.fromInt index
|
||||
]
|
||||
)
|
||||
()
|
||||
()
|
||||
)
|
||||
)
|
||||
|> HtmlKeyed.ul []
|
||||
]
|
||||
}
|
||||
|
2
examples/escaping/dist/escaping/index.html
vendored
2
examples/escaping/dist/escaping/index.html
vendored
@ -26,6 +26,6 @@
|
||||
<div><style></style><label for="note"></label><div><style>div > p {
|
||||
font-size:14px;
|
||||
color:rgb(255, 0, 0);
|
||||
}</style><div><p>Hello! 2 > 1</p></div></div><script></script> is unsafe in JSON unless it is escaped properly.<script></script> is unsafe in JSON unless it is escaped properly.</div>
|
||||
}</style><div><p>Hello! 2 > 1</p></div></div><script></script> is unsafe in JSON unless it is escaped properly.<script></script> is unsafe in JSON unless it is escaped properly.<ul><li><style></style>This is number 0</li></ul></div>
|
||||
</body>
|
||||
</html>
|
@ -563,7 +563,9 @@ async function compileCliApp(options) {
|
||||
}
|
||||
|
||||
function forceThunks(vNode) {
|
||||
if (typeof vNode !== "undefined" && ( (vNode.b && vNode.b.$ === virtualDomKernelConstants.nodeTypeThunk) || vNode.$ === "#2" )) {
|
||||
if ( (typeof vNode !== "undefined" && vNode.$ === "#2") // normal/debug mode
|
||||
|| (typeof vNode !== "undefined" && typeof vNode.$ === "undefined" && typeof vNode.a == "string" && typeof vNode.b == "object" ) // optimize mode
|
||||
) {
|
||||
// This is a tuple (the kids : List (String, Html) field of a Keyed node); recurse into the right side of the tuple
|
||||
vNode.b = forceThunks(vNode.b);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user