dvschultz / 99problems

99 Problems and e-reader rendering are all of them
60 stars 3 forks source link

External CSS stylesheets ignored if `link` element lacks `type` attribute #28

Open elmimmo opened 10 years ago

elmimmo commented 10 years ago

Kindle ignores external stylesheets in KF8 if the declaration of the link element lacks the type attribute, even though such is not a requirement in HTML5 (but was in XHTML1.1 and before).

i.e. This will not work:

<link rel="stylesheet" href="stylesheet.css"/>

but this will:

<link rel="stylesheet" href="stylesheet.css" type="text/css"/>

Both HTML The Living Standard and HTML5 specifications declare the attribute as “purely advisory”.

Interestingly, Kindle Previewer when in Kindle DX mode (but not in any other mode), which purportedly uses the Mobipocket variant inside the .mobi file, not the KF8 variant, does use the external stylesheet, which might imply that the bug does not apply to old Kindle devices.

dvschultz commented 10 years ago

Just guessing, but any chance this is due to the spec being XHTML5 instead of just plain HTML5? XHTML tends to require more verbose declarations.

http://www.sitepoint.com/web-foundations/differences-html-xhtml/

elmimmo commented 10 years ago

I do not think so, since what XHTML imposes over HTML is only the stricter generic XML syntax. link is not an element defined in any way by XML, and thus which attributes it requires and which ones are optional is defined by the HTML spec, XML imposing none.

elmimmo commented 10 years ago

Applies to Google Play Books too (as of today).

WilliamOckham commented 9 years ago

Not technically a bug. The XHTML spec most definitely does specify the required attributes on the link element and the type attribute is one of them: http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410/abstract_modules.html#s_linkmodule

jstallent commented 9 years ago

Actually, the attributes listed there are not required. It is just a list of the possible attribute types. If you look at the DTD, you'll see that the entire list is marked as "IMPLIED", and none of them as "REQUIRED". http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410/dtd_module_defs.html#a_module_Link

WilliamOckham commented 9 years ago

@jstallent You are correct. I hadn't looked at the DTD. The documentation for the XML Schema states that lists separated by commas indicate that the items are required. I should have read that one more closely.