Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jquery.URI.js #446

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/jquery.URI.js
Expand Up @@ -29,8 +29,8 @@
// FIXME: v2.0.0 renamce non-camelCase properties to uppercase
/*jshint camelcase: false */

var comparable = {};
var compare = {
let comparable = {};
let compare = {
// equals
'=': function(value, target) {
return value === target;
Expand Down Expand Up @@ -68,8 +68,8 @@
}

function getUriProperty(elem) {
var nodeName = elem.nodeName.toLowerCase();
var property = URI.domAttributes[nodeName];
let nodeName = elem.nodeName.toLowerCase();
let property = URI.domAttributes[nodeName];
if (nodeName === 'input' && elem.type !== 'image') {
// compensate ambiguous <input> that is not an image
return undefined;
Expand Down Expand Up @@ -100,7 +100,7 @@
});

// pipe $.attr('src') and $.attr('href') through URI.js
var _attrHooks = {
let _attrHooks = {
get: function(elem) {
return $(elem).uri();
},
Expand All @@ -117,16 +117,16 @@

// general URI accessor
$.fn.uri = function(uri) {
var $this = this.first();
var elem = $this.get(0);
var property = getUriProperty(elem);
let $this = this.first();
let elem = $this.get(0);
let 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');
let old = $this.data('uri');
if (old) {
return old.href(uri);
}
Expand Down Expand Up @@ -169,10 +169,10 @@
};

// add :uri() pseudo class selector to sizzle
var uriSizzle;
var pseudoArgs = /^([a-zA-Z]+)\s*([\^\$*]?=|:)\s*(['"]?)(.+)\3|^\s*([a-zA-Z0-9]+)\s*$/;
let uriSizzle;
let pseudoArgs = /^([a-zA-Z]+)\s*([\^\$*]?=|:)\s*(['"]?)(.+)\3|^\s*([a-zA-Z0-9]+)\s*$/;
function uriPseudo (elem, text) {
var match, property, uri;
let match, property, uri;

// skip anything without src|href|action and bad :uri() syntax
if (!getUriProperty(elem) || !text) {
Expand Down