Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
pagedjs
pagedjs
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 154
    • Issues 154
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 12
    • Merge Requests 12
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Tools
  • pagedjspagedjs
  • Issues
  • #93

Closed
Open
Opened Jan 12, 2019 by Mauro@mb21
  • Report abuse
  • New issue
Report abuse New issue

Respect <base> element when parsing url() in CSS

Say you have the following HTML in index.html, in a folder hosted by python -m SimpleHTTPServer 8000 . (or any web server, or even file:///):

<html>
  <head>
    <base href="/assets/">
    <style>
    @font-face {
      font-family: 'inknut_antiquaregular';
      src: url('./InknutAntiqua-Regular-webfont.woff') format('woff');
      font-weight: normal;
      font-style: normal;
    }
    h1 {
      font-family: 'inknut_antiquaregular';
    }
    </style>
  </head>
  <body>
    <h1>foo</h1>
    <script src="https://unpkg.com/pagedjs/dist/paged.polyfill.js"></script>
  </body>
</html>

Then you have the .woff file in a subfolder called assets.

Paged.js 0.1.30 does not respect the <base> tag.

Expected behavior

The CSS paged.js injects into the <head> should not be rewritten at all, or at least rewritten to something that resolves, like:

url('./assets/InknutAntiqua-Regular-webfont.woff')

Actual behavior

The CSS is rewritten to:

url('http://localhost:8000/InknutAntiqua-Regular-webfont.woff')

which of course gives a 404.

P.S. Stumbled upon this in https://github.com/mb21/panwriter/issues/6

Repro: fonttest.zip

Edited Jan 12, 2019 by Mauro
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
2
Labels
To Do source files
Assign labels
  • View project labels
Reference: tools/pagedjs#93