Issue #581 - coerce attribute names to lower case in HTML mode
Fix for issue #581. Attribute names will now always be coerced to lower case when attempting to get or set attributes to keep the behavior in line with how cheerio.load() handles attribute names.
This PR updates Cheerio's .attr() functionality to more closely match jQuery's .attr(), which saves and retrieves attributes by lowercasing the input name.
Adjusted a few existing tests to be able to support tests for this fix.
Thanks a lot for this PR! Some notes:
- The change in the fixture led to a need for quite a few unrelated changes. Please use one of the other fixtures or add a new one.
- Cheerio has an XML mode for working with XML. XML is case-sensitive, so we don't want to lowercase tag names in XML. You will probably end up with something along the lines of
attrNameToUse = this.options.xmlMode ? attrName : attrName.toLowerCase()
@fb55 Apologies for the late response - my colleagues and I have been very busy at work recently. The requested changes have been made - please re-review at your earliest convenience. Thanks!