Kroc/DOMTemplate

Convert 'XML style attributes to HTML style attributes' only for boolean attributes

Closed this issue · 7 comments

That is, class="class" is not the same as class.

Kroc commented

Any other examples? class="class" is extremely unlikely, and we need to convert all boolean attributes as we cannot guarantee safety with a limited known list; the user may be using data- or something browser specific, or even outside the spec. Since we have to convert all HTML attributes to XML attributes upon import (otherwise it won't import at all), we achieve nothing by selectively converting XML attributes back to HTML ones on output.

I use name="name".

we achieve nothing by selectively converting XML attributes back to HTML ones on output

Well, why convert them back at all? Named booleans are valid HTML.

I think something like this would work better, and it'd mean you're using the same logic for both operations: generate a random hash, name all unnamed attributes with it on load, and remove it from them on dump.

Kroc commented

And how do you template using random named hashes? :)

That is a good point you raise.

Kroc commented

Why not allow the ability to load either as HTML (with the filtering) or as XML (no filtering)?

I guess that would work.