mennovanslooten / jqanalyze

jqanalyze is a plugin that can give runtime feedback on the selectors, events and DOM structure used in your jQuery project.

Home Page:http://experiments.mennovanslooten.nl/2011/jqanalyze/demos/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Selector warning not quite right.

garbrand opened this issue · comments

Hey Menno,

I thought this message wasn't quite right:

Selector warning: a[href="#poi-10"]
There should be no need to prepend an ID selector with another selector. Use $("#poi") instead.

The selector picks up on 's that link to another anchor - in this case it does not have an id itself and so I guess the advice is misleading. $('#poi') does not select the same as $('a[href="#poi-10"]'), given the structure:

<a href="#poi-10">Go to POI 10</a>
<div id="poi-10">I am POI 10</div>

I realize it is a slooooow selector, so a message should be in order - how about:

Selector warning: a[href="#poi10"]
Selecting by specific attributes could be slow. Consider changing to a more specific selector such as a class or an id.

Bye!
Garbrand