https://kotlinlang.org logo
#ktor
Title
# ktor
m

martmists

12/03/2021, 1:22 PM
Copy code
a(...) {
    attributes["download"] = "..."
}
is what you're looking for I think
🧵 2
👀 1
a

Alex Styl

12/03/2021, 1:22 PM
a yes! i just tried that and it works, but
the resulting html includes the download as
download =""
. Which works for sure, but I am not sure if it would work on all browsers
hopefully if someone knows an other approach, they’ll share it
a

Aleksei Tirman [JB]

12/06/2021, 8:13 AM
I don't think it's possible due to the implementation:
Copy code
if (tag.attributes.isNotEmpty()) {
    tag.attributesEntries.forEachIndexed { _, e ->
        if (!e.key.isValidXmlAttributeName()) {
            throw IllegalArgumentException("Tag ${tag.tagName} has invalid attribute name ${e.key}")
        }

        out.append(' ')
        out.append(e.key)
        out.append("=\"")
        out.escapeAppend(e.value)
        out.append('\"')
    }
}
a

Alex Styl

12/06/2021, 12:03 PM
@Aleksei Tirman [JB] do you happen to know whether it is intentionally left out?
a

Aleksei Tirman [JB]

12/06/2021, 12:10 PM
Unfortunately, I don't know.
👍 1