Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 11-18-2018, 12:44 AM   #1
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
nesting divs & spans

I was looking at an epub converted by Calibre.
Cleaning it up I ran epubcheck and found it warning on numerous lines:

Quote:
ERROR(RSC-005): Error while parsing file 'element "div" not allowed here; expected the element end-tag, text or element "a", "abbr", "acronym", "applet", "b", "bdo", "big", "br", "cite", "code", "del", "dfn", "em", "i", "iframe", "img", "ins", "kbd", "map", "noscript", "ns:svg", "object", "q", "samp", "script", "small", "span", "strong", "sub", "sup", "tt" or "var" (with xmlns:ns="http://www.w3.org/2000/svg")
That's the "<div class="calibre11">" line below.

Obviously this is awful spaghetti code, but I thought it was at least valid.

Code:
<div class="calibre14">
    <span class="calibre15"> 

    <div class="calibre11">
      <span class="calibre9">ABC<br class="calibre11"/> </span>
    </div>

 DEF 

    </span>
  </div>
Is it invalid to have a div within a span? Sigil's "well formed"check is OK, all readers are OK.
AlanHK is offline   Reply With Quote
Old 11-18-2018, 04:39 AM   #2
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
<div> is a block-level element that can contain pretty much any other element. OTOH, <span> is an inline element that can contain only other inline elements.
Doitsu is offline   Reply With Quote
Old 11-18-2018, 06:22 AM   #3
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Quote:
Originally Posted by AlanHK View Post
Is it invalid to have a div within a span?
Yes. You can have a <span> within a <div>, but not vice versa.
HarryT is offline   Reply With Quote
Old 11-18-2018, 07:42 AM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by AlanHK View Post
Sigil's "well formed"check is OK, all readers are OK.
Always remember that Sigil's Well Formed check is not a specification checker/validator. It merely checks to see if all open tags are closed and that there are no nesting errors (meaning improper overlap of tags--no block-level/inline rules of xhtml are checked}. It's not an exhaustive, rule-based validation routine at all. It's a down & dirty check that nothing egregious is happening. That nothing is going to prevent Sigil from safely saving the epub, and that Sigil's automated routines can be safely run. Use a spec validator plugin if you want to know if an epub is spec-compliant.
DiapDealer is offline   Reply With Quote
Old 11-18-2018, 01:04 PM   #5
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by DiapDealer View Post
Use a spec validator plugin if you want to know if an epub is spec-compliant.
Which I know and obviously did, as my initial post quoted the epubcheck error.

I mentioned other things that did not complain, not just the WFC.
It's just that epubcheck seems to be the only thing that is bothered by this non-compliance. Despite being horrible code, it displays perfectly well in iBooks, for instance.
But I'll try to fix it just to shut epubcheck up, makes it hard to see other errors when it blurts 50 warnings about this when I do a check.
AlanHK is offline   Reply With Quote
Old 11-18-2018, 04:16 PM   #6
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by AlanHK View Post
It's just that epubcheck seems to be the only thing that is bothered by this non-compliance. Despite being horrible code, it displays perfectly well in iBooks, for instance.
There's tons of stuff that epubcheck (and a w3c xhtml check) barks at that "looks OK" in most renderers. That's because most display engines tend to be more forgiving than the specs that (attempt to) govern the markup they're tasked with rendering.

Last edited by DiapDealer; 11-18-2018 at 04:19 PM.
DiapDealer is offline   Reply With Quote
Old 11-18-2018, 09:49 PM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,782
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
I think of a span as 'adjusting' part of the block (bold, italic, bigger, smaller), but it is always part of a single block.

OTOH I use Div as more of a 'grouping container' for P or H type blocks

I know, some folk use Div instead of P
I also use Blocquote instead of a Div in most cases. Why not? Unless you need a non-standard exception.
theducks is offline   Reply With Quote
Old 11-20-2018, 06:25 AM   #8
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by theducks View Post
I think of a span as 'adjusting' part of the block (bold, italic, bigger, smaller), but it is always part of a single block.

OTOH I use Div as more of a 'grouping container' for P or H type blocks

I know, some folk use Div instead of P
I also use Blocquote instead of a Div in most cases. Why not? Unless you need a non-standard exception.
I know I liked you for some reason!
Turtle91 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Empty Spans for iBooks compatibility JSWolf Workshop 24 12-19-2015 01:46 PM
Rogue Space appearing above floating divs verydeepwater ePub 0 06-07-2014 07:08 AM
No class <spans> dynabook ePub 5 11-02-2012 10:42 AM
Kindle Life Spans sirmaru Amazon Kindle 11 12-24-2011 12:31 PM
Pasting creates DIVS but not Paragraphs? bitterbug Sigil 4 10-22-2010 12:42 AM


All times are GMT -4. The time now is 04:11 PM.


MobileRead.com is a privately owned, operated and funded community.