4 ms·
I wanted CSS selector support, and so I just copied and pasted in Zepto with some minor hacks to prevent conflicts with pg's $ function. I'm sure there are easi
by aaronbrethorst 15y ago
I wanted CSS selector support, and so I just copied and pasted in Zepto with some minor hacks to prevent conflicts with pg's $ function. I'm sure there are easier ways to do this, but I've never written one before, either, and wanted to spend as little time as possible writing it.
- eridius 15y agoIt seems like a remarkably bad idea to modify the prototypes of the built-in classes inside a Safari Extension. It's bad enough to do that in a library, but at least the web page is making a deliberate choice to use that library. When you put it in an extension, you've now modified the prototypes of the built-in classes in a way that affects the page, but without the page ever being aware of this. What happens if your function is named the same as one the page tried to define, but behaves differently? For the record, document.querySelectorAll() is built-in and can do selector matching, and the only other thing you use Zepto for (adding classes) is trivially done manually.
- aaronbrethorst 15y agoThanks for the tip. As I'm sure you could tell from the code, this was the result of about 15 minutes of work this morning (from generating the CSR to get my certificate to tossing it onto GitHub). If I ever go back and touch this repo again, I'll use querySelectAll().