GeezerVison is showing github.com — fix: do not report fragment-only CSS URLs · w3c/epubcheck@6fa3312
File treeExpand file treeCollapse file tree Open diff view settings main/java/com/adobe/epubcheck/css files/epub/content-css-url-fragment-valid
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/main/java/com/adobe/epubcheck/css/CSSHandler.java +9-4Lines changed: 9 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -320,10 +320,15 @@ private void resolveAndRegister(String uri, int line, int col, String context, T | 320 | 320 | { | 321 | 321 | if (uri != null && uri.trim().length() > 0) | 322 | 322 | { | 323 | | - String resolved = PathUtil.resolveRelativeReference(path, uri); | 324 | | - xrefChecker.registerReference(path, correctedLineNumber(line), correctedColumnNumber(line, col), resolved, type); | 325 | | - if (PathUtil.isRemote(resolved)) { | 326 | | - detectedProperties.add(ITEM_PROPERTIES.REMOTE_RESOURCES); | | 323 | + // Fragment-only URLs should be resolved relative to the host document | | 324 | + // Since we don't have access to the path of the host document(s) here, | | 325 | + // we ignore this case | | 326 | + if (!uri.startsWith("#")) { | | 327 | + String resolved = PathUtil.resolveRelativeReference(path, uri); | | 328 | + xrefChecker.registerReference(path, correctedLineNumber(line), correctedColumnNumber(line, col), resolved, type); | | 329 | + if (PathUtil.isRemote(resolved)) { | | 330 | + detectedProperties.add(ITEM_PROPERTIES.REMOTE_RESOURCES); | | 331 | + } | 327 | 332 | } | 328 | 333 | } | 329 | 334 | else | |
Collapse file Copy file name to clipboardExpand all lines: src/test/resources/epub3/content-publication.feature +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -407,6 +407,10 @@ Feature: EPUB 3 ▸ Content Documents ▸ Full Publication Checks | 407 | 407 | When checking EPUB 'content-css-font-size-zero-valid' | 408 | 408 | Then no errors or warnings are reported | 409 | 409 |
| | 410 | + Scenario: Verify a fragment-only URL does not trigger a "fragment not defined" error | | 411 | + When checking EPUB 'content-css-url-fragment-valid' | | 412 | + Then no errors or warnings are reported | | 413 | + | 410 | 414 |
| 411 | 415 | ## 6. Fixed Layouts | 412 | 416 |
| |
Collapse file Copy file name to clipboard +22Lines changed: 22 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<!DOCTYPE html> | | 2 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | | 3 | + <head> | | 4 | + <meta charset="utf-8"/> | | 5 | + <title>Minimal EPUB</title> | | 6 | + <link type="text/css" rel="stylesheet" href="style.css" /> | | 7 | + </head> | | 8 | + <body> | | 9 | + <h1>Loomings</h1> | | 10 | + <p>Call me Ishmael.</p> | | 11 | + <svg version="1.1" xmlns="http://www.w3.org/2000/svg"> | | 12 | + <defs> | | 13 | + <filter id="filter"> | | 14 | + <feColorMatrix type="matrix" values="0.3333 0.3333 0.3333 0 0 | | 15 | + 0.3333 0.3333 0.3333 0 0 | | 16 | + 0.3333 0.3333 0.3333 0 0 | | 17 | + 0 0 0 1 0" /> | | 18 | + </filter> | | 19 | + </defs> | | 20 | + </svg> | | 21 | + </body> | | 22 | +</html> |
Collapse file Copy file name to clipboard +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<!DOCTYPE html> | | 2 | +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en"> | | 3 | + <head> | | 4 | + <meta charset="utf-8"/> | | 5 | + <title>Minimal Nav</title> | | 6 | + </head> | | 7 | + <body> | | 8 | + <nav epub:type="toc"> | | 9 | + <ol> | | 10 | + <li><a href="content_001.xhtml">content 001</a></li> | | 11 | + </ol> | | 12 | + </nav> | | 13 | + </body> | | 14 | +</html> |
Collapse file Copy file name to clipboard +17Lines changed: 17 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<?xml version="1.0" encoding="UTF-8"?> | | 2 | +<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="q"> | | 3 | +<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"> | | 4 | + <dc:title id="title">Minimal EPUB 3.0</dc:title> | | 5 | + <dc:language>en</dc:language> | | 6 | + <dc:identifier id="q">NOID</dc:identifier> | | 7 | + <meta property="dcterms:modified">2017-06-14T00:00:01Z</meta> | | 8 | +</metadata> | | 9 | +<manifest> | | 10 | + <item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml" properties="svg"/> | | 11 | + <item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/> | | 12 | + <item id="css" href="style.css" media-type="text/css" /> | | 13 | +</manifest> | | 14 | +<spine> | | 15 | + <itemref idref="content_001" /> | | 16 | +</spine> | | 17 | +</package> |
Collapse file Copy file name to clipboard +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +body { | | 2 | + color: inherit; | | 3 | + filter: url(#filter); | | 4 | +} |
Collapse file Copy file name to clipboard +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<?xml version="1.0" encoding="UTF-8" ?> | | 2 | +<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> | | 3 | + <rootfiles> | | 4 | + <rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/> | | 5 | + </rootfiles> | | 6 | +</container> |
Collapse file Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +application/epub+zip |
|