Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
rodneyrehm committed Feb 10, 2018
2 parents a6920c8 + fa46615 commit 9641080
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 53 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

The release notes tracked in this document are also made available on the [releases page](https://github.com/medialize/URI.js/releases)

### 1.19.1 (February 10th 2018) ###

* fixing [`.href()`](http://medialize.github.io/URI.js/docs.html#href) to parse `query` property - [Issue #366](https://github.com/medialize/URI.js/issues/366), [PR #367](https://github.com/medialize/URI.js/issues/367)

### 1.19.0 (October 1st 2017) ###

* adding `.setFragment()` to [query fragment plugin](http://medialize.github.io/URI.js/docs.html#fragment-abuse-query) - [Issue #338](https://github.com/medialize/URI.js/issues/338), [PR #356](https://github.com/medialize/URI.js/issues/356)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "urijs",
"version": "1.19.0",
"version": "1.19.1",
"main": "src/URI.js",
"ignore": [
".*",
Expand Down
18 changes: 9 additions & 9 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
(function($, undefined){
window.URL = window.webkitURL || window.URL;
window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;

function build(files) {
var $out = $('#output'),
$progress = $('#prog'),
sources = [],
connections = [],
source;

$out.parent().hide();
$progress.show().prop('value', 1).text('Loading Files');

for (var i = 0, length = files.length; i < length; i++) {
sources.push("");
(function(i, file){
Expand All @@ -20,7 +20,7 @@ function build(files) {
}, "text"));
})(i, files[i]);
}

$.when.apply($, connections).done(function() {
$progress.prop('value', 2).text('Compiling Scripts');
$.post('https://closure-compiler.appspot.com/compile', {
Expand All @@ -29,13 +29,13 @@ function build(files) {
output_format: "text",
output_info: "compiled_code"
}, function(data) {
var code = "/*! URI.js v1.19.0 http://medialize.github.io/URI.js/ */\n/* build contains: " + files.join(', ') + " */\n" + data;
var code = "/*! URI.js v1.19.1 http://medialize.github.io/URI.js/ */\n/* build contains: " + files.join(', ') + " */\n" + data;
$progress.hide();
$out.val(code).parent().show();
$out.prev().find('a').remove();
$out.prev().prepend(download(code));
}).error(function() {
alert("Your browser is incapable of cross-domain communication.\nPlease see instructions for manual build below.");
}).error(function() {
alert("Your browser is incapable of cross-domain communication.\nPlease see instructions for manual build below.");
});
});
};
Expand All @@ -48,7 +48,7 @@ function download(code) {
a.href = window.URL.createObjectURL(blob);
a.textContent = 'Download';
a.dataset.downloadurl = ['text/javascript', a.download, a.href].join(':');

return a;
};

Expand All @@ -70,7 +70,7 @@ $(function(){
var val = $(this).val();
val.length && files.push(val);
});

build(files);
});
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "urijs",
"version": "1.19.0",
"version": "1.19.1",
"title": "URI.js - Mutating URLs",
"author": {
"name": "Rodney Rehm",
Expand Down
2 changes: 1 addition & 1 deletion src/IPv6.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* URI.js - Mutating URLs
* IPv6 Support
*
* Version: 1.19.0
* Version: 1.19.1
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
Expand Down
2 changes: 1 addition & 1 deletion src/SecondLevelDomains.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* URI.js - Mutating URLs
* Second Level Domain (SLD) Support
*
* Version: 1.19.0
* Version: 1.19.1
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
Expand Down
8 changes: 6 additions & 2 deletions src/URI.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* URI.js - Mutating URLs
*
* Version: 1.19.0
* Version: 1.19.1
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
Expand Down Expand Up @@ -81,7 +81,7 @@
return /^[0-9]+$/.test(value);
}

URI.version = '1.19.0';
URI.version = '1.19.1';

var p = URI.prototype;
var hasOwn = Object.prototype.hasOwnProperty;
Expand Down Expand Up @@ -1241,10 +1241,14 @@
} else if (_URI || _object) {
var src = _URI ? href._parts : href;
for (key in src) {
if (key === 'query') { continue; }
if (hasOwn.call(this._parts, key)) {
this._parts[key] = src[key];
}
}
if (src.query) {
this.query(src.query, false);
}
} else {
throw new TypeError('invalid input');
}
Expand Down
44 changes: 22 additions & 22 deletions src/URI.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/URITemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* URI.js - Mutating URLs
* URI Template Support - http://tools.ietf.org/html/rfc6570
*
* Version: 1.19.0
* Version: 1.19.1
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
Expand Down
28 changes: 14 additions & 14 deletions src/jquery.URI.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* URI.js - Mutating URLs
* jQuery Plugin
*
* Version: 1.19.0
* Version: 1.19.1
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/jquery-uri-plugin.html
Expand Down Expand Up @@ -31,7 +31,7 @@

var comparable = {};
var compare = {
// equals
// equals
'=': function(value, target) {
return value === target;
},
Expand All @@ -51,7 +51,7 @@
// add trailing slash so /dir/ will match the deep-end as well
value += '/';
}

return !!(value + '').match(new RegExp(escapeRegEx(target), 'i'));
},
'equals:': function(uri, target) {
Expand All @@ -74,7 +74,7 @@
// compensate ambiguous <input> that is not an image
return undefined;
}

// NOTE: as we use a static mapping from element to attribute,
// the HTML5 attribute issue should not come up again
// https://github.com/medialize/URI.js/issues/69
Expand Down Expand Up @@ -120,17 +120,17 @@
var $this = this.first();
var elem = $this.get(0);
var property = getUriProperty(elem);

if (!property) {
throw new Error('Element "' + elem.nodeName + '" does not have either property: href, src, action, cite');
}

if (uri !== undefined) {
var old = $this.data('uri');
if (old) {
return old.href(uri);
}

if (!(uri instanceof URI)) {
uri = URI(uri || '');
}
Expand All @@ -142,7 +142,7 @@
uri = URI($this.attr(property) || '');
}
}

uri._dom_element = elem;
uri._dom_attribute = property;
uri.normalize();
Expand All @@ -164,7 +164,7 @@
this._string = URI.build(this._parts);
this._deferred_build = false;
}

return this;
};

Expand All @@ -173,12 +173,12 @@
var pseudoArgs = /^([a-zA-Z]+)\s*([\^\$*]?=|:)\s*(['"]?)(.+)\3|^\s*([a-zA-Z0-9]+)\s*$/;
function uriPseudo (elem, text) {
var match, property, uri;

// skip anything without src|href|action and bad :uri() syntax
if (!getUriProperty(elem) || !text) {
return false;
}

match = text.match(pseudoArgs);

if (!match || (!match[5] && match[2] !== ':' && !compare[match[2]])) {
Expand All @@ -188,7 +188,7 @@
}

uri = $(elem).uri();

if (match[5]) {
return uri.is(match[5]);
} else if (match[2] === ':') {
Expand All @@ -197,15 +197,15 @@
// filers seem to fail silently
return false;
}

return compare[property](uri, match[4]);
} else {
property = match[1].toLowerCase();
if (!comparable[property]) {
// filers seem to fail silently
return false;
}

return compare[match[2]](uri[property](), match[4], property);
}

Expand Down
2 changes: 1 addition & 1 deletion src/jquery.URI.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,49 @@
ok(u instanceof URI, 'instanceof URI');
ok(u._parts.hostname !== undefined, 'host undefined');
});

test('new URI(object)', function() {
var u = new URI({
protocol: 'http',
hostname: 'example.org',
query: {
foo: 'bar',
bar: 'foo',
},
});
ok(u instanceof URI, 'instanceof URI');
ok(typeof u.query() === 'string', 'query is string');
equal(u.query(), 'foo=bar&bar=foo', 'query has right value');
equal(u.search(), '?foo=bar&bar=foo', 'search has right value');
deepEqual(u.query(true), { foo: 'bar', bar: 'foo' }, 'query(true) value');
deepEqual(u.search(true), { foo: 'bar', bar: 'foo' }, 'search(true) value');
});
test('new URI(object)', function() {
var u = new URI({
protocol: 'http',
hostname: 'example.org',
query: 'foo=bar&bar=foo',
});
ok(u instanceof URI, 'instanceof URI');
ok(typeof u.query() === 'string', 'query is string');
equal(u.query(), 'foo=bar&bar=foo', 'query has right value');
equal(u.search(), '?foo=bar&bar=foo', 'search has right value');
deepEqual(u.query(true), { foo: 'bar', bar: 'foo' }, 'query(true) value');
deepEqual(u.search(true), { foo: 'bar', bar: 'foo' }, 'search(true) value');
});
test('new URI(object)', function() {
var u = new URI({
protocol: 'http',
hostname: 'example.org',
query: '?foo=bar&bar=foo',
});
ok(u instanceof URI, 'instanceof URI');
ok(typeof u.query() === 'string', 'query is string');
equal(u.query(), 'foo=bar&bar=foo', 'query has right value');
equal(u.search(), '?foo=bar&bar=foo', 'search has right value');
deepEqual(u.query(true), { foo: 'bar', bar: 'foo' }, 'query(true) value');
deepEqual(u.search(true), { foo: 'bar', bar: 'foo' }, 'search(true) value');
});
test('new URI(Location)', function () {
var u = new URI(location);
equal(u.href(), String(location.href), 'location object');
Expand Down

0 comments on commit 9641080

Please sign in to comment.