I want to make a function that takes in id="one" class='two'
and converts it to [{name: "id", value: "one" }, { name: "class", value: "two" }]
. I have a little more information and small demo of what I am trying to do at this link: http://fiddle.jshell.net/bgrins/hhSXx/show/.
This file contains hidden or 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
function escapeAttributeValues(attr, aAttrNode) { | |
let div = aAttrNode.ownerDocument.createElement("div"); | |
div.innerHTML = "<div " + attr + "></div>"; | |
var attributes=[]; | |
var el = div.childNodes[0]; | |
for (var i=0, l=el.attributes.length; i<l; i++){ | |
let attr = el.attributes.item(i) | |
attributes.push({name:attr.nodeName, value: attr.nodeValue}); | |
} |
This file contains hidden or 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
// Detecting data URLs | |
// data URI - MDN https://developer.mozilla.org/en-US/docs/data_URIs | |
// The "data" URL scheme: http://tools.ietf.org/html/rfc2397 | |
// Valid URL Characters: http://tools.ietf.org/html/rfc2396#section2 | |
function isDataURL(s) { | |
return !!s.match(isDataURL.regex); | |
} | |
isDataURL.regex = /^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i; |
This file contains hidden or 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
// formcontrols.js | |
// https://github.com/bgrins/devtools-snippets | |
// Print out forms and their controls | |
(function() { | |
var forms = document.querySelectorAll("form"); | |
for (var i = 0, len = forms.length; i < len; i++) { | |
var tab = [ ]; |
This file contains hidden or 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
/snippets | |
/jquerify | |
README.md | |
jquerify.js | |
jquerify.png | |
/hashlink | |
README.md | |
hashlink.js | |
hashlink.png | |
index.html (generated on build) |
This file contains hidden or 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
trap "exit" SIGHUP SIGINT SIGTERM | |
while true | |
do ffrun | |
done |
This file contains hidden or 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
# Start firefox in a loop, allowing you to quit and have it auto rebuild devtools and restart. | |
if [ -f mach ]; | |
then | |
echo "mach exists. Starting loop." | |
trap "exit" SIGHUP SIGINT SIGTERM | |
while true | |
do | |
./mach build faster | |
./mach run --devtools --jsconsole -P dev |
This file contains hidden or 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
On page: http://fiddle.jshell.net/bgrins/bgJGb/show/. | |
console.log: UNLOAD http://fiddle.jshell.net/bgrins/bgJGb/show/ | |
console.log: UNLOAD about:blank | |
console.log: UNLOAD about:blank | |
console.log: LOAD http://bgrins.github.io/ | |
console.log: LOAD http://bgrins.github.io/ | |
console.log: LOAD http://fiddle.jshell.net/bgrins/bgJGb/show/ |
This file contains hidden or 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
mach build browser/devtools; mach mochitest-browser browser/devtools/inspector/test/browser_inspector_changes.js > $$.txt; sublime $$.txt; rm $$.txt; |
This file contains hidden or 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
setInterval(function() { document.body.appendChild(document.body.firstElementChild) }, 5000); |