JSFiddle - React, Tailwind, and code Playground
by rodneyrehm
HTML
<script src="http://medialize.github.com/URI.js/src/URI.js"></script>
<div id="holder"></div>
JavaScript
$(function() {
$('#holder').append($('<img>').attr('src', 'http://4.bp.blogspot.com/_TqWqkmjdagc/TIBimd9wflI/AAAAAAAADic/Cu_lAOi5SSs/s1600/soccer-ball.jpg'));
});
(function($, undefined){
var URI = typeof module !== "undefined" && module.exports
? require('./URIjs')
: window.URI;
function escapeRegEx(string) {
// https://github.com/medialize/URI.js/commit/85ac21783c11f8ccab06106dba9735a31a86924d#commitcomment-821963
return string.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
}
function getUriProperty(elem) {
var property;
$.each(['href', 'src', 'action'], function(k, v) {
if (v in elem) {
property = v;
return false;
}
return true;
});
// compensate ambiguous <input>
if (elem.nodeName.toLowerCase() === 'input' && elem.type !== 'image') {
return undefined;
}
return property;
}
var pseudo = /^([a-zA-Z]+)\s*([\^\$*]?=|:)\s*(['"]?)(.+)\3|^\s*([a-zA-Z0-9]+)\s*$/,
comparable = {},
// https://developer.mozilla.org/en/CSS/Attribute_selectors
compare = {
// equals
'=': function(value, target) {
return value === target;
},
// ~= translates to value.match((?:^|\s)target(?:\s|$)) which is useless for URIs
// |= translates to value.match((?:\b)target(?:-|\s|$)) which is useless for URIs
// begins with
'^=': function(value, target, property) {
return !!(value + "").match(new RegExp('^' + escapeRegEx(target), 'i'));
},
// ends with
'$=': function(value, target, property) {
return !!(value + "").match(new RegExp(escapeRegEx(target) + '$', 'i'));
},
// contains
'*=': function(value, target, property) {
if (property == 'directory') {
// add trailing slash so /dir/ will match the deep-end as well
value += '/';
}
return !!(value...