Recently I wrote a little parser for `toString` representation.

https://github.com/jinjor/elm-time-travel/blob/master/src/TimeTravel/Internal/Parser/Parser.elm

It turns
toString <| div [] [ input [ type' "text", class "foo", onClick 1 ] [], 
text "hello" ]

into
Record ([Property "type" (StringLiteral "node"),Property "tag" (
StringLiteral "div"),Property "facts" (Record []),Property "children" (
Record ([Property "0" (Record ([Property "type" (StringLiteral "node"),
Property "tag" (StringLiteral "input"),Property "facts" (Record ([Property 
"type" (StringLiteral "text"),Property "className" (StringLiteral "foo"),
Property "EVENT" (Record ([Property "click" (Record ([Property "options" (
Record ([Property "stopPropagation" (Union "False" []),Property 
"preventDefault" (Union "False" [])])),Property "decoder" (Value "<decoder>"
)]))]))])),Property "children" (Record []),Property "namespace" (Value 
"<internal 
structure>"),Property "descendantsCount" (Value "0")])),Property "1" (Record 
([Property "type" (StringLiteral "text"),Property "text" (StringLiteral 
"hello")]))])),Property "namespace" (Value "<internal structure>"),Property 
"descendantsCount" (Value "2")])

Peter, is this close to what you want to do?


2016年7月28日木曜日 18時21分58秒 UTC+9 Peter Damoc:
>
> I need to gather all the class names used in a Html tree generated by the 
> app. 
>
> Is there a way to do this short of converting the html to a string and 
> manually parsing it? 
>
>  
>
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to