Giter VIP home page Giter VIP logo

absolution's People

Contributors

0xflotus avatar abea avatar bodonkey avatar boutell avatar dependabot[bot] avatar etlaurent avatar gkumar9891 avatar tommedema avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

absolution's Issues

why is every element processed?

while trying to make a PR for #1 I noticed that you are looping over every element with htmlparser2 and then reconstructing the element. This depends on knowing exactly which elements are self-closing etc. It seems rather risky -- I would normally only do this for elements that actually have a url.

Is there a reason why it seems to be reconstructing elements that do not have urls too?

Use path in base url

It would be great if the base url could also include a path

var absolution = require('absolution');

var dirty = '<a href="/foo">Foo!</a>';
var clean = absolution(dirty, 'http://example.com/path');

// expected
// clean is now:
// <a href="http://example.com/path/foo">Foo!</a>

// actual result
// clean is now:
// <a href="http://example.com/foo">Foo!</a>

Process srcset attribute

This module's great! I use it to prepare content for my journal's syndication feeds.

My only complaint so far is that it doesn't appear to process the srcset attribute:

<!-- Source markup: -->
<img src="cat.jpg" alt="cat" 
  srcset="cat-320.jpg 320w, cat-640.jpg 640w, cat-1280.jpg 1280w">

<!-- What I would expect: -->
<img src="http://example.com/cat.jpg" alt="cat" 
  srcset="http://example.com/cat-320.jpg 320w, http://example.com/cat-640.jpg 640w, http://example.com/cat-1280.jpg 1280w">

<!-- What happens instead: -->
<img src="http://example.com/cat.jpg" alt="cat" 
  srcset="cat-320.jpg 320w, cat-640.jpg 640w, cat-1280.jpg 1280w">

Luckily feed readers don't seem to care too much (it seems like they fall back to src), but figured I'd create an issue 'cause sharing is caring. ๐Ÿ˜

non-existant href="" becomes href="http://localhost:8000/index.html"

I believe this is a bug.

Absolution is sometimes a little bit too excited and can "absolutify" URLs that are non-existant, such as is the case here:

<html>
  <head>
  <link rel="stylesheet" href="" />
</head>
<body></body>
</html>

When used with absolution(html, 'http://localhost:8000/index.html') it results in:

<html>
  <head>
  <link rel="stylesheet" href="http://localhost:8000/index.html" />
</head>
<body></body>
</html>

But it should stay the same, unless the original html specified href="."

Note that the expected behavior is also how absoluteify works, though I cannot use that library due to another bug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.