travesersing the dom with inexact parameters
Posted
by rashcroft23
on Stack Overflow
See other posts from Stack Overflow
or by rashcroft23
Published on 2010-01-15T02:33:47Z
Indexed on
2010/06/11
4:02 UTC
Read the original article
Hit count: 156
JavaScript
|selectors
Hi, I want to grab the image src on a product page in a e commerce website.
I'm writing this as a bookmarklet, so I'd like the code to work universally as possible.
I've noticed that there are only two reoccurring factors in the product image tag among top e-commerce websites (amazon, bestbuy ect.): border=0
and 180<width&height<400
.
So how could I write a selector that would give me the src
of the first img
element on the page with no border and width & height between 180 and 400 px? Or is there a better way of doing this?
P.S. since I'm trying to keep the bookmarklet as light as possible, I don't want to use any libraries (jquery, yui etc)
© Stack Overflow or respective owner