Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-utils

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-utils - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

.babelrc

4

CHANGELOG.md
Changelog
=========
### 0.5.0 (December 31, 2016)
* Convert all code to ES2015
### 0.4.1 (October 21, 2016)

@@ -5,0 +9,0 @@

12

lib/closest.js

@@ -1,3 +0,3 @@

var matches = require('./matches');
var parents = require('./parents');
import matches from './matches';
import parents from './parents';

@@ -12,11 +12,11 @@ /**

*/
module.exports = function closest(element, selector, shouldCheckSelf) {
export default function closest(element, selector, shouldCheckSelf) {
if (!(element && element.nodeType == 1 && selector)) return;
var parentElements =
const parentElements =
(shouldCheckSelf ? [element] : []).concat(parents(element));
for (var i = 0, parent; parent = parentElements[i]; i++) {
for (let i = 0, parent; parent = parentElements[i]; i++) {
if (matches(parent, selector)) return parent;
}
};
}

@@ -1,3 +0,3 @@

var closest = require('./closest');
var matches = require('./matches');
import closest from './closest';
import matches from './matches';

@@ -16,9 +16,9 @@ /**

*/
module.exports = function delegate(
export default function delegate(
ancestor, eventType, selector, callback, opts) {
opts = opts || {};
// Defines the event listener.
var listener = function(event) {
const listener = function(event) {
let delegateTarget;

@@ -28,4 +28,4 @@ // If opts.composed is true and the event originated from inside a Shadow

if (opts.composed && typeof event.composedPath == 'function') {
var composedPath = event.composedPath();
for (var i = 0, node; node = composedPath[i]; i++) {
const composedPath = event.composedPath();
for (let i = 0, node; node = composedPath[i]; i++) {
if (node.nodeType == 1 && matches(node, selector)) {

@@ -35,7 +35,6 @@ delegateTarget = node;

}
} else {
// Otherwise check the parents.
delegateTarget = closest(event.target, selector, true);
}
// Otherwise check the parents.
else {
var delegateTarget = closest(event.target, selector, true);
}

@@ -52,4 +51,4 @@ if (delegateTarget) {

ancestor.removeEventListener(eventType, listener, opts.useCapture);
}
},
};
};
}

@@ -13,7 +13,6 @@ /**

*/
module.exports = function(element, eventType, eventName, initDict) {
export default function dispatch(element, eventType, eventName, initDict) {
let event;
let isCustom;
var event;
var isCustom;
// eventName is optional

@@ -38,6 +37,5 @@ if (typeof eventName == 'object') {

event = new window[eventName](eventType, initDict);
}
catch(err) {
} catch(err) {
event = document.createEvent(eventName);
var initMethod = 'init' + (isCustom ? 'Custom' : '') + 'Event';
const initMethod = 'init' + (isCustom ? 'Custom' : '') + 'Event';
event[initMethod](eventType, initDict.bubbles,

@@ -48,2 +46,2 @@ initDict.cancelable, initDict.detail);

return element.dispatchEvent(event);
};
}

@@ -8,4 +8,4 @@ /**

*/
module.exports = function getAttributes(element) {
var attrs = {};
export default function getAttributes(element) {
const attrs = {};

@@ -16,9 +16,9 @@ // Validate input.

// Return an empty object if there are no attributes.
var map = element.attributes;
const map = element.attributes;
if (map.length === 0) return {};
for (var i = 0, attr; attr = map[i]; i++) {
for (let i = 0, attr; attr = map[i]; i++) {
attrs[attr.name] = attr.value;
}
return attrs;
};
}

@@ -1,29 +0,11 @@

var proto = window.Element.prototype;
var nativeMatches = proto.matches ||
proto.matchesSelector ||
proto.webkitMatchesSelector ||
proto.mozMatchesSelector ||
proto.msMatchesSelector ||
proto.oMatchesSelector;
const proto = window.Element.prototype;
const nativeMatches = proto.matches ||
proto.matchesSelector ||
proto.webkitMatchesSelector ||
proto.mozMatchesSelector ||
proto.msMatchesSelector ||
proto.oMatchesSelector;
/**
* Tests whether a DOM element matches a selector. This polyfills the native
* Element.prototype.matches method across browsers.
* @param {Element} element The DOM element to test.
* @param {string} selector The CSS selector to test element against.
* @return {boolean} True if the selector matches.
*/
function matchesSelector(element, selector) {
if (typeof selector != 'string') return false;
if (nativeMatches) return nativeMatches.call(element, selector);
var nodes = element.parentNode.querySelectorAll(selector);
for (var i = 0, node; node = nodes[i]; i++) {
if (node == element) return true;
}
return false;
}
/**
* Tests if a DOM elements matches any of the test DOM elements or selectors.

@@ -35,3 +17,3 @@ * @param {Element} element The DOM element to test.

*/
module.exports = function matches(element, test) {
export default function matches(element, test) {
// Validate input.

@@ -42,7 +24,6 @@ if (element && element.nodeType == 1 && test) {

return element == test || matchesSelector(element, test);
}
// if it has a length property iterate over the items
// and return true if any match.
else if ('length' in test) {
for (var i = 0, item; item = test[i]; i++) {
} else if ('length' in test) {
// if it has a length property iterate over the items
// and return true if any match.
for (let i = 0, item; item = test[i]; i++) {
if (element == item || matchesSelector(element, item)) return true;

@@ -54,2 +35,20 @@ }

return false;
};
}
/**
* Tests whether a DOM element matches a selector. This polyfills the native
* Element.prototype.matches method across browsers.
* @param {Element} element The DOM element to test.
* @param {string} selector The CSS selector to test element against.
* @return {boolean} True if the selector matches.
*/
function matchesSelector(element, selector) {
if (typeof selector != 'string') return false;
if (nativeMatches) return nativeMatches.call(element, selector);
const nodes = element.parentNode.querySelectorAll(selector);
for (let i = 0, node; node = nodes[i]; i++) {
if (node == element) return true;
}
return false;
}

@@ -7,4 +7,4 @@ /**

*/
module.exports = function parents(element) {
var list = [];
export default function parents(element) {
const list = [];
while (element && element.parentNode && element.parentNode.nodeType == 1) {

@@ -14,2 +14,2 @@ list.push(element = element.parentNode);

return list;
};
}

@@ -1,8 +0,8 @@

var HTTP_PORT = '80';
var HTTPS_PORT = '443';
var DEFAULT_PORT = RegExp(':(' + HTTP_PORT + '|' + HTTPS_PORT + ')$');
const HTTP_PORT = '80';
const HTTPS_PORT = '443';
const DEFAULT_PORT = RegExp(':(' + HTTP_PORT + '|' + HTTPS_PORT + ')$');
var a = document.createElement('a');
var cache = {};
const a = document.createElement('a');
const cache = {};

@@ -16,4 +16,3 @@

*/
module.exports = function parseUrl(url) {
export default function parseUrl(url) {
// All falsy values (as well as ".") should map to the current URL.

@@ -36,3 +35,3 @@ url = (!url || url == '.') ? location.href : url;

// Don't include default ports.
var port = (a.port == HTTP_PORT || a.port == HTTPS_PORT) ? '' : a.port;
let port = (a.port == HTTP_PORT || a.port == HTTPS_PORT) ? '' : a.port;

@@ -45,10 +44,10 @@ // PhantomJS sets the port to "0" when using the file: protocol.

// http://bit.ly/1rQNoMg
var host = a.host.replace(DEFAULT_PORT, '');
const host = a.host.replace(DEFAULT_PORT, '');
// Not all browser support `origin` so we have to build it.
var origin = a.origin ? a.origin : a.protocol + '//' + host;
const origin = a.origin ? a.origin : a.protocol + '//' + host;
// Sometimes IE doesn't include the leading slash for pathname.
// http://bit.ly/1rQNoMg
var pathname = a.pathname.charAt(0) == '/' ? a.pathname : '/' + a.pathname;
const pathname = a.pathname.charAt(0) == '/' ? a.pathname : '/' + a.pathname;

@@ -69,4 +68,4 @@ return cache[url] = {

path: pathname + a.search, // The pathname and the search query (w/o hash).
query: a.search.slice(1) // The search without the starting "?".
query: a.search.slice(1), // The search without the starting "?".
};
};
}
{
"name": "dom-utils",
"version": "0.4.1",
"version": "0.5.0",
"description": "A small, modular DOM utilities library",

@@ -24,8 +24,12 @@ "scripts": {

"devDependencies": {
"browserify": "^13.0.0",
"easy-sauce": "^0.4.0",
"eslint": "^3.0.1",
"mocha": "^2.4.5",
"mocha-phantomjs": "^4.0.2",
"sinon": "^1.17.3"
"babel-core": "^6.21.0",
"babel-preset-es2015": "^6.18.0",
"babelify": "^7.3.0",
"browserify": "^13.1.1",
"easy-sauce": "^0.4.1",
"eslint": "^3.12.2",
"eslint-config-google": "^0.7.1",
"mocha": "^3.2.0",
"mocha-phantomjs": "^4.1.0",
"sinon": "^1.17.7"
},

@@ -75,7 +79,2 @@ "easySauce": {

[
"Windows XP",
"internet explorer",
"8"
],
[
"OS X 10.10",

@@ -82,0 +81,0 @@ "iPhone",

@@ -1,26 +0,14 @@

var assert = require('assert');
var closest = require('../lib/closest');
import assert from 'assert';
import closest from '../lib/closest';
describe('closest', function() {
var fixtures = document.createElement('div');
describe('closest', () => {
const fixtures = document.createElement('div');
fixtures.id = 'fixtures';
beforeEach(() => document.body.appendChild(fixtures));
afterEach(() => fixtures.innerHTML = '');
after(() => document.body.removeChild(fixtures));
beforeEach(function() {
document.body.appendChild(fixtures);
});
afterEach(function() {
fixtures.innerHTML = '';
});
after(function() {
document.body.removeChild(fixtures);
});
it('should find a matching parent from a CSS selector', function() {
it('should find a matching parent from a CSS selector', () => {
fixtures.innerHTML =

@@ -33,5 +21,5 @@ '<div id="div">' +

var div = document.getElementById('div');
var p = document.getElementById('p');
var em = document.getElementById('em');
const div = document.getElementById('div');
const p = document.getElementById('p');
const em = document.getElementById('em');

@@ -45,8 +33,7 @@ assert.equal(closest(em, 'p'), p);

it('should test the element itself if the third args is true', function() {
it('should test the element itself if the third args is true', () => {
fixtures.innerHTML = '<p id="p"><em id="em"></em></p>';
var p = document.getElementById('p');
var em = document.getElementById('em');
const p = document.getElementById('p');
const em = document.getElementById('em');

@@ -59,4 +46,3 @@ assert(!closest(em, 'em'));

it('handles invalid inputs gracefully', function() {
it('handles invalid inputs gracefully', () => {
assert(!closest());

@@ -67,3 +53,2 @@ assert(!closest(null, 'div'));

});
});

@@ -1,16 +0,18 @@

var assert = require('assert');
var sinon = require('sinon');
var delegate = require('../lib/delegate');
var dispatch = require('../lib/dispatch');
import assert from 'assert';
import sinon from 'sinon';
import delegate from '../lib/delegate';
import dispatch from '../lib/dispatch';
/* eslint no-invalid-this: 0 */
// NOTE: this use of this.skip() prevents usage of arrow functions in tests.
describe('delegate', function() {
var fixtures = document.createElement('div');
const fixtures = document.createElement('div');
fixtures.id = 'fixtures';
var div;
var p;
var em;
let div;
let p;
let em;
/**

@@ -32,3 +34,2 @@ * Adds the structure div > p > em as light DOM inside the fixture element.

/**

@@ -47,3 +48,2 @@ * Adds the structure div > p > em as shadow DOM inside the fixture element.

beforeEach(function() {

@@ -53,3 +53,2 @@ document.body.appendChild(fixtures);

afterEach(function() {

@@ -62,3 +61,2 @@ div = null;

after(function() {

@@ -68,5 +66,3 @@ document.body.removeChild(fixtures);

it('delegates the handling of events to an ancestor element', function() {
// Skips this test in unsupporting browers.

@@ -77,4 +73,4 @@ if (!Element.prototype.addEventListener) this.skip();

var spy = sinon.spy();
var d = delegate(div, 'click', 'p', spy);
const spy = sinon.spy();
const d = delegate(div, 'click', 'p', spy);
dispatch(em, 'click', {bubbles: true, cancelable: true});

@@ -87,5 +83,3 @@

it('invokes the callback with the event and delegate target', function() {
// Skips this test in unsupporting browers.

@@ -96,4 +90,4 @@ if (!Element.prototype.addEventListener) this.skip();

var spy = sinon.spy();
var d = delegate(div, 'click', 'p', spy);
const spy = sinon.spy();
const d = delegate(div, 'click', 'p', spy);
dispatch(em, 'click', {bubbles: true, cancelable: true});

@@ -110,5 +104,3 @@

it('binds the calback to the delegate target', function() {
// Skips this test in unsupporting browers.

@@ -119,4 +111,4 @@ if (!Element.prototype.addEventListener) this.skip();

var spy = sinon.spy();
var d = delegate(div, 'click', 'p', spy);
const spy = sinon.spy();
const d = delegate(div, 'click', 'p', spy);
dispatch(em, 'click', {bubbles: true, cancelable: true});

@@ -129,5 +121,3 @@

it('returns an object with a destroy method', function() {
// Skips this test in unsupporting browers.

@@ -138,4 +128,4 @@ if (!Element.prototype.addEventListener) this.skip();

var spy = sinon.spy();
var d = delegate(div, 'click', 'p', spy);
const spy = sinon.spy();
const d = delegate(div, 'click', 'p', spy);
dispatch(em, 'click', {bubbles: true, cancelable: true});

@@ -153,5 +143,3 @@

it('can optionally bind to the event capture phase', function() {
// Skips this test in unsupporting browers.

@@ -162,6 +150,6 @@ if (!Element.prototype.addEventListener) this.skip();

var spy1 = sinon.spy();
var spy2 = sinon.spy();
var d1 = delegate(document, 'click', 'p', spy1);
var d2 = delegate(document, 'click', 'p', spy2, {useCapture: true});
const spy1 = sinon.spy();
const spy2 = sinon.spy();
const d1 = delegate(document, 'click', 'p', spy1);
const d2 = delegate(document, 'click', 'p', spy2, {useCapture: true});

@@ -181,3 +169,2 @@ // Stops the event in the bubble phase.

// TODO(philipwalton): at the moment this test doesn't work in any

@@ -187,3 +174,2 @@ // browser because events triggered via JavaScript do not seem to buble

it('can delegate to elements inside a shadow tree', function() {
// Skips this test in unsupporting browsers.

@@ -194,6 +180,6 @@ if (!('composedPath' in Event.prototype)) this.skip();

var spy1 = sinon.spy();
var spy2 = sinon.spy();
var d1 = delegate(div, 'click', 'p', spy1);
var d2 = delegate(div, 'click', 'p', spy2, {composed: true});
const spy1 = sinon.spy();
const spy2 = sinon.spy();
const d1 = delegate(div, 'click', 'p', spy1);
const d2 = delegate(div, 'click', 'p', spy2, {composed: true});

@@ -208,3 +194,2 @@ dispatch(em, 'click', {bubbles: true, cancelable: true, composed: true});

});
});

@@ -1,13 +0,16 @@

var assert = require('assert');
var sinon = require('sinon');
var dispatch = require('../lib/dispatch');
import assert from 'assert';
import sinon from 'sinon';
import dispatch from '../lib/dispatch';
/* eslint no-invalid-this: 0 */
// NOTE: this use of this.skip() prevents usage of arrow functions in tests.
describe('dispatch', function() {
it('triggers an event on the passed DOM element', function() {
// Skips this test in unsupporting browsers.
if (!document.createEvent) this.skip();
var spy = sinon.spy();
const spy = sinon.spy();
document.addEventListener('click', spy);

@@ -23,7 +26,6 @@

it('supports specifying event attributes via an optional object', function() {
// Skips this test in unsupporting browsers.
if (!document.createEvent) this.skip();
var spy = sinon.spy(function(event) {
const spy = sinon.spy(function(event) {
assert(event.bubbles);

@@ -44,9 +46,7 @@ assert(event.cancelable);

it('supports passing data via the detail property', function() {
// Skips this test in unsupporting browsers.
if (!document.createEvent) this.skip();
var spy = sinon.spy();
const spy = sinon.spy();
document.addEventListener('click', spy);

@@ -62,9 +62,7 @@

it('supports specifying the event constructor', function() {
// Skips this test in unsupporting browsers.
if (!document.createEvent) this.skip();
var spy = sinon.spy();
const spy = sinon.spy();
document.addEventListener('click', spy);

@@ -80,5 +78,3 @@

it('returns the value of element.dispatchEvent', function() {
// Skips this test in unsupporting browsers.

@@ -89,3 +85,3 @@ if (!document.createEvent) this.skip();

var spy = sinon.spy(function(event) {
const spy = sinon.spy(function(event) {
event.preventDefault();

@@ -99,3 +95,2 @@ });

});
});

@@ -1,8 +0,8 @@

var assert = require('assert');
var getAttributes = require('../lib/get-attributes');
import assert from 'assert';
import getAttributes from '../lib/get-attributes';
describe('getAttributes', function() {
it('returns an object representation of the element attributes', function() {
var div = document.createElement('div');
describe('getAttributes', () => {
it('returns an object representation of the element attributes', () => {
const div = document.createElement('div');
document.body.appendChild(div);

@@ -16,3 +16,3 @@

'bar': 'BAR',
'qux': 'QUX'
'qux': 'QUX',
});

@@ -23,5 +23,4 @@

it('returns an empty object when there are no attributes', function() {
var div = document.createElement('div');
it('returns an empty object when there are no attributes', () => {
const div = document.createElement('div');
document.body.appendChild(div);

@@ -34,4 +33,3 @@

it('handles invalid inputs gracefully', function() {
it('handles invalid inputs gracefully', () => {
assert.deepEqual(getAttributes(), {});

@@ -41,4 +39,2 @@ assert.deepEqual(getAttributes(null), {});

});
});

@@ -1,28 +0,16 @@

var assert = require('assert');
var matches = require('../lib/matches');
import assert from 'assert';
import matches from '../lib/matches';
describe('matches', function() {
var fixtures = document.createElement('div');
describe('matches', () => {
const fixtures = document.createElement('div');
fixtures.id = 'fixtures';
beforeEach(() => document.body.appendChild(fixtures));
afterEach(() => fixtures.innerHTML = '');
after(() => document.body.removeChild(fixtures));
beforeEach(function() {
document.body.appendChild(fixtures);
});
afterEach(function() {
fixtures.innerHTML = '';
});
after(function() {
document.body.removeChild(fixtures);
});
it('works testing against a CSS selector', function() {
it('works testing against a CSS selector', () => {
fixtures.innerHTML = '<div id="foo" class="bar"></div>';
var div = document.getElementById('foo');
const div = document.getElementById('foo');

@@ -37,6 +25,5 @@ assert(matches(div, 'div'));

it('works testing against a DOM element', function() {
it('works testing against a DOM element', () => {
fixtures.innerHTML = '<div id="foo" class="bar"></div>';
var div = document.getElementById('foo');
const div = document.getElementById('foo');

@@ -47,6 +34,5 @@ assert(matches(div, fixtures.childNodes[0]));

it('works testing against a list of selectors and elements', function() {
it('works testing against a list of selectors and elements', () => {
fixtures.innerHTML = '<div class="foo"><p id="bar"></p></div>';
var p = document.getElementById('bar');
const p = document.getElementById('bar');

@@ -62,4 +48,3 @@ assert(matches(p, ['#bar']));

it('handles invalid inputs gracefully', function() {
it('handles invalid inputs gracefully', () => {
assert(!matches());

@@ -69,3 +54,2 @@ assert(!matches(fixtures, null));

});
});

@@ -1,8 +0,8 @@

var assert = require('assert');
var parents = require('../lib/parents');
import assert from 'assert';
import parents from '../lib/parents';
describe('parents', function() {
it('returns an array of a DOM elements parent elements', function() {
var fixtures = document.createElement('div');
describe('parents', () => {
it('returns an array of a DOM elements parent elements', () => {
const fixtures = document.createElement('div');
fixtures.id = 'fixtures';

@@ -12,5 +12,5 @@ document.body.appendChild(fixtures);

fixtures.innerHTML = '<p id="p"><em id="em"><sup id="sup"></sup><em></p>';
var p = document.getElementById('p');
var em = document.getElementById('em');
var sup = document.getElementById('sup');
const p = document.getElementById('p');
const em = document.getElementById('em');
const sup = document.getElementById('sup');

@@ -22,3 +22,3 @@ assert.deepEqual(parents(sup), [

document.body,
document.documentElement
document.documentElement,
]);

@@ -29,4 +29,3 @@

it('returns an empty array if no parents exist', function() {
it('returns an empty array if no parents exist', () => {
assert.deepEqual(parents(document.documentElement), []);

@@ -36,4 +35,3 @@ assert.deepEqual(parents(document.createElement('div')), []);

it('handles invalid input gracefully', function() {
it('handles invalid input gracefully', () => {
assert.deepEqual(parents(), []);

@@ -43,4 +41,2 @@ assert.deepEqual(parents(null), []);

});
});

@@ -1,9 +0,8 @@

var assert = require('assert');
var parseUrl = require('../lib/parse-url');
import assert from 'assert';
import parseUrl from '../lib/parse-url';
describe('parseUrl', function() {
it('parses the a URL and returns a location-like object', function() {
var url = parseUrl(
describe('parseUrl', () => {
it('parses the a URL and returns a location-like object', () => {
const url = parseUrl(
'https://www.example.com:1234/path/to/file.html?a=b&c=d#hash');

@@ -23,11 +22,9 @@

query: 'a=b&c=d',
search: '?a=b&c=d'
search: '?a=b&c=d',
});
});
it('parses a sparse URL', () => {
const url = parseUrl('http://example.com');
it('parses a sparse URL', function() {
var url = parseUrl('http://example.com');
assert.deepEqual(url, {

@@ -45,11 +42,9 @@ fragment: '',

query: '',
search: ''
search: '',
});
});
it('parses URLs relative to the root', () => {
const url = parseUrl('/path/to/file.html?a=b&c=d#hash');
it('parses URLs relative to the root', function() {
var url = parseUrl('/path/to/file.html?a=b&c=d#hash');
// Specified portions of the URL.

@@ -70,15 +65,13 @@ assert.equal(url.fragment, 'hash');

// Not all browsers support the `origin` property, so we derive it.
var origin = location.origin || location.protocol + '//' + location.host;
const origin = location.origin || location.protocol + '//' + location.host;
assert.equal(url.origin, origin);
});
it('parses URLs relative to the file', function() {
it('parses URLs relative to the file', () => {
// Assumes the tests are hosted at `/test/`;
var url = parseUrl('../path/to/file.html?a=b&c=d#hash');
const url = parseUrl('../path/to/file.html?a=b&c=d#hash');
// Manually calculate the pathname since these tests run on servers as well
// as using the file protocol.
var pathname = location.pathname
const pathname = location.pathname
.replace(/test\/(index\.html)?/, '') + 'path/to/file.html';

@@ -101,3 +94,3 @@

// Not all browsers support the `origin` property, so we derive it.
var origin = location.origin || location.protocol + '//' + location.host;
const origin = location.origin || location.protocol + '//' + location.host;
assert.equal(url.origin, origin);

@@ -107,20 +100,19 @@ });

it('should resolve various relative path types', function() {
var url1 = parseUrl('.');
it('should resolve various relative path types', () => {
const url1 = parseUrl('.');
assert.equal(url1.pathname, location.pathname);
var url2 = parseUrl('..');
const url2 = parseUrl('..');
assert.equal(url2.pathname,
location.pathname.replace(/test\/(index.html)?$/, ''));
var url3 = parseUrl('./foobar.html');
const url3 = parseUrl('./foobar.html');
assert.equal(url3.pathname,
location.pathname.replace(/(index.html)?$/, 'foobar.html'));
var url4 = parseUrl('../foobar.html');
const url4 = parseUrl('../foobar.html');
assert.equal(url4.pathname,
location.pathname.replace(/test\/(index.html)?$/, 'foobar.html'));
var url5 = parseUrl('.../foobar.html');
const url5 = parseUrl('.../foobar.html');
assert.equal(url5.pathname,

@@ -130,7 +122,5 @@ location.pathname.replace('index.html', '') + '.../foobar.html');

it('parses the current URL when given a falsy value', () => {
const url = parseUrl();
it('parses the current URL when given a falsy value', function() {
var url = parseUrl();
// Assumes the tests are hosted at `/test/`;

@@ -151,3 +141,3 @@ assert.equal(url.fragment, '');

// Not all browsers support the `origin` property, so we derive it.
var origin = location.origin || location.protocol + '//' + location.host;
const origin = location.origin || location.protocol + '//' + location.host;
assert.equal(url.origin, origin);

@@ -158,3 +148,2 @@

});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc