[theme-reviewers] Theme Review Challenge and Second Opinion

Otto otto at ottodestruct.com
Wed Mar 20 02:01:07 UTC 2013


On Tue, Mar 19, 2013 at 8:32 PM, Bryan Hadaway <bhadaway at gmail.com> wrote:
> Cool, so in the future I could use this technique to get the class in there
> in order to have the dropdown arrows as apposed to the jQuery trick (which
> will obviously have much more load) that I'm using to get .parent? If that's
> correct, I'll definitely put that on my list of improvements to be made.

Yeah, also note that having that script in the header like that, with
the very wide scope of it's target, could lead to some very
unpredictable consequences.

<script type="text/javascript">jQuery("ul").parent("li").addClass("parent");</script>

This script is run at the time that it enters the DOM, which is more
or less immediately after parsing it. But JS typically runs in a
separate thread. So while you're intending it to probably only affect
the nav-menu at this point, it is within the realm of possibility that
some of the rest of the page may load before it actually runs and
does-its-thing. Thus, it is entirely possible for, say, the sidebar
widgets (if they're in a UL/LI structure, which they usually are) to
thus be affected by this JS code as well.

Now, I ain't a theme-reviewer, but I'd certainly fail this code under
any reasonable sanity standard. :) It's just too broad in scope and
it's relying on a side-effect of browser behavior to affect only its
intended targets.

-Otto


More information about the theme-reviewers mailing list