Skip to content

Instantly share code, notes, and snippets.

@z3bbster
Created March 20, 2015 23:47
Show Gist options
  • Save z3bbster/4c24c36c54a5af6b1ca5 to your computer and use it in GitHub Desktop.
Save z3bbster/4c24c36c54a5af6b1ca5 to your computer and use it in GitHub Desktop.
parseCssMinimal CSS parser
/**
* Minimal CSS parser
* @param {string} content [css style for to be parse into current document]
* @return {cssRules} [description]
*/
function parseCss (content) {
var styleElement = document.createElement('style');
styleElement.textContent = content;
document.implenmentation.createHTMLDocument('')
.body.appendChild(styleElement);
console.log('styleElement.sheet.cssRules '+styleElement.sheet.cssRules);
return styleElement.sheet.cssRules;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment