[theme-reviewers] Theme Review Challenge and Second Opinion

Daniel Tara contact at onedesigns.com
Wed Mar 20 02:23:49 UTC 2013


I'm sorry, I wanted to say no need to be this general :)

On Mar 20, 2013, at 4:22 AM, Daniel Tara wrote:

>> <script type="text/javascript">jQuery("ul").parent("li").addClass("parent");</script>
> 
> There's no need to be this specific. WordPress adds a sub-menu class to second level menus so you can do it like this:
> 
> $('.sub-menu').parent('.menu-item').addClass('parent');
> 
> Daniel
> 
> On Mar 20, 2013, at 4:01 AM, Otto wrote:
> 
>> 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
>> _______________________________________________
>> theme-reviewers mailing list
>> theme-reviewers at lists.wordpress.org
>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20130320/78d15999/attachment-0001.htm>


More information about the theme-reviewers mailing list