robb / Swim

A DSL for writing HTML in Swift
310 stars 9 forks source link

Quoted attributes #25

Closed chriseidhof closed 3 years ago

chriseidhof commented 3 years ago

If there is a quote in an attribute value, we should escape it. I am 99% sure this is all that needs to happen. Even < and > are fine to use inside attribute values.

robb commented 3 years ago

LGTM, Thanks!

I was concerned that this might trip up JavaScript but I couldn't come up with a case where it did, e.g. this works as expected:

<html>
<body>
    <button onclick="javascript:alert(&quot;Hallo&quot; === &quot;Hal&quot; + &quot;lo&quot;)"></button>
</body>
</html>