In some HTML elements, attribute names need to be case-sensitive to take effect, for example, the viewBox attribute within the <svg> element. #297
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#294
Based on the recent development of the EPUB format in recent years, more and more people are using SVG for image layout in XHTML. Currently, when using SVG, attributes within the viewBox are converted to lowercase, and during testing in
Apple Books
or Chrome Browser, it was found that<svg viewbox="0 0 960 1080">
is ineffective until it is adjusted to<svg viewBox="0 0 960 1080">
.Upon investigation, it was found that the issue originates from the Python lxml package. After processing with
html.document_fromstring
, the attributes are converted to lowercase. While this aligns with XML conventions, it is not suitable for HTML5.Currently, in the
parse_html_string
function withinebooklib/utils.py
, there is an attempt to perform a round of checks on thehtml_tree
to handle the attributes of elements that need to be converted to uppercase.The list of attributes comes from: https://www.w3.org/TR/SVG/attindex.html
Javascript code: