GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: do not report fragment-only CSS URLs · w3c/epubcheck@6fa3312

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • main/java/com/adobe/epubcheck/css
      • CSSHandler.java
    • test/resources/epub3
      • content-publication.feature
      • files/epub/content-css-url-fragment-valid
        • EPUB
          • content_001.xhtml
          • nav.xhtml
          • package.opf
          • style.css
        • META-INF
          • container.xml
        • mimetype
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/main/java/com/adobe/epubcheck/css/CSSHandler.java‎

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 numberDiff line numberDiff line change
@@ -320,10 +320,15 @@ private void resolveAndRegister(String uri, int line, int col, String context, T
320320
{
321321
if (uri != null && uri.trim().length() > 0)
322322
{
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+
}
327332
}
328333
}
329334
else
Collapse file

‎src/test/resources/epub3/content-publication.feature‎

Copy file name to clipboardExpand all lines: src/test/resources/epub3/content-publication.feature
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ Feature: EPUB 3 ▸ Content Documents ▸ Full Publication Checks
407407
When checking EPUB 'content-css-font-size-zero-valid'
408408
Then no errors or warnings are reported
409409

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+
410414

411415
## 6. Fixed Layouts
412416

Collapse file

‎src/test/resources/epub3/files/epub/content-css-url-fragment-valid/EPUB/content_001.xhtml‎

Copy file name to clipboard
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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

‎src/test/resources/epub3/files/epub/content-css-url-fragment-valid/EPUB/nav.xhtml‎

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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

‎src/test/resources/epub3/files/epub/content-css-url-fragment-valid/EPUB/package.opf‎

Copy file name to clipboard
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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

‎src/test/resources/epub3/files/epub/content-css-url-fragment-valid/EPUB/style.css‎

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body {
2+
color: inherit;
3+
filter: url(#filter);
4+
}
Collapse file

‎src/test/resources/epub3/files/epub/content-css-url-fragment-valid/META-INF/container.xml‎

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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

‎src/test/resources/epub3/files/epub/content-css-url-fragment-valid/mimetype‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
application/epub+zip

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.