Ideally you want to control the access that widgets have both to your user’s data and to page content. For example you want to remove unvetted access to the DOM and to the global
window object. In this article I’ll describe the approach I’m taking.
I’m sure most of you are familiar with styling DOM elements using CSS selectors. But what if you wanted to create your own stylesheets on the fly or perhaps query or alter existing CSS rules on your page? That’s a little trickier, but also a bit of fun so let’s take a crack at it.
Chrome’s developer console tab is great for playing around to understand or troubleshoot a web application. The other day I wanted to enter more than just a simple one line expression in the console. In this case I wanted to define a whole function across several lines. I wasn’t sure if that was possible. Turns out it is.
It had been a while since I’d played around with setting up WordPress. I’d configured syntax highlighting for code snippets before but not together with using Markdown. But hey wouldn’t it be neat to write articles in Markdown? I’ve grown used to using it lately.
So I set out to see what I could get working. I didn’t expect it to take that long; how hard could it be? Well it turned out to be rather a pain in the neck; so I wrote this post to help you avoid that pain (and to provide a bit of a cathartic release for me!).
So how do these libraries make this happen and how can you do this with your own functions? Take for example a function that sums a list of numbers.