How to use the urijs.getDomAttribute function in urijs

To help you get started, we’ve selected a few urijs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github medialize / ally.js / build / metalsmith / plugins / absolute-url.js View on Github external
$(urlSelector).each(function() {
    const $element = $(this);
    $element.nodeName = $element[0].name;
    const attribute = URI.getDomAttribute($element);
    if (!attribute) {
      // element does not have a URL attribute
      return;
    }

    const url = $element.attr(attribute);
    if (url.slice(0, options.resolve.length) !== options.resolve) {
      // URL is not using the absolute prefix
      return;
    }

    let resolved = URI(url).relativeTo(absolute).toString();
    if (!resolved) {
      // the file is linking to itself
      resolved = URI(fileName).filename();
    }