Jun. 26th, 2011

terriko: (Default)
I have a Firefox add-on I made several years ago to help me explore page composition and generate (theoretical) web security policies, and I decided to pull it out of storage and see if it could still be helpful. Of course, my browser decided to update Right Then, and I decided it wasn't worth fighting to stop it from doing so.

So I updated the add-on so that it included versions 5.* and actually, it mostly still worked (despite having been written for, I believe, a very early version of Firefox 3, or maybe a late version Firefox 2? This is one of my earliest add-ons.) except that apparently hasAttribute/getAttribute doesn't exist anymore.

I can't seem to find anywhere telling me that they've been deprecated, and more importantly, what I should be using instead, which is irritating. But the end result is that it doesn't work, so I needed to find something else. It looks like the solution for at least some of my code is to instead use a querySelector to look for all elements with that attribute.

Of course, I never seem to want to do exactly what the darned examples show. So in case you're like me, the way to search for any tag with a given attribute using querySelector is like this:


And if you wanted to search just a specific type of tag, then you'd specify that instead of *. So if you were looking for the alt tags for every image, you'd do...


But I'm concerned by this note in the querySelectorAll documentation, which tells me that it "Returns a non-live NodeList of all elements descended from the element on which it is invoked that match the specified group of CSS selectors."

There's a big warning elsewhere that it's non-live too, unlike other such methods. So my questions are... why is it non-live, and what do I need to do to get a live list? For my particular purpose at the moment I don't think I need it to be live, but for some of the older code that I might want to update in the future I probably do.

I'm mostly just recording this for my own reference later, but if someone happens to be able to tell me if there's another function that more directly replaces hasAttribute, or there's a good way to get a live list of elements with a given attribute, I'd love to know!
terriko: (Default)
More notes from getting myself set up to write code:

The fink project has a page about upgrading from 10.5 to 10.6 with fink.

It's very easy to get distracted by the nice step-by-step description that takes up most of the page.

The pertinent bit of information is at the top, though:

you will probably find it easier to do a clean install from source instead.

I probably should have just done that first, since the lovely instructions didn't work at all for me. Oh well.


terriko: (Default)

September 2017

3456 78 9
1011 121314 1516

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 20th, 2017 04:38 pm
Powered by Dreamwidth Studios