Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 11-18-2018, 01:44 AM   #1
AlanHK
Evangelist
AlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheese
 
AlanHK's Avatar
 
Posts: 435
Karma: 1002
Join Date: Apr 2014
Device: PW-3, 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, 05:39 AM   #2
Doitsu
Wizard
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: 4,339
Karma: 14300083
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, 07: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: 83,935
Karma: 78697158
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 online now   Reply With Quote
Old 11-18-2018, 08: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: 19,316
Karma: 99454782
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, 02:04 PM   #5
AlanHK
Evangelist
AlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheese
 
AlanHK's Avatar
 
Posts: 435
Karma: 1002
Join Date: Apr 2014
Device: PW-3, 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, 05: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: 19,316
Karma: 99454782
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 05:19 PM.
DiapDealer is offline   Reply With Quote
Old 11-18-2018, 10: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: 22,354
Karma: 22265700
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab A, Kobo Aura2
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, 07: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: 1,687
Karma: 11766398
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 6/5/iPad 1,2 & Air/Surface Pro/Kindle PW
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 09:56 AM.


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