diff --git a/src/calibre/srv/render_book.py b/src/calibre/srv/render_book.py
index 1ea6166ad6..40f5285d06 100644
--- a/src/calibre/srv/render_book.py
+++ b/src/calibre/srv/render_book.py
@@ -25,7 +25,7 @@ from calibre.customize.ui import plugin_for_input_format
from calibre.ebooks import parse_css_length
from calibre.ebooks.css_transform_rules import StyleDeclaration
from calibre.ebooks.oeb.base import (
- EPUB_NS, OEB_DOCS, OEB_STYLES, OPF, XHTML, XHTML_NS, XLINK, XPath as _XPath,
+ OEB_DOCS, OEB_STYLES, OPF, XHTML, XHTML_NS, XLINK, XPath as _XPath,
rewrite_links, urlunquote
)
from calibre.ebooks.oeb.iterator.book import extract_book
@@ -704,9 +704,6 @@ def split_name(name):
return None, l
-boolean_attributes = frozenset('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible'.split(',')) # noqa
-
-
known_tags = ('img', 'script', 'link', 'image', 'style')
discarded_tags = ('meta', 'base')
@@ -714,8 +711,6 @@ discarded_tags = ('meta', 'base')
def serialize_elem(elem, nsmap):
ns, name = split_name(elem.tag)
nl = name.lower()
- if ns == EPUB_NS:
- ns, name = None, 'epub-' + name
if nl in discarded_tags:
# Filter out tags as they have unknown side-effects
# Filter out tags as the viewer uses for URL resolution
@@ -734,16 +729,11 @@ def serialize_elem(elem, nsmap):
attribs = []
for attr, val in elem.items():
attr_ns, aname = split_name(attr)
- al = aname.lower()
- if not attr_ns and al in boolean_attributes:
- if val and val.lower() in (al, ''):
- attribs.append([al, al])
- continue
- attrib = [aname, val]
+ attrib = aname, val
if attr_ns:
attr_ns = nsmap[attr_ns]
if attr_ns:
- attrib.append(attr_ns)
+ attrib = aname, val, attr_ns
attribs.append(attrib)
if attribs:
ans['a'] = attribs
diff --git a/src/pyj/read_book/resources.pyj b/src/pyj/read_book/resources.pyj
index 814ae4039d..e9bb10efa7 100644
--- a/src/pyj/read_book/resources.pyj
+++ b/src/pyj/read_book/resources.pyj
@@ -185,9 +185,10 @@ def apply_attributes(src, elem, ns_map):
ns = ns_map[a[2]]
elem.setAttributeNS(ns, get_prefix(ns) + a[0], a[1])
else:
- if hide_tooltips and (a[0] is 'title' or a[0] is 'alt'):
+ name = a[0]
+ if hide_tooltips and (name is 'title' or name is 'alt'):
continue
- elem.setAttribute(a[0], a[1])
+ elem.setAttribute(name, a[1])
def process_stack(stack, tag_map, ns_map, load_required, onload):
while stack.length: