Why: Because minifying html after serialization is very expensive,
especially when not all types of minifications are desired. Having the
ability to do simple whitespace and comment stripping during
serialization stage simplifies this, and default false options means the
change is backwards compatible
How: Add an optional opts arg to the Serializer constructor and check
it in methods that output text
Also: Cleaned up toLowerCase method.
Sidenote: I was unclear why name.toLowerCase() wouldn't work for all use-cases, so if someone could elaborate, that'd be helpful. I changed it to the way it is now under the assumption it was important to make that distinction, though.
Why: Because minifying html after serialization is very expensive, especially when not all types of minifications are desired. Having the ability to do simple whitespace and comment stripping during serialization stage simplifies this, and default false options means the change is backwards compatible
How: Add an optional
opts
arg to the Serializer constructor and check it in methods that output textAlso: Cleaned up toLowerCase method.
Sidenote: I was unclear why
name.toLowerCase()
wouldn't work for all use-cases, so if someone could elaborate, that'd be helpful. I changed it to the way it is now under the assumption it was important to make that distinction, though.