PDA

View Full Version : Cleaning dead code


cocoonfx
06-19-2011, 01:08 PM
Hi Chaps


is there any tools out there which can tell me instantly which code is not in use on my page. I am wanting to do a spring clean on my site but do it quickly if you know what i mean. I know there is dust my selectors but this is not workin g for firefox 4.xx HELP?

jmichae3
06-28-2011, 08:08 AM
dead code elimination is a common code optimization technique. perhaps you could look for a code optimizer. I know there is a Zend Optimizer for PHP.
but I don't know for sure if it does this specifically. it doesn't say, but it might.
http://static.zend.com/topics/Zend-Optimizer-User-Guide-v330-new.pdf

you didn't say what language you were talking about. is this javascript?
ff is on version 5 now, soon to be 6.

ahhh, css you are talking about. please be specific.
do ctrl-f (find) and search for all instances of each class/selector. if you don't find it except in the style tag or css file, it needs to be eliminated.

essentially, that's what this program would need to do. and it requires a parser, since css is NOT simple, (remember the C in CSS stands for Cascading). these two combined make for very complex coding. it's like like writing the parser for a browser, but more complex.

so far I have not seen anything.

domedia
06-28-2011, 02:43 PM
I think James Edwards wrote a FF plugin or something that was able to find orphaned CSS rules. Let me dig a little and see what I can find.

domedia
06-28-2011, 02:50 PM
Dust-Me Selectors

http://www.brothercake.com/site/portfolio/tools/dustmeselectors/

.

edbr
06-30-2011, 03:09 AM
have you used it? it has some pretty mixed reviews

Corrosive
06-30-2011, 06:30 AM
Might just be a case of sitting down one day and running through it. Comment out styles and see the effect. FF developer tools would be a handy aide in doing it as well.

edbr
06-30-2011, 06:38 AM
yes i like the idea of it not suitable for ff 4 yet though

Corrosive
06-30-2011, 06:46 AM
Developer Toolbar https://addons.mozilla.org/en-US/firefox/addon/web-developer/ is what I use and that works on FF5 for me.

Corrosive
06-30-2011, 06:46 AM
Should add also available in Chrome ;)

edbr
06-30-2011, 06:49 AM
yes i have that jut liked the idea of someone else looking for all the redundant css i forgot to delete ::)

jmichae3
06-30-2011, 07:06 AM
ff5 is already out, ff6 is on the way in august. update your browsers.

I think I see some browser bugs(?) with xhtml being case-specific in CSS with ff5. or maybe it's more a case that coders need to stick with lower case tags on everything as a habit anyway!

cool - developer tools.

edbr
06-30-2011, 07:16 AM
yes i prefer to wait with updates as most site visitors also seem to and i like to wait for plugins to catch up if ness

Corrosive
06-30-2011, 07:55 AM
I think I see some browser bugs(?) with xhtml being case-specific in CSS with ff5. or maybe it's more a case that coders need to stick with lower case tags on everything as a habit anyway!



Can you elaborate on that at all Jim? They are not usually case-sensitive so seems like a pretty major flaw if FF5 is making a distinction.

jmichae3
07-05-2011, 12:26 AM
where is the CSS cleanup stuff in web developer?

jmichae3
07-10-2011, 07:07 AM
according to mozilla.org (I submitted 2 bug reports),
https://bugzilla.mozilla.org/show_bug.cgi?id=670019
https://bugzilla.mozilla.org/show_bug.cgi?id=670009

domedia
07-10-2011, 07:25 AM
There is a difference:

1. HTML is not case sensitive.

2. XHTML is (a subset of?) XML. XML is case sensitive.

Change the doctype to <!DOCTYPE html> and use a normal <html> and you're good.

.