Why?
Because why the hell not?
Allows you to use nodelist methods on strings!
It's kinda useless on it's own, but with https://gist.github.com/2847249 it's pretty fun =D
Why?
Because why the hell not?
Allows you to use nodelist methods on strings!
It's kinda useless on it's own, but with https://gist.github.com/2847249 it's pretty fun =D
Object.getOwnPropertyNames(NodeList.prototype).forEach(function(a){ | |
String.prototype[a]=function(){document.querySelectorAll(this)[a].apply(document.querySelectorAll(this),arguments)} | |
}); |
Object.getOwnPropertyNames(NodeList.prototype).forEach(function(a){String.prototype[a]=function(){document.querySelectorAll(this)[a].apply(document.querySelectorAll(this),arguments)}}) |
{ | |
"name": "theNameOfYourLibWhichMustBeAValidCamelCasedJavaScriptIdentifier", | |
"description": "This should be a short description of your entry.", | |
"keywords": [ | |
"five", | |
"descriptive", | |
"keywords", | |
"or", | |
"fewer" | |
] | |
} |
<!DOCTYPE html> | |
<title>Foo</title> | |
<div style=white-space:pre> | |
<i>foo bar lorem ipsum</i> | |
<i>foo bar lorem ipsum</i> | |
<i>foo bar lorem ipsum</i> | |
<i>foo bar lorem ipsum</i> | |
<i>foo bar lorem ipsum</i> | |
<i>foo bar lorem ipsum</i> | |
</div> | |
<script> | |
Element.prototype.css=function(a,i,n){for(n in''+a===a||a)this.style[n]=a[n];return i||n?(this.style[a]=i,this):getComputedStyle(this)[a]}; | |
Object.getOwnPropertyNames(Element.prototype).forEach(function(a){ | |
NodeList.prototype[a]=function(){for(var n in this)this[n][a].apply(this[n],arguments)} | |
}); | |
Object.getOwnPropertyNames(NodeList.prototype).forEach(function(a){ | |
String.prototype[a]=function(){document.querySelectorAll(this)[a].apply(document.querySelectorAll(this),arguments)} | |
}); | |
"div>i".css({color:"red"}) | |
</script> |