Created
May 25, 2015 00:32
-
-
Save anonymous/65159cd7de4da8ab1962 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/sagovufike
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var addstyle, css, test; | |
addstyle = (function(_this) { | |
return function(rules) { | |
var s; | |
s = $('<style>').prop('type', 'text/css').text(rules).appendTo("head"); | |
return s; | |
}; | |
})(this); | |
css = ".wrapper {\n padding: 4px;\n margin: 4px;\n background-color: rgba(1,1,1,.01);\n border: 1px solid rgba(1,1,1,.02);\n font-size: 8px !important;\n font-family: serif;\n}\n\n.wrapped {\nbackground-color: pink;\nborder: 1px solid rgba(1,1,1,.2);\npadding: 4px;\nmargin: 4px;\n}"; | |
addstyle(css); | |
test = function() { | |
$("body").append($("<div>").addClass("wrapped")); | |
return $(".wrapped").wrapAll($("<div>").addClass("wrapper")); | |
}; | |
test(); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript"># http://stackoverflow.com/a/12479285 | |
addstyle = (rules) => | |
s = $ '<style>' | |
.prop 'type', 'text/css' | |
.text rules | |
.appendTo "head" | |
s | |
css = """ | |
.wrapper { | |
padding: 4px; | |
margin: 4px; | |
background-color: rgba(1,1,1,.01); | |
border: 1px solid rgba(1,1,1,.02); | |
font-size: 8px !important; | |
font-family: serif; | |
} | |
.wrapped { | |
background-color: pink; | |
border: 1px solid rgba(1,1,1,.2); | |
padding: 4px; | |
margin: 4px; | |
} | |
""" | |
addstyle css | |
test = -> | |
$ "body" | |
.append $("<div>").addClass "wrapped" | |
$ ".wrapped" | |
.wrapAll $("<div>").addClass "wrapper" | |
test()</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var addstyle, css, test; | |
addstyle = (function(_this) { | |
return function(rules) { | |
var s; | |
s = $('<style>').prop('type', 'text/css').text(rules).appendTo("head"); | |
return s; | |
}; | |
})(this); | |
css = ".wrapper {\n padding: 4px;\n margin: 4px;\n background-color: rgba(1,1,1,.01);\n border: 1px solid rgba(1,1,1,.02);\n font-size: 8px !important;\n font-family: serif;\n}\n\n.wrapped {\nbackground-color: pink;\nborder: 1px solid rgba(1,1,1,.2);\npadding: 4px;\nmargin: 4px;\n}"; | |
addstyle(css); | |
test = function() { | |
$("body").append($("<div>").addClass("wrapped")); | |
return $(".wrapped").wrapAll($("<div>").addClass("wrapper")); | |
}; | |
test(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment