JSFiddle - React, Tailwind, and code Playground
HTML
<div id="sample">
<p>
My background has a lovely noise texture
<br /><br />
<code>background: noise(100px 100px 0.3) repeat;</code></p>
</div>
CSS
body{
text-align:center;
padding-top:50px;
}
#sample {
display:inline-block;
background:#555;
color: #fefefe;
text-shadow:0 1px 2px rgba(0,0,0,0.5);
}
#sample p{
background: noise(100px 100px 0.3) repeat;
padding:50px;
-webkit-box-shadow:0 0 50px #111 inset;
box-shadow:0 0 50px #111 inset;
}
JavaScript
var CXX = CXX || (function (doc) {
var getCSS = function(url, returnFunc){
var request;
if (window.XMLHttpRequest) {
request=new XMLHttpRequest();
} else {
request=new ActiveXObject("Microsoft.XMLHTTP");
}
request.onreadystatechange=function(){
if (request.readyState==4 && request.status==200){
returnFunc.call(null, request.responseText);
}
};
request.open("GET",url,true);
request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
request.send();
},
removeCSS = function(href){
var links = doc.getElementsByTagName('link'), i;
for(i = 0; i < links.length; i++){
if(links[i].href == href){
links[i].parentNode.removeChild(links[i]);
break;
}
}
},
appendCSS = function(data){
var css = doc.createElement('style');
css.type = 'text/css';
if (css.styleSheet){
css.styleSheet.cssText = data;
} else {
css.appendChild(doc.createTextNode(data));
}
doc.getElementsByTagName("head")[0].appendChild(css);
},
getPropsByInner = function (search, data) {
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^\s+|\s+$/g, '');
};
}
var sheetList = doc.styleSheets,
tempList = [],
finalList = [],
i, j;
if(data){
sheetList = [{
ownerNode: {
innerText: data
}
}];
}
for (i = 0; i < sheetList.length; i++) {
if (sheetList[i].ownerNode.innerText) {
var rules = sheetList[i].ownerNode.innerText;
if (rules.indexOf(search) != -1) {
var count = i;
tempList.push({
sheetId: count,
search: search,
res: rules
});
}
}
}
if (tempList.length >= 1) {
for (i = 0; i < tempList.length; i++) {
var text = tempList[i].res,
regex = new RegExp(tempList[i].search...